From c704d13f5641abaa84e5bf5abdba5a681c552543 Mon Sep 17 00:00:00 2001 From: Dariusz Ruminski Date: Wed, 7 Apr 2021 18:39:18 +0200 Subject: [PATCH] DX: new config filename --- .gitignore | 2 +- .php-cs-fixer.dist.php | 63 +++++++++++++++++++ .php_cs.dist | 15 ++++- ci-integration.sh | 4 +- doc/config.rst | 6 +- doc/usage.rst | 4 +- src/Console/Command/FixCommand.php | 2 +- src/Console/Command/HelpCommand.php | 6 +- src/Console/ConfigurationResolver.php | 23 +++++-- .../ProjectFixerConfigurationTest.php | 4 +- tests/ConfigTest.php | 2 +- tests/Console/ConfigurationResolverTest.php | 50 +++++++-------- ...cs_custom.php => .php-cs-fixer.custom.php} | 0 .../{.php_cs.dist => .php-cs-fixer.dist.php} | 0 .../case_2/{.php_cs => .php-cs-fixer.php} | 0 .../{.php_cs.dist => .php-cs-fixer.dist.php} | 0 .../case_3/{.php_cs => .php-cs-fixer.php} | 0 .../case_4/{my.php_cs => my.php-cs-fixer.php} | 2 +- .../{.php_cs.dist => .php-cs-fixer.dist.php} | 0 .../{.php_cs.dist => .php-cs-fixer.dist.php} | 0 .../case_7/{.php_cs => .php-cs-fixer.php} | 0 .../case_8/{.php_cs => .php-cs-fixer.php} | 0 .../case_9/{.php_cs => .php-cs-fixer.php} | 0 .../d/{.php_cs => .php-cs-fixer.php} | 0 .../{.php_cs.dist => .php-cs-fixer.dist.php} | 0 tests/Smoke/CiIntegrationTest.php | 12 ++-- 26 files changed, 143 insertions(+), 52 deletions(-) create mode 100644 .php-cs-fixer.dist.php rename tests/Fixtures/{.php_cs_custom.php => .php-cs-fixer.custom.php} (100%) rename tests/Fixtures/ConfigurationResolverConfigFile/case_1/{.php_cs.dist => .php-cs-fixer.dist.php} (100%) rename tests/Fixtures/ConfigurationResolverConfigFile/case_2/{.php_cs => .php-cs-fixer.php} (100%) rename tests/Fixtures/ConfigurationResolverConfigFile/case_3/{.php_cs.dist => .php-cs-fixer.dist.php} (100%) rename tests/Fixtures/ConfigurationResolverConfigFile/case_3/{.php_cs => .php-cs-fixer.php} (100%) rename tests/Fixtures/ConfigurationResolverConfigFile/case_4/{my.php_cs => my.php-cs-fixer.php} (67%) rename tests/Fixtures/ConfigurationResolverConfigFile/case_5/{.php_cs.dist => .php-cs-fixer.dist.php} (100%) rename tests/Fixtures/ConfigurationResolverConfigFile/case_6/{.php_cs.dist => .php-cs-fixer.dist.php} (100%) rename tests/Fixtures/ConfigurationResolverConfigFile/case_7/{.php_cs => .php-cs-fixer.php} (100%) rename tests/Fixtures/ConfigurationResolverConfigFile/case_8/{.php_cs => .php-cs-fixer.php} (100%) rename tests/Fixtures/ConfigurationResolverConfigFile/case_9/{.php_cs => .php-cs-fixer.php} (100%) rename tests/Fixtures/ConfigurationResolverPathsIntersection/d/{.php_cs => .php-cs-fixer.php} (100%) rename tests/Fixtures/ci-integration/{.php_cs.dist => .php-cs-fixer.dist.php} (100%) diff --git a/.gitignore b/.gitignore index 1acd5822c1e..d556e2eec88 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,4 @@ -/.php_cs +/.php-cs-fixer.php /.phpunit.result.cache /box.json /composer.lock diff --git a/.php-cs-fixer.dist.php b/.php-cs-fixer.dist.php new file mode 100644 index 00000000000..e33c2514d56 --- /dev/null +++ b/.php-cs-fixer.dist.php @@ -0,0 +1,63 @@ + + * Dariusz Rumiński + * + * This source file is subject to the MIT license that is bundled + * with this source code in the file LICENSE. + */ + +$header = <<<'EOF' +This file is part of PHP CS Fixer. + +(c) Fabien Potencier + Dariusz Rumiński + +This source file is subject to the MIT license that is bundled +with this source code in the file LICENSE. +EOF; + +$finder = PhpCsFixer\Finder::create() + ->exclude('tests/Fixtures') + ->in(__DIR__) + ->append([ + __DIR__.'/dev-tools/doc.php', + __DIR__.'/php-cs-fixer', + ]) +; + +$config = new PhpCsFixer\Config(); +$config + ->setRiskyAllowed(true) + ->setRules([ + '@PHP56Migration' => true, + '@PHPUnit75Migration:risky' => true, + '@PhpCsFixer' => true, + '@PhpCsFixer:risky' => true, + 'header_comment' => ['header' => $header], + 'list_syntax' => ['syntax' => 'long'], + ]) + ->setFinder($finder) +; + +// special handling of fabbot.io service if it's using too old PHP CS Fixer version +if (false !== getenv('FABBOT_IO')) { + try { + PhpCsFixer\FixerFactory::create() + ->registerBuiltInFixers() + ->registerCustomFixers($config->getCustomFixers()) + ->useRuleSet(new PhpCsFixer\RuleSet($config->getRules())) + ; + } catch (PhpCsFixer\ConfigurationException\InvalidConfigurationException $e) { + $config->setRules([]); + } catch (UnexpectedValueException $e) { + $config->setRules([]); + } catch (InvalidArgumentException $e) { + $config->setRules([]); + } +} + +return $config; diff --git a/.php_cs.dist b/.php_cs.dist index 1c9ea9b79da..d2ee632c254 100644 --- a/.php_cs.dist +++ b/.php_cs.dist @@ -1,5 +1,17 @@ + * Dariusz Rumiński + * + * This source file is subject to the MIT license that is bundled + * with this source code in the file LICENSE. + */ + +// HARD copy of .php-cs-fixer.dist.php file for fabbot.io compatibility for PHP CS Fixer v2 + $header = <<<'EOF' This file is part of PHP CS Fixer. @@ -39,7 +51,8 @@ if (false !== getenv('FABBOT_IO')) { PhpCsFixer\FixerFactory::create() ->registerBuiltInFixers() ->registerCustomFixers($config->getCustomFixers()) - ->useRuleSet(new PhpCsFixer\RuleSet($config->getRules())); + ->useRuleSet(new PhpCsFixer\RuleSet($config->getRules())) + ; } catch (PhpCsFixer\ConfigurationException\InvalidConfigurationException $e) { $config->setRules([]); } catch (UnexpectedValueException $e) { diff --git a/ci-integration.sh b/ci-integration.sh index 489c5d26a9f..2521e2494c9 100644 --- a/ci-integration.sh +++ b/ci-integration.sh @@ -4,5 +4,5 @@ set -eu IFS=' ' CHANGED_FILES=$(git diff --name-only --diff-filter=ACMRTUXB "${COMMIT_RANGE}") -if ! echo "${CHANGED_FILES}" | grep -qE "^(\\.php_cs(\\.dist)?|composer\\.lock)$"; then EXTRA_ARGS=$(printf -- '--path-mode=intersection\n--\n%s' "${CHANGED_FILES}"); else EXTRA_ARGS=''; fi -vendor/bin/php-cs-fixer fix --config=.php_cs.dist -v --dry-run --stop-on-violation --using-cache=no ${EXTRA_ARGS} +if ! echo "${CHANGED_FILES}" | grep -qE "^(\\.php-cs-fixer(\\.dist)?\\.php|composer\\.lock)$"; then EXTRA_ARGS=$(printf -- '--path-mode=intersection\n--\n%s' "${CHANGED_FILES}"); else EXTRA_ARGS=''; fi +vendor/bin/php-cs-fixer fix --config=.php-cs-fixer.dist.php -v --dry-run --stop-on-violation --using-cache=no ${EXTRA_ARGS} diff --git a/doc/config.rst b/doc/config.rst index c48e91bf980..b23f4bb23bf 100644 --- a/doc/config.rst +++ b/doc/config.rst @@ -3,14 +3,14 @@ Config file =========== Instead of using command line options to customize rules and rule sets, you can save the -project configuration in a ``.php_cs.dist`` file in the root directory of your project. +project configuration in a ``.php-cs-fixer.dist.php`` file in the root directory of your project. The file must return an instance of `PhpCsFixer\\ConfigInterface <../src/ConfigInterface.php>`_ which lets you configure the rules, the files and directories that -need to be analyzed. You may also create ``.php_cs`` file, which is +need to be analyzed. You may also create ``.php-cs-fixer.php`` file, which is the local configuration that will be used instead of the project configuration. It is a good practice to add that file into your ``.gitignore`` file. With the ``--config`` option you can specify the path to the -``.php_cs`` file. +``.php-cs-fixer.php`` file. The example below will add two rules to the default list of PSR2 set rules: diff --git a/doc/usage.rst b/doc/usage.rst index 9974c3cd38f..7e9c00ea783 100644 --- a/doc/usage.rst +++ b/doc/usage.rst @@ -179,8 +179,8 @@ Then, add the following command to your CI: $ IFS=' $ ' $ CHANGED_FILES=$(git diff --name-only --diff-filter=ACMRTUXB "${COMMIT_RANGE}") - $ if ! echo "${CHANGED_FILES}" | grep -qE "^(\\.php_cs(\\.dist)?|composer\\.lock)$"; then EXTRA_ARGS=$(printf -- '--path-mode=intersection\n--\n%s' "${CHANGED_FILES}"); else EXTRA_ARGS=''; fi - $ vendor/bin/php-cs-fixer fix --config=.php_cs.dist -v --dry-run --stop-on-violation --using-cache=no ${EXTRA_ARGS} + $ if ! echo "${CHANGED_FILES}" | grep -qE "^(\\.php-cs-fixer(\\.dist)?\\.php|composer\\.lock)$"; then EXTRA_ARGS=$(printf -- '--path-mode=intersection\n--\n%s' "${CHANGED_FILES}"); else EXTRA_ARGS=''; fi + $ vendor/bin/php-cs-fixer fix --config=.php-cs-fixer.dist.php -v --dry-run --stop-on-violation --using-cache=no ${EXTRA_ARGS} Where ``$COMMIT_RANGE`` is your range of commits, e.g. ``$TRAVIS_COMMIT_RANGE`` or ``HEAD~..HEAD``. diff --git a/src/Console/Command/FixCommand.php b/src/Console/Command/FixCommand.php index 492b9a6a5e0..3a22882f38f 100644 --- a/src/Console/Command/FixCommand.php +++ b/src/Console/Command/FixCommand.php @@ -100,7 +100,7 @@ protected function configure() new InputArgument('path', InputArgument::IS_ARRAY, 'The path.'), new InputOption('path-mode', '', InputOption::VALUE_REQUIRED, 'Specify path mode (can be override or intersection).', 'override'), new InputOption('allow-risky', '', InputOption::VALUE_REQUIRED, 'Are risky fixers allowed (can be yes or no).'), - new InputOption('config', '', InputOption::VALUE_REQUIRED, 'The path to a .php_cs file.'), + new InputOption('config', '', InputOption::VALUE_REQUIRED, 'The path to a .php-cs-fixer.php file.'), new InputOption('dry-run', '', InputOption::VALUE_NONE, 'Only shows which files would have been modified.'), new InputOption('rules', '', InputOption::VALUE_REQUIRED, 'The rules.'), new InputOption('using-cache', '', InputOption::VALUE_REQUIRED, 'Does cache should be used (can be yes or no).'), diff --git a/src/Console/Command/HelpCommand.php b/src/Console/Command/HelpCommand.php index 86481588540..260e104087e 100644 --- a/src/Console/Command/HelpCommand.php +++ b/src/Console/Command/HelpCommand.php @@ -167,14 +167,14 @@ public static function getHelpCopy() ----------- Instead of using command line options to customize the rule, you can save the -project configuration in a .php_cs.dist file in the root directory of your project. +project configuration in a .php-cs-fixer.dist.php file in the root directory of your project. The file must return an instance of `PhpCsFixer\ConfigInterface` (%%%CONFIG_INTERFACE_URL%%%) which lets you configure the rules, the files and directories that -need to be analyzed. You may also create .php_cs file, which is +need to be analyzed. You may also create .php-cs-fixer.php file, which is the local configuration that will be used instead of the project configuration. It is a good practice to add that file into your .gitignore file. With the --config option you can specify the path to the -.php_cs file. +.php-cs-fixer.php file. The example below will add two rules to the default list of PSR2 set rules: diff --git a/src/Console/ConfigurationResolver.php b/src/Console/ConfigurationResolver.php index 46f186a741c..2fd16d9dfb9 100644 --- a/src/Console/ConfigurationResolver.php +++ b/src/Console/ConfigurationResolver.php @@ -227,6 +227,17 @@ public function getConfig() continue; } + $configFileBasename = basename($configFile); + $deprecatedConfigs = [ + '.php_cs' => '.php-cs-fixer.php', + '.php_cs.dist' => '.php-cs-fixer.dist.php', + ]; + + if (isset($deprecatedConfigs[$configFileBasename])) { + $message = "Configuration file `{$configFileBasename}` is deprecated, rename to `{$deprecatedConfigs[$configFileBasename]}`."; + Utils::triggerDeprecation($message, InvalidConfigurationException::class); + } + $config = self::separatedContextLessInclude($configFile); // verify that the config has an instance of Config @@ -605,13 +616,17 @@ private function computeConfigFiles() } $candidates = [ - $configDir.\DIRECTORY_SEPARATOR.'.php_cs', - $configDir.\DIRECTORY_SEPARATOR.'.php_cs.dist', + $configDir.\DIRECTORY_SEPARATOR.'.php-cs-fixer.php', + $configDir.\DIRECTORY_SEPARATOR.'.php-cs-fixer.dist.php', + $configDir.\DIRECTORY_SEPARATOR.'.php_cs', // old v2 config, present here only to throw nice error message later + $configDir.\DIRECTORY_SEPARATOR.'.php_cs.dist', // old v2 config, present here only to throw nice error message later ]; if ($configDir !== $this->cwd) { - $candidates[] = $this->cwd.\DIRECTORY_SEPARATOR.'.php_cs'; - $candidates[] = $this->cwd.\DIRECTORY_SEPARATOR.'.php_cs.dist'; + $candidates[] = $this->cwd.\DIRECTORY_SEPARATOR.'.php-cs-fixer.php'; + $candidates[] = $this->cwd.\DIRECTORY_SEPARATOR.'.php-cs-fixer.dist.php'; + $candidates[] = $this->cwd.\DIRECTORY_SEPARATOR.'.php_cs'; // old v2 config, present here only to throw nice error message later + $candidates[] = $this->cwd.\DIRECTORY_SEPARATOR.'.php_cs.dist'; // old v2 config, present here only to throw nice error message later } return $candidates; diff --git a/tests/AutoReview/ProjectFixerConfigurationTest.php b/tests/AutoReview/ProjectFixerConfigurationTest.php index c3b6d38ca54..defdb204249 100644 --- a/tests/AutoReview/ProjectFixerConfigurationTest.php +++ b/tests/AutoReview/ProjectFixerConfigurationTest.php @@ -51,7 +51,7 @@ public function testRuleDefinedAlpha() { $rules = $rulesSorted = array_keys($this->loadConfig()->getRules()); sort($rulesSorted); - static::assertSame($rulesSorted, $rules, 'Please sort the "rules" in `.php_cs.dist` of this project.'); + static::assertSame($rulesSorted, $rules, 'Please sort the "rules" in `.php-cs-fixer.dist.php` of this project.'); } /** @@ -59,6 +59,6 @@ public function testRuleDefinedAlpha() */ private function loadConfig() { - return require __DIR__.'/../../.php_cs.dist'; + return require __DIR__.'/../../.php-cs-fixer.dist.php'; } } diff --git a/tests/ConfigTest.php b/tests/ConfigTest.php index 780e9a808d8..1b8f24f5494 100644 --- a/tests/ConfigTest.php +++ b/tests/ConfigTest.php @@ -94,7 +94,7 @@ public function testConfigRulesUsingInvalidJson() public function testCustomConfig() { - $customConfigFile = __DIR__.'/Fixtures/.php_cs_custom.php'; + $customConfigFile = __DIR__.'/Fixtures/.php-cs-fixer.custom.php'; $application = new Application(); $application->add(new FixCommand(new ToolInfo())); diff --git a/tests/Console/ConfigurationResolverTest.php b/tests/Console/ConfigurationResolverTest.php index d2fe33087a6..153609f1a69 100644 --- a/tests/Console/ConfigurationResolverTest.php +++ b/tests/Console/ConfigurationResolverTest.php @@ -204,13 +204,13 @@ public function testResolveConfigFileByPathOfFile() $resolver = $this->createConfigurationResolver(['path' => [$dir.\DIRECTORY_SEPARATOR.'foo.php']]); - static::assertSame($dir.\DIRECTORY_SEPARATOR.'.php_cs.dist', $resolver->getConfigFile()); + static::assertSame($dir.\DIRECTORY_SEPARATOR.'.php-cs-fixer.dist.php', $resolver->getConfigFile()); static::assertInstanceOf(\Test1Config::class, $resolver->getConfig()); } public function testResolveConfigFileSpecified() { - $file = __DIR__.'/../Fixtures/ConfigurationResolverConfigFile/case_4/my.php_cs'; + $file = __DIR__.'/../Fixtures/ConfigurationResolverConfigFile/case_4/my.php-cs-fixer.php'; $resolver = $this->createConfigurationResolver(['config' => $file]); @@ -244,28 +244,28 @@ public function provideResolveConfigFileDefaultCases() return [ [ - $dirBase.'case_1'.\DIRECTORY_SEPARATOR.'.php_cs.dist', + $dirBase.'case_1'.\DIRECTORY_SEPARATOR.'.php-cs-fixer.dist.php', 'Test1Config', $dirBase.'case_1', ], [ - $dirBase.'case_2'.\DIRECTORY_SEPARATOR.'.php_cs', + $dirBase.'case_2'.\DIRECTORY_SEPARATOR.'.php-cs-fixer.php', 'Test2Config', $dirBase.'case_2', ], [ - $dirBase.'case_3'.\DIRECTORY_SEPARATOR.'.php_cs', + $dirBase.'case_3'.\DIRECTORY_SEPARATOR.'.php-cs-fixer.php', 'Test3Config', $dirBase.'case_3', ], [ - $dirBase.'case_6'.\DIRECTORY_SEPARATOR.'.php_cs.dist', + $dirBase.'case_6'.\DIRECTORY_SEPARATOR.'.php-cs-fixer.dist.php', 'Test6Config', $dirBase.'case_6'.\DIRECTORY_SEPARATOR.'subdir', $dirBase.'case_6', ], [ - $dirBase.'case_6'.\DIRECTORY_SEPARATOR.'.php_cs.dist', + $dirBase.'case_6'.\DIRECTORY_SEPARATOR.'.php-cs-fixer.dist.php', 'Test6Config', $dirBase.'case_6'.\DIRECTORY_SEPARATOR.'subdir/empty_file.php', $dirBase.'case_6', @@ -277,7 +277,7 @@ public function testResolveConfigFileChooseFileWithInvalidFile() { $this->expectException(InvalidConfigurationException::class); $this->expectExceptionMessageMatches( - '#^The config file: ".+[\/\\\]Fixtures[\/\\\]ConfigurationResolverConfigFile[\/\\\]case_5[\/\\\]\.php_cs\.dist" does not return a "PhpCsFixer\\\ConfigInterface" instance\. Got: "string"\.$#' + '#^The config file: ".+[\/\\\]Fixtures[\/\\\]ConfigurationResolverConfigFile[\/\\\]case_5[\/\\\]\.php-cs-fixer\.dist\.php" does not return a "PhpCsFixer\\\ConfigInterface" instance\. Got: "string"\.$#' ); $dirBase = $this->getFixtureDir(); @@ -306,7 +306,7 @@ public function testResolveConfigFileChooseFileWithPathArrayWithoutConfig() $dirBase = $this->getFixtureDir(); - $resolver = $this->createConfigurationResolver(['path' => [$dirBase.'case_1/.php_cs.dist', $dirBase.'case_1/foo.php']]); + $resolver = $this->createConfigurationResolver(['path' => [$dirBase.'case_1/.php-cs-fixer.dist.php', $dirBase.'case_1/foo.php']]); $resolver->getConfig(); } @@ -316,8 +316,8 @@ public function testResolveConfigFileChooseFileWithPathArrayAndConfig() $dirBase = $this->getFixtureDir(); $resolver = $this->createConfigurationResolver([ - 'config' => $dirBase.'case_1/.php_cs.dist', - 'path' => [$dirBase.'case_1/.php_cs.dist', $dirBase.'case_1/foo.php'], + 'config' => $dirBase.'case_1/.php-cs-fixer.dist.php', + 'path' => [$dirBase.'case_1/.php-cs-fixer.dist.php', $dirBase.'case_1/foo.php'], ]); static::assertInstanceOf(\PhpCsFixer\Console\ConfigurationResolver::class, $resolver); @@ -641,56 +641,56 @@ static function ($item) use ($dir) { null, [$dir.'/d/d1.php', $dir.'/d/d2.php'], 'override', - $dir.'/d/.php_cs', + $dir.'/d/.php-cs-fixer.php', ], 'configured by config file, intersected with multiple files' => [ $cb(['d/d1.php', 'd/d2.php']), null, [$dir.'/d/d1.php', $dir.'/d/d2.php'], 'intersection', - $dir.'/d/.php_cs', + $dir.'/d/.php-cs-fixer.php', ], 'configured by config file, overridden by non-existing dir' => [ new \LogicException(), null, [$dir.'/d/fff'], 'override', - $dir.'/d/.php_cs', + $dir.'/d/.php-cs-fixer.php', ], 'configured by config file, intersected with non-existing dir' => [ new \LogicException(), null, [$dir.'/d/fff'], 'intersection', - $dir.'/d/.php_cs', + $dir.'/d/.php-cs-fixer.php', ], 'configured by config file, overridden by non-existing file' => [ new \LogicException(), null, [$dir.'/d/fff.php'], 'override', - $dir.'/d/.php_cs', + $dir.'/d/.php-cs-fixer.php', ], 'configured by config file, intersected with non-existing file' => [ new \LogicException(), null, [$dir.'/d/fff.php'], 'intersection', - $dir.'/d/.php_cs', + $dir.'/d/.php-cs-fixer.php', ], 'configured by config file, overridden by multiple files and dirs' => [ $cb(['d/d1.php', 'd/e/de1.php', 'd/f/df1.php']), null, [$dir.'/d/d1.php', $dir.'/d/e', $dir.'/d/f/'], 'override', - $dir.'/d/.php_cs', + $dir.'/d/.php-cs-fixer.php', ], 'configured by config file, intersected with multiple files and dirs' => [ $cb(['d/d1.php', 'd/e/de1.php', 'd/f/df1.php']), null, [$dir.'/d/d1.php', $dir.'/d/e', $dir.'/d/f/'], 'intersection', - $dir.'/d/.php_cs', + $dir.'/d/.php-cs-fixer.php', ], ]; } @@ -719,13 +719,13 @@ public function provideConfigFinderIsOverriddenCases() return [ [ [ - 'config' => $root.'/.php_cs.dist', + 'config' => $root.'/.php-cs-fixer.dist.php', ], false, ], [ [ - 'config' => $root.'/.php_cs.dist', + 'config' => $root.'/.php-cs-fixer.dist.php', 'path' => [$root.'/src'], ], true, @@ -742,7 +742,7 @@ public function provideConfigFinderIsOverriddenCases() ], [ [ - 'config' => $root.'/.php_cs.dist', + 'config' => $root.'/.php-cs-fixer.dist.php', 'path' => [$root.'/src'], 'path-mode' => ConfigurationResolver::PATH_MODE_INTERSECTION, ], @@ -751,7 +751,7 @@ public function provideConfigFinderIsOverriddenCases() // scenario when loaded config is not setting custom finder [ [ - 'config' => $root.'/tests/Fixtures/ConfigurationResolverConfigFile/case_3/.php_cs.dist', + 'config' => $root.'/tests/Fixtures/ConfigurationResolverConfigFile/case_3/.php-cs-fixer.dist.php', 'path' => [$root.'/src'], ], false, @@ -759,7 +759,7 @@ public function provideConfigFinderIsOverriddenCases() // scenario when loaded config contains not fully defined finder [ [ - 'config' => $root.'/tests/Fixtures/ConfigurationResolverConfigFile/case_9/.php_cs', + 'config' => $root.'/tests/Fixtures/ConfigurationResolverConfigFile/case_9/.php-cs-fixer.php', 'path' => [$root.'/src'], ], false, @@ -1190,7 +1190,7 @@ public function testResolveConfigFileOverridesDefault() { $dir = __DIR__.'/../Fixtures/ConfigurationResolverConfigFile/case_8'; - $resolver = $this->createConfigurationResolver(['path' => [$dir.\DIRECTORY_SEPARATOR.'.php_cs']]); + $resolver = $this->createConfigurationResolver(['path' => [$dir.\DIRECTORY_SEPARATOR.'.php-cs-fixer.php']]); static::assertTrue($resolver->getRiskyAllowed()); static::assertSame(['php_unit_construct' => true], $resolver->getRules()); diff --git a/tests/Fixtures/.php_cs_custom.php b/tests/Fixtures/.php-cs-fixer.custom.php similarity index 100% rename from tests/Fixtures/.php_cs_custom.php rename to tests/Fixtures/.php-cs-fixer.custom.php diff --git a/tests/Fixtures/ConfigurationResolverConfigFile/case_1/.php_cs.dist b/tests/Fixtures/ConfigurationResolverConfigFile/case_1/.php-cs-fixer.dist.php similarity index 100% rename from tests/Fixtures/ConfigurationResolverConfigFile/case_1/.php_cs.dist rename to tests/Fixtures/ConfigurationResolverConfigFile/case_1/.php-cs-fixer.dist.php diff --git a/tests/Fixtures/ConfigurationResolverConfigFile/case_2/.php_cs b/tests/Fixtures/ConfigurationResolverConfigFile/case_2/.php-cs-fixer.php similarity index 100% rename from tests/Fixtures/ConfigurationResolverConfigFile/case_2/.php_cs rename to tests/Fixtures/ConfigurationResolverConfigFile/case_2/.php-cs-fixer.php diff --git a/tests/Fixtures/ConfigurationResolverConfigFile/case_3/.php_cs.dist b/tests/Fixtures/ConfigurationResolverConfigFile/case_3/.php-cs-fixer.dist.php similarity index 100% rename from tests/Fixtures/ConfigurationResolverConfigFile/case_3/.php_cs.dist rename to tests/Fixtures/ConfigurationResolverConfigFile/case_3/.php-cs-fixer.dist.php diff --git a/tests/Fixtures/ConfigurationResolverConfigFile/case_3/.php_cs b/tests/Fixtures/ConfigurationResolverConfigFile/case_3/.php-cs-fixer.php similarity index 100% rename from tests/Fixtures/ConfigurationResolverConfigFile/case_3/.php_cs rename to tests/Fixtures/ConfigurationResolverConfigFile/case_3/.php-cs-fixer.php diff --git a/tests/Fixtures/ConfigurationResolverConfigFile/case_4/my.php_cs b/tests/Fixtures/ConfigurationResolverConfigFile/case_4/my.php-cs-fixer.php similarity index 67% rename from tests/Fixtures/ConfigurationResolverConfigFile/case_4/my.php_cs rename to tests/Fixtures/ConfigurationResolverConfigFile/case_4/my.php-cs-fixer.php index c3160518eb9..df5d038eb5c 100644 --- a/tests/Fixtures/ConfigurationResolverConfigFile/case_4/my.php_cs +++ b/tests/Fixtures/ConfigurationResolverConfigFile/case_4/my.php-cs-fixer.php @@ -1,6 +1,6 @@ > dir\ b/file\ b.php', 'echo "echo 1;" >> dir\ b/file\ b.php', // `sed -i ...` is not handled the same on Linux and macOS - 'sed -e \'s/@Symfony/@PSR2/\' .php_cs.dist > .php_cs.dist.new', - 'mv .php_cs.dist.new .php_cs.dist', + 'sed -e \'s/@Symfony/@PSR2/\' .php-cs-fixer.dist.php > .php-cs-fixer.dist.php.new', + 'mv .php-cs-fixer.dist.php.new .php-cs-fixer.dist.php', 'git add .', 'git commit -m "Random changes including config file" -q', ], [ - '.php_cs.dist', + '.php-cs-fixer.dist.php', 'dir b/file b.php', ], [ @@ -226,12 +226,12 @@ public function provideIntegrationCases() [ 'echo "" >> dir\ b/file\ b.php', 'echo "echo 1;" >> dir\ b/file\ b.php', - 'sed -e \'s/@Symfony/@PSR2/\' .php_cs.dist > .php_cs', + 'sed -e \'s/@Symfony/@PSR2/\' .php-cs-fixer.dist.php > .php-cs-fixer.php', 'git add .', 'git commit -m "Random changes including custom config file creation" -q', ], [ - '.php_cs', + '.php-cs-fixer.php', 'dir b/file b.php', ], [