No Description
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

rector.php 2.5KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. <?php
  2. declare(strict_types=1);
  3. use Rector\Config\RectorConfig;
  4. use Rector\Nette\Set\NetteSetList;
  5. use Rector\Set\ValueObject\SetList;
  6. use Rector\Core\Configuration\Option;
  7. use Rector\Symfony\Set\SymfonySetList;
  8. use Rector\Doctrine\Set\DoctrineSetList;
  9. use Rector\Set\ValueObject\LevelSetList;
  10. use Rector\Symfony\Set\SensiolabsSetList;
  11. use Rector\TypeDeclaration\Rector\Property\PropertyTypeDeclarationRector;
  12. use Rector\TypeDeclaration\Rector\Property\TypedPropertyFromAssignsRector;
  13. use Rector\TypeDeclaration\Rector\ClassMethod\ReturnTypeFromReturnNewRector;
  14. use Rector\TypeDeclaration\Rector\ClassMethod\AddReturnTypeDeclarationRector;
  15. use Rector\CodeQuality\Rector\Class_\InlineConstructorDefaultToPropertyRector;
  16. use Rector\TypeDeclaration\Rector\ClassMethod\ParamTypeByMethodCallTypeRector;
  17. use Rector\TypeDeclaration\Rector\ClassMethod\ParamTypeByParentCallTypeRector;
  18. use Rector\TypeDeclaration\Rector\ClassMethod\AddVoidReturnTypeWhereNoReturnRector;
  19. use Rector\TypeDeclaration\Rector\ClassMethod\ArrayShapeFromConstantArrayReturnRector;
  20. return static function (RectorConfig $rectorConfig): void {
  21. $rectorConfig->paths([
  22. __DIR__ . '/lib'
  23. ]);
  24. $parameters = $rectorConfig->parameters();
  25. $parameters->set(
  26. Option::SYMFONY_CONTAINER_XML_PATH_PARAMETER,
  27. __DIR__ . '/var/cache/dev/App_KernelDevDebugContainer.xml'
  28. );
  29. $rectorConfig->sets([
  30. DoctrineSetList::ANNOTATIONS_TO_ATTRIBUTES,
  31. SymfonySetList::ANNOTATIONS_TO_ATTRIBUTES,
  32. NetteSetList::ANNOTATIONS_TO_ATTRIBUTES,
  33. SensiolabsSetList::FRAMEWORK_EXTRA_61,
  34. SymfonySetList::SYMFONY_60,
  35. LevelSetList::UP_TO_PHP_81
  36. ]);
  37. // register a single rule
  38. $rectorConfig->rule(InlineConstructorDefaultToPropertyRector::class);
  39. $rectorConfig->rule(AddReturnTypeDeclarationRector::class);
  40. $rectorConfig->rules([
  41. AddVoidReturnTypeWhereNoReturnRector::class,
  42. ArrayShapeFromConstantArrayReturnRector::class,
  43. ParamTypeByMethodCallTypeRector::class,
  44. ParamTypeByParentCallTypeRector::class,
  45. PropertyTypeDeclarationRector::class,
  46. ReturnTypeFromReturnNewRector::class,
  47. // ReturnTypeFromStrictBoolReturnExprRector::class,
  48. // ReturnTypeFromStrictNativeFuncCallRector::class,
  49. // ReturnTypeFromStrictNewArrayRector::class,
  50. TypedPropertyFromAssignsRector::class
  51. ]);
  52. // define sets of rules
  53. // $rectorConfig->sets([
  54. // LevelSetList::UP_TO_PHP_80
  55. // ]);
  56. };