Skip to content

Commit 7c76cd2

Browse files
nstapelbroekrenatomefi
authored andcommitted
php-cs-fixer introduced (php-vcr#173)
* Add phpcs to the composer development dependencies * add php-cs-fixer to the development dependencies * Run php-cs-fixer to autofix common codestyle issues * Fix remaining codestyle issues in src * Add codestyle check to travis * use TRAVIS_BUILD_DIR to find the src directory in any build matrix * Run php-cs-fixer in favour of phpcs. * Fix the php-cs-fixer violations in the tests directory * Fix short array syntax on the .php_cs file * Add single_quote and braces validator to the .php_cs file
1 parent 79624e9 commit 7c76cd2

33 files changed

+632
-105
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,3 +4,4 @@
44
coverage/*
55
notes.md
66
tests/fixtures/cassette*
7+
/.php_cs.cache

.php_cs

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
<?php
2+
$config = Symfony\CS\Config\Config::create()
3+
->level('psr2')
4+
->fixers(
5+
array(
6+
'single_blank_line_before_namespace',
7+
'concat_with_spaces',
8+
'single_quote',
9+
'braces',
10+
)
11+
)
12+
->finder(
13+
Symfony\CS\Finder\DefaultFinder::create()
14+
->exclude('vendor')
15+
->exclude('docs')
16+
->in(__DIR__)
17+
)
18+
->setUsingCache(true);
19+
20+
$cacheDir = getenv('TRAVIS') ? getenv('HOME') . '/.php-cs-fixer' : __DIR__;
21+
$config->setDir($cacheDir);
22+
23+
return $config;

.travis.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,11 +34,13 @@ before_install:
3434
install:
3535
- composer update --prefer-source -o $COMPOSER_FLAGS
3636
- PHPUNIT_BIN=$(pwd)/vendor/bin/phpunit
37+
- PHPCS_FIXER_BIN=$(pwd)/vendor/bin/php-cs-fixer
3738
- cd ${TEST_DIR}
3839
- composer update --prefer-source -o $COMPOSER_FLAGS
3940

4041
script:
4142
- $PHPUNIT_BIN --coverage-clover=coverage.clover
43+
- $PHPCS_FIXER_BIN fix --dry-run --diff $TRAVIS_BUILD_DIR
4244

4345
after_success:
4446
- wget https://scrutinizer-ci.com/ocular.phar

composer.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,8 @@
2525
"phpunit/phpunit": "^4.8|^5.0",
2626
"sebastian/version": "^1.0.3|^2.0",
2727
"mikey179/vfsStream": "^1.2",
28-
"lapistano/proxy-object": "dev-master#d7184a479f502d5a0f96d0bae73566dbb498da8f"
28+
"lapistano/proxy-object": "dev-master#d7184a479f502d5a0f96d0bae73566dbb498da8f",
29+
"friendsofphp/php-cs-fixer": "^1.12"
2930
},
3031

3132
"autoload": {

0 commit comments

Comments
 (0)