Skip to content

Commit

Permalink
Update src/Infer/Scope/Scope.php
Browse files Browse the repository at this point in the history
Co-authored-by: romalytvynenko <[email protected]>
  • Loading branch information
WildEgo and romalytvynenko authored May 23, 2024
1 parent ddc97fb commit e5bf188
Showing 1 changed file with 5 additions and 8 deletions.
13 changes: 5 additions & 8 deletions src/Infer/Scope/Scope.php
Original file line number Diff line number Diff line change
Expand Up @@ -61,14 +61,11 @@ public function getType(Node $node): Type
}

if ($node instanceof Node\Expr\Match_) {
return match (get_class($node->cond)) {
Node\Expr\ArrayDimFetch::class, Node\Expr\Variable::class => Union::wrap(
collect($node->arms)
->map(fn (Node\MatchArm $arm) => $this->getType($arm->body))
->toArray()
),
default => new UnknownType('Cannot infer type of property fetch: not supported yet.'),
};
return Union::wrap(
collect($node->arms)
->map(fn (Node\MatchArm $arm) => $this->getType($arm->body))
->toArray()
);
}

if ($node instanceof Node\Expr\ClassConstFetch) {
Expand Down

0 comments on commit e5bf188

Please sign in to comment.