Skip to content

Commit c07267e

Browse files
committed
Tests/Tokenizer: fix conditions checking range in T_DEFAULT test
Among other things, the RecurseScopeMapDefaultKeywordConditionsTest ::testSwitchDefault() method checks if tokens within the scope of a `T_DEFAULT` token have `T_DEFAULT` set as one of its `conditions` array. The test was incorrectly checking token `conditions` due to an off-by-one error in the loop range when the `T_DEFAULT` uses curly braces. For a `T_DEFAULT` with curly braces, the tokenizer adds `T_DEFAULT` to the `conditions` array of all the tokens within its scope up to the `T_BREAK|T_RETURN|T_CONTINUE`, but the test was checking only until the token before the `T_BREAK|T_RETURN|T_CONTINUE`.
1 parent 08a864f commit c07267e

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

tests/Core/Tokenizers/Tokenizer/RecurseScopeMapDefaultKeywordConditionsTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,7 @@ public function testSwitchDefault($testMarker, $openerOffset, $closerOffset, $co
159159
if (($opener + 1) !== $closer) {
160160
$end = $closer;
161161
if (isset($conditionStop) === true) {
162-
$end = ($token + $conditionStop);
162+
$end = ($token + $conditionStop + 1);
163163
}
164164

165165
for ($i = ($opener + 1); $i < $end; $i++) {

0 commit comments

Comments
 (0)