Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

proposed fix for "Undefined index: scope_opener / scope_closer" notic…

…e and false positives
  • Loading branch information...
commit 6c162f3050458798acacf1685ddc453a91a9fdb3 1 parent bbf881a
Anthon Pang authored August 22, 2013
6  CodeSniffer/Standards/PSR2/Tests/ControlStructures/SwitchDeclarationUnitTest.inc
@@ -67,4 +67,10 @@ switch (0) {
67 67
         }
68 68
         break;
69 69
 }
  70
+
  71
+switch ($foo) {
  72
+    case Foo::ONE:
  73
+    case Foo::TWO:
  74
+        break;
  75
+}
70 76
 ?>
1  CodeSniffer/Tokenizers/PHP.php
@@ -444,6 +444,7 @@ public function tokenizeString($string, $eolChar='\n')
444 444
             if ($tokenIsArray === true
445 445
                 && $token[0] === T_STRING
446 446
                 && $tokens[($stackPtr + 1)] === ':'
  447
+                && $tokens[($stackPtr - 1)][0] !== T_PAAMAYIM_NEKUDOTAYIM
447 448
             ) {
448 449
                 for ($x = ($newStackPtr - 2); $x > 0; $x--) {
449 450
                     if (in_array($finalTokens[$x]['code'], PHP_CodeSniffer_Tokens::$emptyTokens) === false) {

0 notes on commit 6c162f3

Please sign in to comment.
Something went wrong with that request. Please try again.