-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrector.php
More file actions
71 lines (68 loc) · 4.25 KB
/
Copy pathrector.php
File metadata and controls
71 lines (68 loc) · 4.25 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
69
70
71
<?php
declare(strict_types=1);
use Rector\CodeQuality\Rector\Class_\ConvertStaticToSelfRector;
use Rector\CodeQuality\Rector\Identical\FlipTypeControlToUseExclusiveTypeRector;
use Rector\Config\RectorConfig;
use Rector\DeadCode\Rector\ClassMethod\RemoveMixedDocblockOverruledByNativeTypeRector;
use Rector\DeadCode\Rector\ClassMethod\RemoveUselessParamTagRector;
use Rector\DeadCode\Rector\Concat\RemoveConcatAutocastRector;
use Rector\Php83\Rector\ClassConst\AddTypeToConstRector;
return RectorConfig::configure()
->withPaths([
__DIR__ . '/src',
__DIR__ . '/tests',
__DIR__ . '/tools',
__DIR__ . '/fixtures',
])
->withSkip([
// The bare directory pattern alone doesn't reliably skip the FILES inside it -- fnmatch() needs
// an exact string match, and a per-file path has a filename trailing the directory this pattern
// matches. Confirmed empirically on the sibling search-ranking package: this let
// RemoveUselessReturnTagRector reach into a regenerated *TesterActions.php file there. Both
// forms kept since which one actually matches depends on how the caller passes the path.
__DIR__ . '/tests/*/_support/_generated',
__DIR__ . '/tests/*/_support/_generated/*',
__DIR__ . '/tests/*/_output',
__DIR__ . '/tests/*/_data',
// Freshly generated each CI run for the standalone portable-tests job, gitignored, never
// committed — same reason src/Generated/ is never touched in a real Spryker project either.
__DIR__ . '/src/Generated',
__DIR__ . '/src/Generated/*',
// Checked-in, verbatim Spryker CORE generated fixture (see its own docblock) — must stay
// byte-identical to core's own generator output, never rector'd.
__DIR__ . '/tests/_ci-standalone/Generated',
__DIR__ . '/tests/_ci-standalone/Generated/*',
// Typed class constants (PHP 8.3) aren't understood by the installed phpcs 3.7.1
// (Generic.NamingConventions.UpperCaseConstantName misreads the type as the constant name).
AddTypeToConstRector::class,
// SearchStringAnalyzer casts three structurally identical `$x['name'] ?? '?'` values to
// string (tokenizer/filter/analyzer) — two feed a native `string $name` parameter, so this
// rule can't touch those; letting it strip the cast on the third (plain concatenation) would
// silently break that established three-way consistency for no readability gain.
RemoveConcatAutocastRector::class => [
__DIR__ . '/src/SprykerCommunity/Client/SearchDebug/Analyzer/SearchStringAnalyzer.php',
],
// Spryker.Commenting.DocBlockParam (active in this project's phpcs.xml) requires exactly one
// @param tag per method parameter, typed or not. This rule strips @param tags for natively
// typed params, which produced 140 "Doc Block params do not match method signature" errors
// across 58 files when tried — a direct, systemic contradiction of that convention.
RemoveUselessParamTagRector::class,
// Same DocBlockParam contradiction as above, narrower trigger: strips a single @param mixed
// when the parameter is natively typed mixed, still breaking the required 1:1 count.
RemoveMixedDocblockOverruledByNativeTypeRector::class,
// Rewrites plain `=== null` / `!== null` checks on a nullable single-class type into
// `instanceof \Fully\Qualified\ClassName` — strictly more verbose for a simple null check
// (no added type-safety over the null check it replaces), breaks this codebase's consistent
// === null idiom used everywhere else, and writes an inline FQCN instead of a use import,
// which trips Spryker.Namespaces.UseStatement.
FlipTypeControlToUseExclusiveTypeRector::class,
// Direct contradiction of Spryker's own SprykerPreferStaticOverSelf sniff (active, not
// excluded): converts static:: to self::, confirmed empirically as "Please use static::
// instead of self::" on ExplanationParser.php.
ConvertStaticToSelfRector::class,
])
// Picks up the PHP floor (>=8.3) from composer.json.
->withPhpSets()
->withDeadCodeLevel(69)
->withCodeQualityLevel(75)
->withoutParallel();