File tree Expand file tree Collapse file tree 4 files changed +39
-2
lines changed
Standards/PSR2/Tests/ControlStructures Expand file tree Collapse file tree 4 files changed +39
-2
lines changed Original file line number Diff line number Diff line change @@ -38,6 +38,7 @@ http://pear.php.net/dtd/package-2.0.xsd">
38
38
- Added more guard code for syntax errors to various sniffs
39
39
- Squiz CommentedOutCodeSniff is now better at ignoring URLs inside comments
40
40
- Fixed bug #584 : Squiz.Arrays.ArrayDeclaration sniff gives incorrect NoComma error for multiline string values
41
+ - Fixed bug #592 : USE statement tokenising can sometimes result in mismatched scopes
41
42
- Fixed bug #594 : Tokenizer issue on closure that returns by reference
42
43
</notes >
43
44
<contents >
Original file line number Diff line number Diff line change @@ -88,4 +88,18 @@ switch (true) {
88
88
return null ;
89
89
}
90
90
}
91
- ?>
91
+
92
+ use Vendor \Test \FooBar ;
93
+
94
+ function test ()
95
+ {
96
+ switch ($ val ) {
97
+ case 'foo ' :
98
+ echo 'foo ' ;
99
+ break ;
100
+ default :
101
+ echo 'foo ' ;
102
+ }
103
+
104
+ exit ;
105
+ }
Original file line number Diff line number Diff line change @@ -88,4 +88,18 @@ switch (true) {
88
88
return null;
89
89
}
90
90
}
91
- ?>
91
+
92
+ use Vendor\Test\FooBar;
93
+
94
+ function test()
95
+ {
96
+ switch ($val) {
97
+ case 'foo':
98
+ echo 'foo';
99
+ break;
100
+ default:
101
+ echo 'foo';
102
+ }
103
+
104
+ exit;
105
+ }
Original file line number Diff line number Diff line change @@ -451,6 +451,14 @@ private function createScopeMap()
451
451
echo "\tStart scope map at $ i: $ type => $ content " .PHP_EOL ;
452
452
}
453
453
454
+ if (isset ($ this ->tokens [$ i ]['scope_condition ' ]) === true ) {
455
+ if (PHP_CODESNIFFER_VERBOSITY > 1 ) {
456
+ echo "\t* already processed, skipping * " .PHP_EOL ;
457
+ }
458
+
459
+ continue ;
460
+ }
461
+
454
462
$ i = $ this ->recurseScopeMap ($ i );
455
463
}//end if
456
464
}//end for
You can’t perform that action at this time.
0 commit comments