Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 3 additions & 11 deletions build/PHPStan/Build/ContainerDynamicReturnTypeExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,22 +30,14 @@ public function isMethodSupported(MethodReflection $methodReflection): bool
], true);
}

public function getTypeFromMethodCall(MethodReflection $methodReflection, MethodCall $methodCall, Scope $scope): Type
public function getTypeFromMethodCall(MethodReflection $methodReflection, MethodCall $methodCall, Scope $scope): ?Type
{
if (count($methodCall->getArgs()) === 0) {
return ParametersAcceptorSelector::selectFromArgs(
$scope,
$methodCall->getArgs(),
$methodReflection->getVariants(),
)->getReturnType();
return null;
}
$argType = $scope->getType($methodCall->getArgs()[0]->value);
if (!$argType instanceof ConstantStringType) {
return ParametersAcceptorSelector::selectFromArgs(
$scope,
$methodCall->getArgs(),
$methodReflection->getVariants(),
)->getReturnType();
return null;
}

$type = new ObjectType($argType->getValue());
Expand Down
Loading