Skip to content

Commit 03a315e

Browse files
phpstan-botVincentLanglet
authored andcommitted
Fix CI failures [claude-ci-fix]
Automated fix attempt 1 for CI failures.
1 parent beb28b4 commit 03a315e

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

src/Type/UnionType.php

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -593,6 +593,22 @@ public function getUnresolvedMethodPrototype(string $methodName, ClassMemberAcce
593593
$prototype = $type->getUnresolvedMethodPrototype($methodName, $scope);
594594
if ($this instanceof TemplateType) {
595595
$prototype = $prototype->withCalledOnType($this);
596+
} else {
597+
$declaringClassType = new ObjectType($prototype->getNakedMethod()->getDeclaringClass()->getName());
598+
$typesForCalledOn = [];
599+
foreach ($this->types as $innerType) {
600+
if (!$innerType->hasMethod($methodName)->yes()) {
601+
continue;
602+
}
603+
if (!$declaringClassType->isSuperTypeOf($innerType)->yes()) {
604+
continue;
605+
}
606+
607+
$typesForCalledOn[] = $innerType;
608+
}
609+
if (count($typesForCalledOn) > 1) {
610+
$prototype = $prototype->withCalledOnType(TypeCombinator::union(...$typesForCalledOn));
611+
}
596612
}
597613
$methodPrototypes[] = $prototype;
598614
}

0 commit comments

Comments
 (0)