-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrector.php
More file actions
69 lines (55 loc) · 3.09 KB
/
rector.php
File metadata and controls
69 lines (55 loc) · 3.09 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
<?php
declare(strict_types=1);
use Rector\CodeQuality\Rector\Class_\InlineConstructorDefaultToPropertyRector;
use Rector\Config\RectorConfig;
use Rector\Doctrine\Set\DoctrineSetList;
use Rector\Symfony\Set\SymfonySetList;
use Rector\Symfony\Set\SensiolabsSetList;
use Rector\Set\ValueObject\LevelSetList;
use Rector\CodeQuality\Rector\ClassMethod\ReturnTypeFromStrictScalarReturnExprRector;
use Rector\TypeDeclaration\Rector\ClassMethod\ReturnTypeFromStrictBoolReturnExprRector;
use Rector\TypeDeclaration\Rector\ClassMethod\ReturnTypeFromStrictNewArrayRector;
use Rector\TypeDeclaration\Rector\ClassMethod\AddReturnTypeDeclarationRector;
use Rector\Symfony\Rector\MethodCall\GetHelperControllerToServiceRector;
return static function (RectorConfig $rectorConfig): void {
$rectorConfig->paths([
// __DIR__ . '/src/EventListener',
// __DIR__ . '/src/EventSubscriber',
__DIR__ . '/src',
]);
$rectorConfig->rules([
\Rector\Symfony\Symfony61\Rector\Class_\CommandPropertyToAttributeRector::class,
// ReturnTypeFromStrictBoolReturnExprRector::class,
ReturnTypeFromStrictNewArrayRector::class,
// ReturnTypeFromStrictScalarReturnExprRector::class,
AddReturnTypeDeclarationRector::class,
// GetHelperControllerToServiceRector::class
]);
// register a single rule
$rectorConfig->ruleWithConfiguration(
\Rector\Php80\Rector\Class_\AnnotationToAttributeRector::class,
[
new \Rector\Php80\ValueObject\AnnotationToAttribute('ApiPlatform\Core\Annotation\ApiFilter'),
new \Rector\Php80\ValueObject\AnnotationToAttribute('ApiPlatform\Core\Annotation\ApiResource'),
new \Rector\Php80\ValueObject\AnnotationToAttribute('ApiPlatform\Core\Annotation\ApiProperty'),
new \Rector\Php80\ValueObject\AnnotationToAttribute('ApiPlatform\Core\Annotation\ApiSubresource'),
new \Rector\Php80\ValueObject\AnnotationToAttribute('Gedmo\Mapping\Annotation\Tree'),
new \Rector\Php80\ValueObject\AnnotationToAttribute('Gedmo\Mapping\Annotation\TreeRoot'),
new \Rector\Php80\ValueObject\AnnotationToAttribute('Gedmo\Mapping\Annotation\TreeParent'),
new \Rector\Php80\ValueObject\AnnotationToAttribute('Gedmo\Mapping\Annotation\TreeLeft'),
new \Rector\Php80\ValueObject\AnnotationToAttribute('Gedmo\Mapping\Annotation\TreeLevel'),
new \Rector\Php80\ValueObject\AnnotationToAttribute('Gedmo\Mapping\Annotation\TreeRight'),
new \Rector\Php80\ValueObject\AnnotationToAttribute('Gedmo\Locale'),
new \Rector\Php80\ValueObject\AnnotationToAttribute('Gedmo\Mapping\Annotation\Timestampable'),
new \Rector\Php80\ValueObject\AnnotationToAttribute('Gedmo\Mapping\Annotation\Slug'),
]
);
// $rectorConfig->withAs(symfony: true)
// $rectorConfig->rule(InlineConstructorDefaultToPropertyRector::class);
$rectorConfig->sets([
LevelSetList::UP_TO_PHP_83,
DoctrineSetList::ANNOTATIONS_TO_ATTRIBUTES,
SymfonySetList::SYMFONY_64,
SymfonySetList::ANNOTATIONS_TO_ATTRIBUTES,
]);
};