@@ -216,41 +216,35 @@ public function process_token( $stackPtr ) {
216216
217217 case \T_THROW :
218218 // Find the open parentheses, while stepping over the exception creation tokens.
219- $ ignore = Tokens::$ emptyTokens ;
220- $ ignore += Collections::namespacedNameTokens ();
221- $ ignore += Collections::functionCallTokens ();
222- $ ignore += Collections::objectOperators ();
223- $ ignore [ T_READONLY ] = T_READONLY ;
224-
225- $ next_relevant = $ this ->phpcsFile ->findNext ( $ ignore , ( $ stackPtr + 1 ), null , true );
226- if ( false === $ next_relevant ) {
227- return ;
228- }
229-
230- if ( \T_NEW === $ this ->tokens [ $ next_relevant ]['code ' ] ) {
219+ $ ignore = Tokens::$ emptyTokens ;
220+ $ ignore += Collections::namespacedNameTokens ();
221+ $ ignore += Collections::functionCallTokens ();
222+ $ ignore += Collections::objectOperators ();
223+ $ ignore [ \T_READONLY ] = \T_READONLY ;
224+
225+ $ next_relevant = $ stackPtr ;
226+ do {
231227 $ next_relevant = $ this ->phpcsFile ->findNext ( $ ignore , ( $ next_relevant + 1 ), null , true );
232228 if ( false === $ next_relevant ) {
233229 return ;
234230 }
235- }
236231
237- // Skip over attribute declarations when searching for the open parenthesis.
238- while ( \T_ATTRIBUTE === $ this ->tokens [ $ next_relevant ]['code ' ] ) {
239- if ( isset ( $ this ->tokens [ $ next_relevant ]['attribute_closer ' ] ) === false ) {
240- return ;
232+ if ( \T_NEW === $ this ->tokens [ $ next_relevant ]['code ' ] ) {
233+ continue ;
241234 }
242235
243- $ next_relevant = $ this ->phpcsFile ->findNext (
244- $ ignore ,
245- ( $ this ->tokens [ $ next_relevant ]['attribute_closer ' ] + 1 ),
246- null ,
247- true
248- );
236+ // Skip over attribute declarations when searching for the open parenthesis.
237+ if ( \T_ATTRIBUTE === $ this ->tokens [ $ next_relevant ]['code ' ] ) {
238+ if ( isset ( $ this ->tokens [ $ next_relevant ]['attribute_closer ' ] ) === false ) {
239+ return ;
240+ }
249241
250- if ( false === $ next_relevant ) {
251- return ;
242+ $ next_relevant = $ this -> tokens [ $ next_relevant ][ ' attribute_closer ' ];
243+ continue ;
252244 }
253- }
245+
246+ break ;
247+ } while ( true );
254248
255249 if ( \T_OPEN_PARENTHESIS !== $ this ->tokens [ $ next_relevant ]['code ' ]
256250 || isset ( $ this ->tokens [ $ next_relevant ]['parenthesis_closer ' ] ) === false
0 commit comments