@@ -1379,7 +1379,7 @@ function return types. We want to keep the parenthesis map clean,
13791379 // Convert colons that are actually the ELSE component of an
13801380 // inline IF statement.
13811381 if (empty ($ insideInlineIf ) === false && $ newToken ['code ' ] === T_COLON ) {
1382- // Make sure this isn't the return type separator of a closure .
1382+ // Make sure this isn't a return type separator.
13831383 $ isInlineIf = true ;
13841384 for ($ i = ($ stackPtr - 1 ); $ i > 0 ; $ i --) {
13851385 if (is_array ($ tokens [$ i ]) === false
@@ -1405,12 +1405,15 @@ function return types. We want to keep the parenthesis map clean,
14051405 }
14061406
14071407 // We've found the open parenthesis, so if the previous
1408- // non-empty token is FUNCTION or USE, this is a closure.
1408+ // non-empty token is FUNCTION or USE, this is a return type.
1409+ // Note that we need to skip T_STRING tokens here as these
1410+ // can be function names.
14091411 for ($ i --; $ i > 0 ; $ i --) {
14101412 if (is_array ($ tokens [$ i ]) === false
14111413 || ($ tokens [$ i ][0 ] !== T_DOC_COMMENT
14121414 && $ tokens [$ i ][0 ] !== T_COMMENT
1413- && $ tokens [$ i ][0 ] !== T_WHITESPACE )
1415+ && $ tokens [$ i ][0 ] !== T_WHITESPACE
1416+ && $ tokens [$ i ][0 ] !== T_STRING )
14141417 ) {
14151418 break ;
14161419 }
@@ -1419,7 +1422,7 @@ function return types. We want to keep the parenthesis map clean,
14191422 if ($ tokens [$ i ][0 ] === T_FUNCTION || $ tokens [$ i ][0 ] === T_FN || $ tokens [$ i ][0 ] === T_USE ) {
14201423 $ isInlineIf = false ;
14211424 if (PHP_CODESNIFFER_VERBOSITY > 1 ) {
1422- Common::printStatusMessage ('* token is function return type, not T_INLINE_ELSE ' , 2 );
1425+ Common::printStatusMessage ('* token is return type, not T_INLINE_ELSE ' , 2 );
14231426 }
14241427 }
14251428 }//end if
0 commit comments