Skip to content

Commit 4b2854d

Browse files
committed
Make Scope::canAnyVariableExist() part of the interface
1 parent 27481c3 commit 4b2854d

3 files changed

Lines changed: 4 additions & 2 deletions

File tree

src/Analyser/MutatingScope.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -351,7 +351,7 @@ private function getVariableTypes(): array
351351
return $this->variableTypes;
352352
}
353353

354-
private function canAnyVariableExist(): bool
354+
public function canAnyVariableExist(): bool
355355
{
356356
return ($this->function === null && !$this->isInAnonymousFunction()) || $this->afterExtractCall;
357357
}

src/Analyser/NodeScopeResolver.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2745,7 +2745,7 @@ private function processStmtVarAnnotation(MutatingScope $scope, Node\Stmt $stmt,
27452745
continue;
27462746
}
27472747

2748-
if ($scope->getFunction() === null && !$scope->isInAnonymousFunction()) {
2748+
if ($scope->canAnyVariableExist()) {
27492749
$certainty = TrinaryLogic::createYes();
27502750
}
27512751

src/Analyser/Scope.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,8 @@ public function hasVariableType(string $variableName): TrinaryLogic;
3939

4040
public function getVariableType(string $variableName): Type;
4141

42+
public function canAnyVariableExist(): bool;
43+
4244
/**
4345
* @return array<int, string>
4446
*/

0 commit comments

Comments
 (0)