Skip to content

Commit

Permalink
StrCaseFunctionsReturnTypeExtension - do not throw ShouldNotHappenExc…
Browse files Browse the repository at this point in the history
…eption, it might happen if mbstring is not enabled and the polyfill is not implemented
  • Loading branch information
ondrejmirtes committed Feb 20, 2023
1 parent e3554ad commit c015e47
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions src/Type/Php/StrCaseFunctionsReturnTypeExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
use PHPStan\Analyser\Scope;
use PHPStan\Reflection\FunctionReflection;
use PHPStan\Reflection\ParametersAcceptorSelector;
use PHPStan\ShouldNotHappenException;
use PHPStan\Type\Accessory\AccessoryNonEmptyStringType;
use PHPStan\Type\Accessory\AccessoryNonFalsyStringType;
use PHPStan\Type\Accessory\AccessoryNumericStringType;
Expand Down Expand Up @@ -61,7 +60,7 @@ public function getTypeFromFunctionCall(

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

$modes = [];
Expand Down

0 comments on commit c015e47

Please sign in to comment.