Skip to content

Commit b4a1a17

Browse files
committed
unify logic
1 parent 41e355c commit b4a1a17

File tree

1 file changed

+11
-16
lines changed

1 file changed

+11
-16
lines changed

rules/AnnotationsToAttributes/Rector/Class_/CoversAnnotationWithValueToAttributeRector.php

Lines changed: 11 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -280,25 +280,20 @@ private function resolveMethodAttributes(ClassMethod $classMethod, ?string $cove
280280
}
281281

282282
$covers = $desiredTagValueNode->value->value;
283-
if (str_starts_with($covers, '\\') || (! $hasCoversDefault && str_starts_with($covers, '::'))) {
284-
$attributeGroup = $this->createAttributeGroup($covers);
285-
286-
// phpunit 10 may not fully support attribute
287-
if (! $attributeGroup instanceof AttributeGroup) {
288-
continue;
289-
}
290-
291-
$attributeGroups[$covers] = $attributeGroup;
292-
} elseif ($hasCoversDefault && str_starts_with($covers, '::')) {
293-
$attributeGroup = $this->createAttributeGroup($coversDefaultClass . $covers);
283+
if (! str_starts_with($covers, '\\') && ! str_starts_with($covers, '::')) {
284+
continue;
285+
}
294286

295-
// phpunit 10 may not fully support attribute
296-
if (! $attributeGroup instanceof AttributeGroup) {
297-
continue;
298-
}
287+
if ($hasCoversDefault && str_starts_with($covers, '::')) {
288+
$covers = $coversDefaultClass . $covers;
289+
}
299290

300-
$attributeGroups[$covers] = $attributeGroup;
291+
$attributeGroup = $this->createAttributeGroup($covers);
292+
if (! $attributeGroup instanceof AttributeGroup) {
293+
continue;
301294
}
295+
296+
$attributeGroups[$covers] = $attributeGroup;
302297
}
303298

304299
return $attributeGroups;

0 commit comments

Comments
 (0)