@@ -1574,7 +1574,7 @@ function return types. We want to keep the parenthesis map clean,
15741574 // Convert colons that are actually the ELSE component of an
15751575 // inline IF statement.
15761576 if (empty ($ insideInlineIf ) === false && $ newToken ['code ' ] === T_COLON ) {
1577- // Make sure this isn't the return type separator of a closure .
1577+ // Make sure this isn't a return type separator.
15781578 $ isInlineIf = true ;
15791579 for ($ i = ($ stackPtr - 1 ); $ i > 0 ; $ i --) {
15801580 if (is_array ($ tokens [$ i ]) === false
@@ -1600,12 +1600,15 @@ function return types. We want to keep the parenthesis map clean,
16001600 }
16011601
16021602 // We've found the open parenthesis, so if the previous
1603- // non-empty token is FUNCTION or USE, this is a closure.
1603+ // non-empty token is FUNCTION or USE, this is a return type.
1604+ // Note that we need to skip T_STRING tokens here as these
1605+ // can be function names.
16041606 for ($ i --; $ i > 0 ; $ i --) {
16051607 if (is_array ($ tokens [$ i ]) === false
16061608 || ($ tokens [$ i ][0 ] !== T_DOC_COMMENT
16071609 && $ tokens [$ i ][0 ] !== T_COMMENT
1608- && $ tokens [$ i ][0 ] !== T_WHITESPACE )
1610+ && $ tokens [$ i ][0 ] !== T_WHITESPACE
1611+ && $ tokens [$ i ][0 ] !== T_STRING )
16091612 ) {
16101613 break ;
16111614 }
@@ -1614,7 +1617,7 @@ function return types. We want to keep the parenthesis map clean,
16141617 if ($ tokens [$ i ][0 ] === T_FUNCTION || $ tokens [$ i ][0 ] === T_FN || $ tokens [$ i ][0 ] === T_USE ) {
16151618 $ isInlineIf = false ;
16161619 if (PHP_CODESNIFFER_VERBOSITY > 1 ) {
1617- echo "\t\t* token is function return type, not T_INLINE_ELSE " .PHP_EOL ;
1620+ echo "\t\t* token is return type, not T_INLINE_ELSE " .PHP_EOL ;
16181621 }
16191622 }
16201623 }//end if
0 commit comments