@@ -2603,7 +2603,8 @@ static function (): void {
2603
2603
2604
2604
if ($ parametersAcceptor !== null ) {
2605
2605
$ expr = ArgumentsNormalizer::reorderFuncArguments ($ parametersAcceptor , $ expr ) ?? $ expr ;
2606
- $ isAlwaysTerminating = $ parametersAcceptor ->getReturnType () instanceof NeverType;
2606
+ $ returnType = $ parametersAcceptor ->getReturnType ();
2607
+ $ isAlwaysTerminating = $ returnType instanceof NeverType && $ returnType ->isExplicit ();
2607
2608
}
2608
2609
$ result = $ this ->processArgs ($ stmt , $ functionReflection , null , $ parametersAcceptor , $ expr , $ scope , $ nodeCallback , $ context );
2609
2610
$ scope = $ result ->getScope ();
@@ -2860,7 +2861,8 @@ static function (): void {
2860
2861
2861
2862
if ($ parametersAcceptor !== null ) {
2862
2863
$ expr = ArgumentsNormalizer::reorderMethodArguments ($ parametersAcceptor , $ expr ) ?? $ expr ;
2863
- $ isAlwaysTerminating = $ parametersAcceptor ->getReturnType () instanceof NeverType;
2864
+ $ returnType = $ parametersAcceptor ->getReturnType ();
2865
+ $ isAlwaysTerminating = $ returnType instanceof NeverType && $ returnType ->isExplicit ();
2864
2866
}
2865
2867
2866
2868
$ result = $ this ->processArgs (
@@ -3047,7 +3049,8 @@ static function (): void {
3047
3049
3048
3050
if ($ parametersAcceptor !== null ) {
3049
3051
$ expr = ArgumentsNormalizer::reorderStaticCallArguments ($ parametersAcceptor , $ expr ) ?? $ expr ;
3050
- $ isAlwaysTerminating = $ parametersAcceptor ->getReturnType () instanceof NeverType;
3052
+ $ returnType = $ parametersAcceptor ->getReturnType ();
3053
+ $ isAlwaysTerminating = $ returnType instanceof NeverType && $ returnType ->isExplicit ();
3051
3054
}
3052
3055
$ result = $ this ->processArgs ($ stmt , $ methodReflection , null , $ parametersAcceptor , $ expr , $ scope , $ nodeCallback , $ context , $ closureBindScope ?? null );
3053
3056
$ scope = $ result ->getScope ();
0 commit comments