* Dariusz RumiƄski * * This source file is subject to the MIT license that is bundled * with this source code in the file LICENSE. */ $finder = PhpCsFixer\Finder::create() ->ignoreDotFiles(false) ->ignoreVCSIgnored(true) ->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 ]) ; $config = new PhpCsFixer\Config(); $config ->setRiskyAllowed(true) ->setRules([ '@PHP71Migration' => false, '@PHP71Migration:risky' => false, '@PHPUnit75Migration:risky' => true, '@PhpCsFixer' => true, '@PhpCsFixer:risky' => true, 'general_phpdoc_annotation_remove' => ['annotations' => ['expectedDeprecation']], // one should use PHPUnit built-in method instead 'modernize_strpos' => false, // needs PHP 8+ or polyfill ]) ->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;