Skip to content

Commit a265edd

Browse files
committed
ServiceLocatorDynamicReturnTypeExtension - return object instead of mixed
1 parent 4642203 commit a265edd

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

src/Type/Nette/ServiceLocatorDynamicReturnTypeExtension.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@
77
use PHPStan\Reflection\MethodReflection;
88
use PHPStan\Type\Constant\ConstantBooleanType;
99
use PHPStan\Type\Constant\ConstantStringType;
10-
use PHPStan\Type\MixedType;
1110
use PHPStan\Type\ObjectType;
11+
use PHPStan\Type\ObjectWithoutClassType;
1212
use PHPStan\Type\Type;
1313
use PHPStan\Type\TypeCombinator;
1414

@@ -32,19 +32,19 @@ public function isMethodSupported(MethodReflection $methodReflection): bool
3232

3333
public function getTypeFromMethodCall(MethodReflection $methodReflection, MethodCall $methodCall, Scope $scope): Type
3434
{
35-
$mixedType = new MixedType();
35+
$objectType = new ObjectWithoutClassType();
3636
if (in_array($methodReflection->getName(), [
3737
'getService',
3838
'createService',
3939
], true)) {
40-
return $mixedType;
40+
return $objectType;
4141
}
4242
if (count($methodCall->args) === 0) {
43-
return $mixedType;
43+
return $objectType;
4444
}
4545
$argType = $scope->getType($methodCall->args[0]->value);
4646
if (!$argType instanceof ConstantStringType) {
47-
return $mixedType;
47+
return $objectType;
4848
}
4949

5050
$type = new ObjectType($argType->getValue());

0 commit comments

Comments
 (0)