.php-cs-fixer.php-lowest.php 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  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. if (PHP_VERSION_ID < 7_04_00 || PHP_VERSION_ID >= 7_05_00) {
  13. fwrite(STDERR, "PHP CS Fixer's config for PHP-LOWEST can be executed only on lowest supported PHP version - ~7.4.0.\n");
  14. fwrite(STDERR, "Running it on higher PHP version would falsy expect more changes, eg `mixed` type on PHP 8.\n");
  15. exit(1);
  16. }
  17. $config = require __DIR__.'/.php-cs-fixer.dist.php';
  18. $config->getFinder()->notPath([
  19. // @TODO 4.0 change interface to be fully typehinted and remove the exceptions from this list
  20. 'src/DocBlock/Annotation.php',
  21. 'src/Doctrine/Annotation/Tokens.php',
  22. 'src/Tokenizer/Tokens.php',
  23. // @TODO add `mixed` return type to `ExecutorWithoutErrorHandler::execute` when PHP 8.0+ is required and remove the exception from this list
  24. 'src/ExecutorWithoutErrorHandler.php',
  25. ]);
  26. $config->setRules([
  27. 'phpdoc_to_param_type' => true,
  28. 'phpdoc_to_return_type' => true,
  29. 'phpdoc_to_property_type' => [
  30. 'types_map' => [
  31. 'TFixerInputConfig' => 'array',
  32. 'TFixerComputedConfig' => 'array',
  33. 'TFixer' => '\PhpCsFixer\AbstractFixer',
  34. ],
  35. ],
  36. ]);
  37. return $config;