Skip to content

Commit 490ff77

Browse files
committed
Fix internal errors
1 parent 142a5d5 commit 490ff77

6 files changed

+6
-10
lines changed

src/Rules/Symfony/UndefinedArgumentRule.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ public function processNode(Node $node, Scope $scope): array
4949

5050
$classReflection = $scope->getClassReflection();
5151
if ($classReflection === null) {
52-
throw new ShouldNotHappenException();
52+
return [];
5353
}
5454

5555
if (!(new ObjectType('Symfony\Component\Console\Command\Command'))->isSuperTypeOf(new ObjectType($classReflection->getName()))->yes()) {

src/Rules/Symfony/UndefinedOptionRule.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ public function processNode(Node $node, Scope $scope): array
4949

5050
$classReflection = $scope->getClassReflection();
5151
if ($classReflection === null) {
52-
throw new ShouldNotHappenException();
52+
return [];
5353
}
5454

5555
if (!(new ObjectType('Symfony\Component\Console\Command\Command'))->isSuperTypeOf(new ObjectType($classReflection->getName()))->yes()) {

src/Type/Symfony/InputInterfaceGetArgumentDynamicReturnTypeExtension.php

+1-2
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77
use PHPStan\Analyser\Scope;
88
use PHPStan\Reflection\MethodReflection;
99
use PHPStan\Reflection\ParametersAcceptorSelector;
10-
use PHPStan\ShouldNotHappenException;
1110
use PHPStan\Symfony\ConsoleApplicationResolver;
1211
use PHPStan\Type\ArrayType;
1312
use PHPStan\Type\DynamicMethodReturnTypeExtension;
@@ -49,7 +48,7 @@ public function getTypeFromMethodCall(MethodReflection $methodReflection, Method
4948

5049
$classReflection = $scope->getClassReflection();
5150
if ($classReflection === null) {
52-
throw new ShouldNotHappenException();
51+
return $defaultReturnType;
5352
}
5453

5554
$argStrings = TypeUtils::getConstantStrings($scope->getType($methodCall->args[0]->value));

src/Type/Symfony/InputInterfaceGetOptionDynamicReturnTypeExtension.php

+1-2
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77
use PHPStan\Analyser\Scope;
88
use PHPStan\Reflection\MethodReflection;
99
use PHPStan\Reflection\ParametersAcceptorSelector;
10-
use PHPStan\ShouldNotHappenException;
1110
use PHPStan\Symfony\ConsoleApplicationResolver;
1211
use PHPStan\Type\ArrayType;
1312
use PHPStan\Type\BooleanType;
@@ -51,7 +50,7 @@ public function getTypeFromMethodCall(MethodReflection $methodReflection, Method
5150

5251
$classReflection = $scope->getClassReflection();
5352
if ($classReflection === null) {
54-
throw new ShouldNotHappenException();
53+
return $defaultReturnType;
5554
}
5655

5756
$optStrings = TypeUtils::getConstantStrings($scope->getType($methodCall->args[0]->value));

src/Type/Symfony/InputInterfaceHasArgumentDynamicReturnTypeExtension.php

+1-2
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66
use PhpParser\Node\Expr\MethodCall;
77
use PHPStan\Analyser\Scope;
88
use PHPStan\Reflection\MethodReflection;
9-
use PHPStan\ShouldNotHappenException;
109
use PHPStan\Symfony\ConsoleApplicationResolver;
1110
use PHPStan\Type\BooleanType;
1211
use PHPStan\Type\Constant\ConstantBooleanType;
@@ -47,7 +46,7 @@ public function getTypeFromMethodCall(MethodReflection $methodReflection, Method
4746

4847
$classReflection = $scope->getClassReflection();
4948
if ($classReflection === null) {
50-
throw new ShouldNotHappenException();
49+
return $defaultReturnType;
5150
}
5251

5352
$argStrings = TypeUtils::getConstantStrings($scope->getType($methodCall->args[0]->value));

src/Type/Symfony/InputInterfaceHasOptionDynamicReturnTypeExtension.php

+1-2
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66
use PhpParser\Node\Expr\MethodCall;
77
use PHPStan\Analyser\Scope;
88
use PHPStan\Reflection\MethodReflection;
9-
use PHPStan\ShouldNotHappenException;
109
use PHPStan\Symfony\ConsoleApplicationResolver;
1110
use PHPStan\Type\BooleanType;
1211
use PHPStan\Type\Constant\ConstantBooleanType;
@@ -47,7 +46,7 @@ public function getTypeFromMethodCall(MethodReflection $methodReflection, Method
4746

4847
$classReflection = $scope->getClassReflection();
4948
if ($classReflection === null) {
50-
throw new ShouldNotHappenException();
49+
return $defaultReturnType;
5150
}
5251

5352
$optStrings = TypeUtils::getConstantStrings($scope->getType($methodCall->args[0]->value));

0 commit comments

Comments
 (0)