Skip to content

Commit 7a19f8a

Browse files
committed
Include all possible token types when looking for the condition stop
token
1 parent c4cfc92 commit 7a19f8a

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

tests/Core/Tokenizers/Tokenizer/RecurseScopeMapDefaultKeywordConditionsTest.php

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -257,7 +257,15 @@ public function testSwitchDefault($testMarker, $openerMarker, $closerMarker, $co
257257
if (($opener + 1) !== $closer) {
258258
$end = $closer;
259259
if (isset($conditionStopMarker) === true) {
260-
$end = ($this->getTargetToken($conditionStopMarker, [T_RETURN]) + 1);
260+
$tokenTypes = [
261+
T_BREAK,
262+
T_CONTINUE,
263+
T_EXIT,
264+
T_GOTO,
265+
T_RETURN,
266+
T_THROW,
267+
];
268+
$end = ($this->getTargetToken($conditionStopMarker, $tokenTypes) + 1);
261269
}
262270

263271
for ($i = ($opener + 1); $i < $end; $i++) {
@@ -267,7 +275,7 @@ public function testSwitchDefault($testMarker, $openerMarker, $closerMarker, $co
267275
sprintf('T_DEFAULT condition not added for token belonging to the T_DEFAULT structure. Marker: %s.', $testMarker)
268276
);
269277
}
270-
}
278+
}//end if
271279

272280
}//end testSwitchDefault()
273281

0 commit comments

Comments
 (0)