Skip to content

Commit 277b59b

Browse files
phpstan-botclaude
andcommitted
Cache isObject() result in local variable to avoid redundant computation
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent e2e1a7f commit 277b59b

1 file changed

Lines changed: 3 additions & 2 deletions

File tree

src/Type/Php/SetTypeFunctionTypeSpecifyingExtension.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -77,9 +77,10 @@ public function specifyTypes(FunctionReflection $functionReflection, FuncCall $n
7777
$types[] = $valueType->toArray();
7878
break;
7979
case 'object':
80-
if ($valueType->isObject()->yes()) {
80+
$isObject = $valueType->isObject();
81+
if ($isObject->yes()) {
8182
$types[] = $valueType;
82-
} elseif ($valueType->isObject()->no()) {
83+
} elseif ($isObject->no()) {
8384
$types[] = new ObjectType(stdClass::class);
8485
} else {
8586
$types[] = TypeCombinator::union(

0 commit comments

Comments
 (0)