Skip to content

Skip attribute rules when framework class is missing + fix Rector skip path - #286

Merged
TomasVotruba merged 1 commit into
mainfrom
tv/attribute-rules-existence-guard
Sep 21, 2026
Merged

TomasVotruba merged 1 commit into
mainfrom
tv/attribute-rules-existence-guard

Conversation

@TomasVotruba

Copy link
Copy Markdown
Member

Two small follow-ups to #285.

Do not require an attribute the project does not have

CommandMustHaveAsCommandAttributeRule and ConstraintMustHaveAttributeRule now bail out early when the attribute/base class (AsCommand, Constraint) is not present in the analysed project. No false positive in a project that does not ship that Symfony component.

Fix Rector skip path

rector.php skipped StringClassNameToClassConstantRector for src/Enum, but the SymfonyAttribute value holder lives in src/Rules/Enum. The path mismatch let Rector rewrite the intentional class-name strings to ::class, which then broke on those classes not being loadable - that is what turned the Rector job red on main. Added src/Rules/Enum to the skip list.

Green locally: ECS, PHPStan, Rector, tests.

@TomasVotruba
TomasVotruba merged commit 03ccc3a into main Sep 21, 2026
8 checks passed
@TomasVotruba
TomasVotruba deleted the tv/attribute-rules-existence-guard branch September 21, 2026 08:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant