From b45be67b77df49644edae401e16a179f4010ce72 Mon Sep 17 00:00:00 2001 From: Dariusz Ruminski Date: Tue, 3 Aug 2021 22:17:39 +0200 Subject: [PATCH] DX: drop v2 compatible config in project itself --- .php-cs-fixer.dist.php | 55 +++++++++++++++++++++++++++++++++-- .php_cs.dist | 66 ------------------------------------------ 2 files changed, 53 insertions(+), 68 deletions(-) delete mode 100644 .php_cs.dist diff --git a/.php-cs-fixer.dist.php b/.php-cs-fixer.dist.php index 436c43de045..fc57b70cefe 100644 --- a/.php-cs-fixer.dist.php +++ b/.php-cs-fixer.dist.php @@ -1,5 +1,7 @@ + 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', disabled, as we want to be able to run bootstrap file even on lower PHP version, to show nice message + __FILE__, + ]) +; + +$config = new PhpCsFixer\Config(); +$config + ->setRiskyAllowed(true) + ->setRules([ + '@PHP71Migration:risky' => true, + '@PHPUnit75Migration:risky' => true, + '@PhpCsFixer' => true, + '@PhpCsFixer:risky' => true, + 'general_phpdoc_annotation_remove' => ['annotations' => ['expectedDeprecation']], + 'header_comment' => ['header' => $header], + ]) + ->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 require '.php_cs.dist'; +return $config; diff --git a/.php_cs.dist b/.php_cs.dist deleted file mode 100644 index fc57b70cefe..00000000000 --- a/.php_cs.dist +++ /dev/null @@ -1,66 +0,0 @@ - - * 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', disabled, as we want to be able to run bootstrap file even on lower PHP version, to show nice message - __FILE__, - ]) -; - -$config = new PhpCsFixer\Config(); -$config - ->setRiskyAllowed(true) - ->setRules([ - '@PHP71Migration:risky' => true, - '@PHPUnit75Migration:risky' => true, - '@PhpCsFixer' => true, - '@PhpCsFixer:risky' => true, - 'general_phpdoc_annotation_remove' => ['annotations' => ['expectedDeprecation']], - 'header_comment' => ['header' => $header], - ]) - ->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;