Skip to content

Commit 1dfe119

Browse files
Add classname check
1 parent aac8356 commit 1dfe119

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

src/Type/Symfony/InputInterfaceGetArgumentDynamicReturnTypeExtension.php

+6-1
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
use PHPStan\Type\TypeCombinator;
1717
use PHPStan\Type\TypeUtils;
1818
use function count;
19+
use function in_array;
1920

2021
final class InputInterfaceGetArgumentDynamicReturnTypeExtension implements DynamicMethodReturnTypeExtension
2122
{
@@ -78,7 +79,11 @@ public function getTypeFromMethodCall(MethodReflection $methodReflection, Method
7879
}
7980

8081
$method = $scope->getFunction();
81-
if ($method instanceof MethodReflection && $method->getName() === 'interact') {
82+
if (
83+
$method instanceof MethodReflection
84+
&& $method->getName() === 'interact'
85+
&& in_array('Symfony\Component\Console\Command\Command', $method->getDeclaringClass()->getParentClassesNames(), true)
86+
) {
8287
$argTypes[] = new NullType();
8388
}
8489

0 commit comments

Comments
 (0)