-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrector.php
More file actions
62 lines (54 loc) · 1.86 KB
/
Copy pathrector.php
File metadata and controls
62 lines (54 loc) · 1.86 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
<?php
declare(strict_types=1);
use Rector\Config\RectorConfig;
use Rector\ValueObject\PhpVersion;
return RectorConfig::configure()
// Set the working directory paths
->withPaths(
array(
__DIR__ . '/src',
)
)
// Target PHP 8.2 for language features and compatibility
->withPhpVersion(PhpVersion::PHP_82)
// Enable PHP 8.2 features
->withPhpSets(php82: true)
// Auto-import names (add 'use' statements)
->withImportNames(removeUnusedImports: true)
// Use the modern "Prepared Sets"
->withPreparedSets(
deadCode: true,
codeQuality: true,
codingStyle: true,
typeDeclarations: true,
// Keep false for WP. Prevents removing 'public' from hook callbacks.
privatization: false,
earlyReturn: true,
instanceOf: true,
// CAUTION: Set to false if you want to keep empty() checks.
// Set to true if you want strict comparisons (===).
strictBooleans: false
)
// Skip paths and specific rules incompatible with WordPress VIP standards
->withSkip(
array(
'*/vendor/*',
'*/tests/*',
'*/node_modules/*',
'*/wordpress-installer/*',
'*/wp-admin/*',
'*/wp-content/*',
// TEMPLATES: Skip all template files to preserve PSR-12 braces
'*/templates/*',
// VIP Standards: Skip incompatible transformations
\Rector\Php80\Rector\Class_\ClassPropertyAssignToConstructorPromotionRector::class,
\Rector\Php81\Rector\Property\ReadOnlyPropertyRector::class,
\Rector\CodeQuality\Rector\Class_\InlineConstructorDefaultToPropertyRector::class,
// BRACE PRESERVATION: Skip rules that modify control structures
\Rector\CodingStyle\Rector\If_\NullableCompareToNullRector::class,
\Rector\CodeQuality\Rector\If_\SimplifyIfReturnBoolRector::class,
\Rector\CodeQuality\Rector\If_\ExplicitBoolCompareRector::class,
// African Performance: Keep explicit error handling
\Rector\DeadCode\Rector\If_\RemoveDeadInstanceOfRector::class,
)
);