Unexpected scope_condition
for scope_closer
of a default
case in a switch
statement
#810
Labels
scope_condition
for scope_closer
of a default
case in a switch
statement
#810
While working on adding more tests to
tests/Core/Tokenizers/Tokenizer/RecurseScopeMapDefaultKeywordConditionsTest.php
, I noticed a behavior in howscope_condition
is set that I thought is worth highlighting to check if something should be changed or not.In the code below, the
switch
anddefault
keywords shareendswitch
as their scope closer.The test
RecurseScopeMapDefaultKeywordConditionsTest::testSwitchDefault()
expects that the value of thescope_condition
of thescope_closer
token of thedefault
keyword (endswitch
) points to the token that representsdefault
:PHP_CodeSniffer/tests/Core/Tokenizers/Tokenizer/RecurseScopeMapDefaultKeywordConditionsTest.php
Line 154 in d694aea
That expectation is not valid for the code sample above. The
scope_condition
of the token that represents theendswitch
keyword contains the index of theswitch
token and not thedefault
token. I don't know enough about the tokenizer to know if this is a problem or not.The following patch can be used to add a new failing test with the code sample above that illustrates the situation described in this issue:
Patch
The text was updated successfully, but these errors were encountered: