Skip to content

Run CommandMustHaveAsCommandAttributeRule only when composer.json requires symfony/console - #380

Open
TomasVotruba wants to merge 1 commit into
mainfrom
command-ascommand-composer-guard
Open

TomasVotruba wants to merge 1 commit into
mainfrom
command-ascommand-composer-guard

Conversation

@TomasVotruba

Copy link
Copy Markdown
Member

The rule flagged every Command subclass once the #[AsCommand] attribute class was reachable through reflection, even in projects that only pull symfony/console transitively and never opted into it.

Gate the rule on a direct symfony/console entry in the analysed project composer.json (require or require-dev), read once and memoized. Projects that do not depend on the package are left alone.

Added symfony/console to require-dev so the rule own test still reports, as the package tests Symfony commands directly.

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