Skip to content

Commit

Permalink
misc (#2678)
Browse files Browse the repository at this point in the history
  • Loading branch information
TomasVotruba committed Jul 19, 2022
1 parent 0ffaaca commit c474c67
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 5 deletions.
7 changes: 3 additions & 4 deletions packages/NodeNestingScope/ContextAnalyzer.php
Expand Up @@ -72,15 +72,14 @@ public function isInIf(Node $node): bool
return $previousNode instanceof If_;
}

public function isHasAssignWithIndirectReturn(Node $node, If_ $if): bool
public function hasAssignWithIndirectReturn(Node $node, If_ $if): bool
{
foreach (ControlStructure::LOOP_NODES as $loopNode) {
$loopObjectType = new ObjectType($loopNode);
$parentType = $this->nodeTypeResolver->getType($node);
$superType = $parentType->isSuperTypeOf($loopObjectType);
$isLoopType = $superType->yes();

if (! $isLoopType) {
$superType = $parentType->isSuperTypeOf($loopObjectType);
if (! $superType->yes()) {
continue;
}

Expand Down
Expand Up @@ -282,6 +282,6 @@ private function isLastIfOrBeforeLastReturn(If_ $if, ?Stmt $nextStmt): bool
return $this->isLastIfOrBeforeLastReturn($parent, $nextStmt);
}

return ! $this->contextAnalyzer->isHasAssignWithIndirectReturn($parent, $if);
return ! $this->contextAnalyzer->hasAssignWithIndirectReturn($parent, $if);
}
}

0 comments on commit c474c67

Please sign in to comment.