.php-cs-fixer.dist.php 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. <?php
  2. declare(strict_types=1);
  3. /*
  4. * This file is part of PHP CS Fixer.
  5. *
  6. * (c) Fabien Potencier <fabien@symfony.com>
  7. * Dariusz Rumiński <dariusz.ruminski@gmail.com>
  8. *
  9. * This source file is subject to the MIT license that is bundled
  10. * with this source code in the file LICENSE.
  11. */
  12. use PhpCsFixer\Config;
  13. use PhpCsFixer\Finder;
  14. use PhpCsFixer\Fixer\Internal\ConfigurableFixerTemplateFixer;
  15. use PhpCsFixer\Runner\Parallel\ParallelConfigFactory;
  16. return (new Config())
  17. ->setParallelConfig(ParallelConfigFactory::detect()) // @TODO 4.0 no need to call this manually
  18. ->setRiskyAllowed(true)
  19. ->registerCustomFixers([
  20. new ConfigurableFixerTemplateFixer(),
  21. ])
  22. ->setRules([
  23. '@PHP74Migration' => true,
  24. '@PHP74Migration:risky' => true,
  25. '@PHPUnit100Migration:risky' => true,
  26. '@PhpCsFixer' => true,
  27. '@PhpCsFixer:risky' => true,
  28. 'PhpCsFixerInternal/configurable_fixer_template' => true, // internal rules, shall not be used outside of main repo
  29. 'general_phpdoc_annotation_remove' => ['annotations' => ['expectedDeprecation']], // one should use PHPUnit built-in method instead
  30. 'header_comment' => ['header' => <<<'EOF'
  31. This file is part of PHP CS Fixer.
  32. (c) Fabien Potencier <fabien@symfony.com>
  33. Dariusz Rumiński <dariusz.ruminski@gmail.com>
  34. This source file is subject to the MIT license that is bundled
  35. with this source code in the file LICENSE.
  36. EOF],
  37. 'modernize_strpos' => true, // needs PHP 8+ or polyfill
  38. 'no_useless_concat_operator' => false, // TODO switch back on when the `src/Console/Application.php` no longer needs the concat
  39. 'numeric_literal_separator' => true,
  40. ])
  41. ->setFinder(
  42. (new Finder())
  43. ->ignoreDotFiles(false)
  44. ->ignoreVCSIgnored(true)
  45. ->exclude(['dev-tools/phpstan', 'tests/Fixtures'])
  46. ->in(__DIR__)
  47. ->append([__DIR__.'/php-cs-fixer'])
  48. )
  49. ;