.php_cs.dist 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. <?php
  2. $header = <<<'EOF'
  3. This file is part of PHP CS Fixer.
  4. (c) Fabien Potencier <fabien@symfony.com>
  5. Dariusz Rumiński <dariusz.ruminski@gmail.com>
  6. This source file is subject to the MIT license that is bundled
  7. with this source code in the file LICENSE.
  8. EOF;
  9. $finder = PhpCsFixer\Finder::create()
  10. ->exclude('tests/Fixtures')
  11. ->in(__DIR__)
  12. ->append([
  13. __DIR__.'/dev-tools/doc.php',
  14. __DIR__.'/php-cs-fixer',
  15. ])
  16. ;
  17. $config = new PhpCsFixer\Config();
  18. $config
  19. ->setRiskyAllowed(true)
  20. ->setRules([
  21. '@PHP56Migration' => true,
  22. '@PHPUnit75Migration:risky' => true,
  23. '@PhpCsFixer' => true,
  24. '@PhpCsFixer:risky' => true,
  25. 'header_comment' => ['header' => $header],
  26. 'list_syntax' => ['syntax' => 'long'],
  27. ])
  28. ->setFinder($finder)
  29. ;
  30. // special handling of fabbot.io service if it's using too old PHP CS Fixer version
  31. if (false !== getenv('FABBOT_IO')) {
  32. try {
  33. PhpCsFixer\FixerFactory::create()
  34. ->registerBuiltInFixers()
  35. ->registerCustomFixers($config->getCustomFixers())
  36. ->useRuleSet(new PhpCsFixer\RuleSet($config->getRules()));
  37. } catch (PhpCsFixer\ConfigurationException\InvalidConfigurationException $e) {
  38. $config->setRules([]);
  39. } catch (UnexpectedValueException $e) {
  40. $config->setRules([]);
  41. } catch (InvalidArgumentException $e) {
  42. $config->setRules([]);
  43. }
  44. }
  45. return $config;