File tree Expand file tree Collapse file tree 4 files changed +49
-24
lines changed Expand file tree Collapse file tree 4 files changed +49
-24
lines changed Original file line number Diff line number Diff line change @@ -5,3 +5,4 @@ coverage/*
55notes.md 
66tests /fixtures /cassette * 
77/.php_cs.cache 
8+ /.php_cs 
Load Diff This file was deleted. 
Original file line number Diff line number Diff line change 1+ <?php 
2+ 
3+ if  (class_exists ('\\PhpCsFixer \\Config ' )) {
4+  $ cacheFilegetenv ('TRAVIS ' ) ? getenv ('HOME ' ) . '/.php_cs.cache '  : __DIR__  . '/.php_cs.cache ' ;
5+  $ configPhpCsFixer \Config::create ()
6+  ->setRules (array (
7+  '@PSR2 '  => true ,
8+  'single_blank_line_before_namespace '  => true ,
9+  'concat_space '  => array ('spacing '  => 'one ' ),
10+  'single_quote '  => true ,
11+  'braces '  => true ,
12+  ))
13+  ->setFinder (
14+  PhpCsFixer \Finder::create ()
15+  ->exclude ('vendor ' )
16+  ->exclude ('docs ' )
17+  ->in (__DIR__ )
18+  )
19+  ->setCacheFile ($ cacheFile
20+  ->setUsingCache (true )
21+  ->setRiskyAllowed (true );
22+ 
23+  return  $ config
24+ } else  {
25+  $ configSymfony \CS \Config \Config::create ()
26+  ->level (Symfony \CS \FixerInterface::PSR2_LEVEL )
27+  ->fixers (
28+  array (
29+  'single_blank_line_before_namespace ' ,
30+  'concat_with_spaces ' ,
31+  'single_quote ' ,
32+  'braces ' ,
33+  )
34+  )
35+  ->finder (
36+  Symfony \CS \Finder::create ()
37+  ->exclude ('vendor ' )
38+  ->exclude ('docs ' )
39+  ->in (__DIR__ )
40+  )
41+  ->setUsingCache (true );
42+  $ cacheDirgetenv ('TRAVIS ' ) ? getenv ('HOME ' ) . '/.php-cs-fixer '  : __DIR__ ;
43+  $ configsetDir ($ cacheDir
44+  return  $ config
45+ }
46+ 
Original file line number Diff line number Diff line change @@ -40,12 +40,13 @@ install:
4040 - composer update --prefer-source -o $COMPOSER_FLAGS 
4141 - PHPUNIT_BIN=$(pwd)/vendor/bin/phpunit 
4242 - PHPCS_FIXER_BIN=$(pwd)/vendor/bin/php-cs-fixer 
43+  - $PHPCS_FIXER_BIN --version | grep -q "2.*.*" && PHPCS_FIXER_CONFIG_FLAG="--config=.php_cs.dist" || PHPCS_FIXER_CONFIG_FLAG="--config-file=.php_cs.dist" 
4344 - cd ${TEST_DIR} 
4445 - composer update --prefer-source -o $COMPOSER_FLAGS 
4546
4647script :
4748 - $PHPUNIT_BIN --coverage-clover=coverage.clover 
48-  - test $TEST_DIR = "." && $PHPCS_FIXER_BIN fix --config-file=.php_cs  --dry-run --diff $TRAVIS_BUILD_DIR || echo "Continue without php-cs-fixer" 
49+  - test $TEST_DIR = "." && $PHPCS_FIXER_BIN fix $PHPCS_FIXER_CONFIG_FLAG  --dry-run --diff $TRAVIS_BUILD_DIR || echo "Continue without php-cs-fixer" 
4950
5051after_success :
5152 - wget https://scrutinizer-ci.com/ocular.phar 
                         You can’t perform that action at this time. 
           
                  
0 commit comments