.php_cs.dist 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  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 = PhpCsFixer\Config::create()
  18. ->setRiskyAllowed(true)
  19. ->setRules([
  20. '@PHP56Migration' => true,
  21. '@PHPUnit75Migration:risky' => true,
  22. '@PhpCsFixer' => true,
  23. '@PhpCsFixer:risky' => true,
  24. 'header_comment' => ['header' => $header],
  25. 'list_syntax' => ['syntax' => 'long'],
  26. ])
  27. ->setFinder($finder)
  28. ;
  29. // special handling of fabbot.io service if it's using too old PHP CS Fixer version
  30. if (false !== getenv('FABBOT_IO')) {
  31. try {
  32. PhpCsFixer\FixerFactory::create()
  33. ->registerBuiltInFixers()
  34. ->registerCustomFixers($config->getCustomFixers())
  35. ->useRuleSet(new PhpCsFixer\RuleSet($config->getRules()));
  36. } catch (PhpCsFixer\ConfigurationException\InvalidConfigurationException $e) {
  37. $config->setRules([]);
  38. } catch (UnexpectedValueException $e) {
  39. $config->setRules([]);
  40. } catch (InvalidArgumentException $e) {
  41. $config->setRules([]);
  42. }
  43. }
  44. return $config;