@@ -65,6 +65,9 @@ final class PassedParameters
6565 * a short array opener.
6666 * - If passed a `T_ISSET` or `T_UNSET` stack pointer, it will detect whether those
6767 * language constructs have "parameters".
68+ * - If passed a `T_EXIT` stack pointer, it will treat it as a function call and detect whether
69+ * it has been passed parameters. When the `T_EXIT` is used as a constant, the return value
70+ * will be `false` (no parameters).
6871 *
6972 * @since 1.0.0
7073 *
@@ -94,7 +97,7 @@ public static function hasParameters(File $phpcsFile, $stackPtr, $isShortArray =
9497 throw OutOfBoundsStackPtr::create (2 , '$stackPtr ' , $ stackPtr );
9598 }
9699
97- $ acceptedTokens = 'function call, array, isset or unset ' ;
100+ $ acceptedTokens = 'function call, array, isset, unset or exit ' ;
98101 if (isset (Collections::parameterPassingTokens ()[$ tokens [$ stackPtr ]['code ' ]]) === false ) {
99102 throw UnexpectedTokenType::create (2 , '$stackPtr ' , $ acceptedTokens , $ tokens [$ stackPtr ]['type ' ]);
100103 }
@@ -131,7 +134,7 @@ public static function hasParameters(File $phpcsFile, $stackPtr, $isShortArray =
131134 return true ;
132135 }
133136
134- // Deal with function calls, long arrays, isset and unset .
137+ // Deal with function calls, long arrays, isset, unset and exit/die .
135138 // Next non-empty token should be the open parenthesis.
136139 if ($ tokens [$ next ]['code ' ] !== \T_OPEN_PARENTHESIS ) {
137140 return false ;
0 commit comments