.php_cs.dist 1.4 KB

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