From dcfa6fd1da2adac7951f04d9c598ae8295796f4e Mon Sep 17 00:00:00 2001 From: Dariusz Ruminski Date: Fri, 16 Apr 2021 14:22:00 +0200 Subject: [PATCH] DX: config deduplication --- .php-cs-fixer.dist.php | 52 ++---------------------------------------- .php_cs.dist | 2 -- 2 files changed, 2 insertions(+), 52 deletions(-) diff --git a/.php-cs-fixer.dist.php b/.php-cs-fixer.dist.php index e33c2514d56..79ae4d5ab04 100644 --- a/.php-cs-fixer.dist.php +++ b/.php-cs-fixer.dist.php @@ -10,54 +10,6 @@ * with this source code in the file LICENSE. */ -$header = <<<'EOF' -This file is part of PHP CS Fixer. +// @TODO 3.0: make this file the only distributed config file and remove `.php_cs.dist` file. -(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; +return require ".php_cs.dist"; diff --git a/.php_cs.dist b/.php_cs.dist index d2ee632c254..e33c2514d56 100644 --- a/.php_cs.dist +++ b/.php_cs.dist @@ -10,8 +10,6 @@ * 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.