Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions src/Rules/Symfony/CommandMustHaveAsCommandAttributeRule.php
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,11 @@ public function processNode(Node $node, Scope $scope): array
return [];
}

// do not require an attribute the project does not even have
if (! $this->reflectionProvider->hasClass(SymfonyAttribute::AS_COMMAND)) {
return [];
}

// symfony/console must be a direct production dependency, require-dev is skipped
if (! $this->composerRequireResolver->hasRequiredPackage(self::SYMFONY_CONSOLE_PACKAGE)) {
return [];
Expand All @@ -95,11 +100,6 @@ public function processNode(Node $node, Scope $scope): array
return [];
}

// do not require an attribute the project does not even have
if (! $this->reflectionProvider->hasClass(SymfonyAttribute::AS_COMMAND)) {
return [];
}

foreach ($node->attrGroups as $attrGroup) {
foreach ($attrGroup->attrs as $attr) {
if ($attr->name->toString() === SymfonyAttribute::AS_COMMAND) {
Expand Down
Loading