Skip to content

Commit c015e47

Browse files
committed
StrCaseFunctionsReturnTypeExtension - do not throw ShouldNotHappenException, it might happen if mbstring is not enabled and the polyfill is not implemented
1 parent e3554ad commit c015e47

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

src/Type/Php/StrCaseFunctionsReturnTypeExtension.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66
use PHPStan\Analyser\Scope;
77
use PHPStan\Reflection\FunctionReflection;
88
use PHPStan\Reflection\ParametersAcceptorSelector;
9-
use PHPStan\ShouldNotHappenException;
109
use PHPStan\Type\Accessory\AccessoryNonEmptyStringType;
1110
use PHPStan\Type\Accessory\AccessoryNonFalsyStringType;
1211
use PHPStan\Type\Accessory\AccessoryNumericStringType;
@@ -61,7 +60,7 @@ public function getTypeFromFunctionCall(
6160

6261
$argType = $scope->getType($args[0]->value);
6362
if (!is_callable($fnName)) {
64-
throw new ShouldNotHappenException();
63+
return ParametersAcceptorSelector::selectSingle($functionReflection->getVariants())->getReturnType();
6564
}
6665

6766
$modes = [];

0 commit comments

Comments
 (0)