Skip to content

Commit 804b228

Browse files
committed
remove another occurence
1 parent 780b3d5 commit 804b228

File tree

1 file changed

+22
-29
lines changed

1 file changed

+22
-29
lines changed

src/Analyser/MutatingScope.php

+22-29
Original file line numberDiff line numberDiff line change
@@ -2166,19 +2166,16 @@ static function (Node $node, Scope $scope) use ($arrowScope, &$arrowFunctionImpu
21662166
return $this->getNullsafeShortCircuitingType($node->var, $nativeType);
21672167
}
21682168

2169-
$typeCallback = function () use ($node): Type {
2170-
$returnType = $this->propertyFetchType(
2171-
$this->getType($node->var),
2172-
$node->name->name,
2173-
$node,
2174-
);
2175-
if ($returnType === null) {
2176-
return new ErrorType();
2177-
}
2178-
return $returnType;
2179-
};
2169+
$returnType = $this->propertyFetchType(
2170+
$this->getType($node->var),
2171+
$node->name->name,
2172+
$node,
2173+
);
2174+
if ($returnType === null) {
2175+
$returnType = new ErrorType();
2176+
}
21802177

2181-
return $this->getNullsafeShortCircuitingType($node->var, $typeCallback());
2178+
return $this->getNullsafeShortCircuitingType($node->var, $returnType);
21822179
}
21832180

21842181
$nameType = $this->getType($node->name);
@@ -2229,25 +2226,21 @@ static function (Node $node, Scope $scope) use ($arrowScope, &$arrowFunctionImpu
22292226
return $nativeType;
22302227
}
22312228

2232-
$typeCallback = function () use ($node): Type {
2233-
if ($node->class instanceof Name) {
2234-
$staticPropertyFetchedOnType = $this->resolveTypeByName($node->class);
2235-
} else {
2236-
$staticPropertyFetchedOnType = TypeCombinator::removeNull($this->getType($node->class))->getObjectTypeOrClassStringObjectType();
2237-
}
2229+
if ($node->class instanceof Name) {
2230+
$staticPropertyFetchedOnType = $this->resolveTypeByName($node->class);
2231+
} else {
2232+
$staticPropertyFetchedOnType = TypeCombinator::removeNull($this->getType($node->class))->getObjectTypeOrClassStringObjectType();
2233+
}
22382234

2239-
$returnType = $this->propertyFetchType(
2240-
$staticPropertyFetchedOnType,
2241-
$node->name->toString(),
2242-
$node,
2243-
);
2244-
if ($returnType === null) {
2245-
return new ErrorType();
2246-
}
2247-
return $returnType;
2248-
};
2235+
$fetchType = $this->propertyFetchType(
2236+
$staticPropertyFetchedOnType,
2237+
$node->name->toString(),
2238+
$node,
2239+
);
2240+
if ($fetchType === null) {
2241+
$fetchType = new ErrorType();
2242+
}
22492243

2250-
$fetchType = $typeCallback();
22512244
if ($node->class instanceof Expr) {
22522245
return $this->getNullsafeShortCircuitingType($node->class, $fetchType);
22532246
}

0 commit comments

Comments
 (0)