Skip to content

Commit a0c7ed7

Browse files
phpstan-botclaude
authored andcommitted
Use early exit in resolveReflectionAttributeType to reduce nesting
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent 1b42b47 commit a0c7ed7

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

src/Type/Php/ReflectionGetAttributesMethodReturnTypeExtension.php

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,9 +57,11 @@ private function resolveReflectionAttributeType(MethodReflection $methodReflecti
5757

5858
$valueTypes = [];
5959
foreach ($returnType->getIterableValueType()->getObjectClassNames() as $className) {
60-
if ($nativeReflectionAttributeType->isSuperTypeOf(new ObjectType($className))->yes()) {
61-
$valueTypes[] = new GenericObjectType($className, [$classType]);
60+
if (!$nativeReflectionAttributeType->isSuperTypeOf(new ObjectType($className))->yes()) {
61+
continue;
6262
}
63+
64+
$valueTypes[] = new GenericObjectType($className, [$classType]);
6365
}
6466

6567
if (count($valueTypes) === 0) {

0 commit comments

Comments
 (0)