Repository navigation
Expand file tree
/
Copy pathrector.php
More file actions
61 lines (51 loc) · 2.53 KB
/
Copy pathrector.php
File metadata and controls
61 lines (51 loc) · 2.53 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
<?php
declare(strict_types=1);
use Rector\Caching\ValueObject\Storage\FileCacheStorage;
use Rector\Config\RectorConfig;
use Rector\Set\ValueObject\SetList;
$cacheDir = getenv('RECTOR_CACHE_DIR') ?: sys_get_temp_dir() . DIRECTORY_SEPARATOR . 'rector-inspector-cakephp';
return RectorConfig::configure()
->withPaths([
__DIR__ . '/config',
__DIR__ . '/src',
__DIR__ . '/tests',
])
->withCache(
cacheClass: FileCacheStorage::class,
cacheDirectory: $cacheDir,
)
->withPhpSets()
->withAttributesSets()
->withSets([
SetList::CODE_QUALITY,
SetList::CODING_STYLE,
SetList::DEAD_CODE,
SetList::EARLY_RETURN,
SetList::INSTANCEOF,
SetList::TYPE_DECLARATION,
])
->withSkip([
// Type-declaration rules that rewrite working, framework-facing code
// without behavioural benefit.
\Rector\TypeDeclaration\Rector\ClassMethod\AddVoidReturnTypeWhereNoReturnRector::class,
\Rector\TypeDeclaration\Rector\ClassMethod\ReturnTypeFromStrictFluentReturnRector::class,
\Rector\TypeDeclaration\Rector\ClassMethod\ReturnUnionTypeRector::class,
\Rector\TypeDeclaration\Rector\Closure\ClosureReturnTypeRector::class,
\Rector\TypeDeclaration\Rector\Property\TypedPropertyFromAssignsRector::class,
\Rector\TypeDeclaration\Rector\Property\TypedPropertyFromStrictConstructorRector::class,
\Rector\TypeDeclaration\Rector\Property\TypedPropertyFromStrictSetUpRector::class,
// Would add `declare(strict_types=1)` to fixtures/config files.
\Rector\TypeDeclaration\Rector\StmtsAwareInterface\SafeDeclareStrictTypesRector::class,
// Coding-style preferences that fight the framework's event/listener
// idioms and the PHPUnit fixtures.
\Rector\CodingStyle\Rector\ClassLike\NewlineBetweenClassLikeStmtsRector::class,
\Rector\CodingStyle\Rector\Stmt\NewlineAfterStatementRector::class,
\Rector\Php80\Rector\Class_\ClassPropertyAssignToConstructorPromotionRector::class,
\Rector\Php80\Rector\FuncCall\ClassOnObjectRector::class,
\Rector\Php81\Rector\Property\ReadOnlyPropertyRector::class,
// Docblock tidying that adds churn without value here.
\Rector\DeadCode\Rector\ClassMethod\RemoveUselessParamTagRector::class,
\Rector\DeadCode\Rector\ClassMethod\RemoveUselessReturnTagRector::class,
// Can change behaviour on empty/undefined values.
\Rector\DeadCode\Rector\Ternary\RemoveUselessTernaryRector::class,
]);