Skip to content

Commit 04cce22

Browse files
authored
Merge pull request php-vcr#225 from nstapelbroek/feature/remove-legacy-php-cs-fixer
Feature/remove legacy php cs fixer
2 parents 459d8b3 + 46f1677 commit 04cce22

File tree

10 files changed

+69
-1090
lines changed

10 files changed

+69
-1090
lines changed

.php_cs.dist

Lines changed: 16 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -1,46 +1,20 @@
11
<?php
22

3-
if (class_exists('\\PhpCsFixer\\Config')) {
4-
$cacheFile = getenv('TRAVIS') ? getenv('HOME') . '/.php_cs.cache' : __DIR__ . '/.php_cs.cache';
5-
$config = PhpCsFixer\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);
3+
return PhpCsFixer\Config::create()
4+
->setRules([
5+
'@PSR2' => true,
6+
'single_blank_line_before_namespace' => true,
7+
'concat_space' => ['spacing' => 'one'],
8+
'single_quote' => true,
9+
'braces' => true,
10+
])
2211

23-
return $config;
24-
} else {
25-
$config = Symfony\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-
$cacheDir = getenv('TRAVIS') ? getenv('HOME') . '/.php-cs-fixer' : __DIR__;
43-
$config->setDir($cacheDir);
44-
return $config;
45-
}
12+
->setFinder(
13+
PhpCsFixer\Finder::create()
14+
->exclude('vendor')
15+
->exclude('docs')
16+
->in(__DIR__)
17+
)
18+
19+
->setRiskyAllowed(true);
4620

.travis.yml

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ matrix:
2020
php: 7.0
2121
- env: TEST_DIR=. COMPOSER_FLAGS="--prefer-lowest"
2222
php: 7.0
23-
- env: TEST_DIR=.
23+
- env: TEST_DIR=. PHP_CS_FIXER=true
2424
php: 7.1
2525
- env: TEST_DIR=. COMPOSER_FLAGS="--prefer-lowest"
2626
php: 7.1
@@ -39,14 +39,12 @@ before_install:
3939
install:
4040
- composer update --prefer-source -o $COMPOSER_FLAGS
4141
- PHPUNIT_BIN=$(pwd)/vendor/bin/phpunit
42-
- 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"
4442
- cd ${TEST_DIR}
4543
- composer update --prefer-source -o $COMPOSER_FLAGS
4644

4745
script:
4846
- $PHPUNIT_BIN --coverage-clover=coverage.clover
49-
- test $TEST_DIR = "." && $PHPCS_FIXER_BIN fix $PHPCS_FIXER_CONFIG_FLAG --dry-run --diff $TRAVIS_BUILD_DIR || echo "Continue without php-cs-fixer"
47+
- if [ "${PHP_CS_FIXER}" = "true" ]; then wget http://cs.sensiolabs.org/download/php-cs-fixer-v2.phar && php ./php-cs-fixer-v2.phar fix --dry-run --diff $TRAVIS_BUILD_DIR; fi
5048

5149
after_success:
5250
- wget https://scrutinizer-ci.com/ocular.phar

composer.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,7 @@
2727
"phpunit/phpunit": "^4.8|^5.0",
2828
"sebastian/version": "^1.0.3|^2.0",
2929
"mikey179/vfsStream": "^1.2",
30-
"lapistano/proxy-object": "dev-master#d7184a479f502d5a0f96d0bae73566dbb498da8f",
31-
"friendsofphp/php-cs-fixer": "^2.7|^1.12"
30+
"lapistano/proxy-object": "dev-master#d7184a479f502d5a0f96d0bae73566dbb498da8f"
3231
},
3332

3433
"autoload": {

0 commit comments

Comments
 (0)