fix return dim array fetch

This commit is contained in:
TomasVotruba 2020-02-29 01:12:08 +01:00
parent c025d4c33d
commit 4c35675cca
2 changed files with 4 additions and 2 deletions

View File

@ -344,14 +344,15 @@ final class NodeTypeResolver
return $node instanceof Expr && $this->arrayTypeAnalyzer->isArrayType($node);
}
private function resolveArrayType(Expr $expr): ArrayType
private function resolveArrayType(Expr $expr): Type
{
/** @var Scope|null $scope */
$scope = $expr->getAttribute(AttributeKey::SCOPE);
if ($scope instanceof Scope) {
$arrayType = $scope->getType($expr);
if ($arrayType instanceof ArrayType) {
if ($arrayType !== null) {
return $arrayType;
}
}

View File

@ -35,6 +35,7 @@ final class ReturnedNodesReturnTypeInferer extends AbstractTypeInferer implement
}
$localReturnNodes = $this->collectReturns($functionLike);
if ($localReturnNodes === []) {
// void type
if ($functionLike instanceof ClassMethod && ! $functionLike->isAbstract()) {