@@ 618-622 (lines=5) @@ | ||
615 | && $opener === null |
|
616 | && $this->tokens[$i]['code'] === T_SEMICOLON |
|
617 | ) { |
|
618 | if (PHP_CodeSniffer_VERBOSITY > 1) { |
|
619 | $type = $this->tokens[$stackPtr]['type']; |
|
620 | echo str_repeat("\t", $depth); |
|
621 | echo "=> Found semicolon before scope opener for $stackPtr:$type, bailing".PHP_EOL; |
|
622 | } |
|
623 | ||
624 | return $i; |
|
625 | } |
|
@@ 636-640 (lines=5) @@ | ||
633 | && $tokenType === T_CLOSE_CURLY_BRACKET |
|
634 | && isset($this->scopeOpeners[$currType]['end'][$tokenType]) === true |
|
635 | ) { |
|
636 | if (PHP_CodeSniffer_VERBOSITY > 1) { |
|
637 | $type = $this->tokens[$stackPtr]['type']; |
|
638 | echo str_repeat("\t", $depth); |
|
639 | echo "=> Found curly brace closer before scope opener for $stackPtr:$type, bailing".PHP_EOL; |
|
640 | } |
|
641 | ||
642 | return ($i - 1); |
|
643 | } |
|
@@ 666-670 (lines=5) @@ | ||
663 | // The opener is a curly bracket so the closer must be a curly bracket as well. |
|
664 | // We ignore this closer to handle cases such as T_ELSE or T_ELSEIF being considered |
|
665 | // a closer of T_IF when it should not. |
|
666 | if (PHP_CodeSniffer_VERBOSITY > 1) { |
|
667 | $type = $this->tokens[$stackPtr]['type']; |
|
668 | echo str_repeat("\t", $depth); |
|
669 | echo "=> Ignoring non-curly scope closer for $stackPtr:$type".PHP_EOL; |
|
670 | } |
|
671 | } else { |
|
672 | $scopeCloser = $i; |
|
673 | $todo = array( |
|
@@ 767-771 (lines=5) @@ | ||
764 | && $this->tokens[$stackPtr]['code'] !== T_FUNCTION |
|
765 | ) { |
|
766 | // Probably a closure, so process it manually. |
|
767 | if (PHP_CodeSniffer_VERBOSITY > 1) { |
|
768 | $type = $this->tokens[$stackPtr]['type']; |
|
769 | echo str_repeat("\t", $depth); |
|
770 | echo "=> Found function before scope opener for $stackPtr:$type, processing manually".PHP_EOL; |
|
771 | } |
|
772 | ||
773 | if (isset($this->tokens[$i]['scope_closer']) === true) { |
|
774 | // We've already processed this closure. |
|
@@ 790-794 (lines=5) @@ | ||
787 | ||
788 | // Found another opening condition but still haven't |
|
789 | // found our opener, so we are never going to find one. |
|
790 | if (PHP_CodeSniffer_VERBOSITY > 1) { |
|
791 | $type = $this->tokens[$stackPtr]['type']; |
|
792 | echo str_repeat("\t", $depth); |
|
793 | echo "=> Found new opening condition before scope opener for $stackPtr:$type, "; |
|
794 | } |
|
795 | ||
796 | if (($this->tokens[$stackPtr]['code'] === T_IF |
|
797 | || $this->tokens[$stackPtr]['code'] === T_ELSEIF |
|
@@ 936-940 (lines=5) @@ | ||
933 | ||
934 | if ($ignore === 0 || $tokenType !== T_OPEN_CURLY_BRACKET) { |
|
935 | // We found the opening scope token for $currType. |
|
936 | if (PHP_CodeSniffer_VERBOSITY > 1) { |
|
937 | $type = $this->tokens[$stackPtr]['type']; |
|
938 | echo str_repeat("\t", $depth); |
|
939 | echo "=> Found scope opener for $stackPtr:$type".PHP_EOL; |
|
940 | } |
|
941 | ||
942 | $opener = $i; |
|
943 | } |
|
@@ 995-1003 (lines=9) @@ | ||
992 | echo str_repeat("\t", $depth); |
|
993 | echo "=> Still looking for $stackPtr:$type scope opener after $lines lines".PHP_EOL; |
|
994 | } |
|
995 | } else { |
|
996 | if (PHP_CodeSniffer_VERBOSITY > 1) { |
|
997 | $type = $this->tokens[$stackPtr]['type']; |
|
998 | echo str_repeat("\t", $depth); |
|
999 | echo "=> Couldn't find scope opener for $stackPtr:$type, bailing".PHP_EOL; |
|
1000 | } |
|
1001 | ||
1002 | return $stackPtr; |
|
1003 | } |
|
1004 | } |
|
1005 | } else if ($opener !== null |
|
1006 | && $tokenType !== T_BREAK |
|
@@ 1023-1027 (lines=5) @@ | ||
1020 | // have a condition, so it belongs to another token and |
|
1021 | // our token doesn't have a closer, so pretend this is |
|
1022 | // the closer. |
|
1023 | if (PHP_CodeSniffer_VERBOSITY > 1) { |
|
1024 | $type = $this->tokens[$stackPtr]['type']; |
|
1025 | echo str_repeat("\t", $depth); |
|
1026 | echo "=> Found (unexpected) scope closer for $stackPtr:$type".PHP_EOL; |
|
1027 | } |
|
1028 | ||
1029 | foreach (array($stackPtr, $opener) as $token) { |
|
1030 | $this->tokens[$token]['scope_condition'] = $stackPtr; |
|
@@ 1098-1102 (lines=5) @@ | ||
1095 | // Check to see if this token opened the scope. |
|
1096 | if ($this->tokens[$i]['scope_opener'] === $i) { |
|
1097 | $stackPtr = $this->tokens[$i]['scope_condition']; |
|
1098 | if (PHP_CodeSniffer_VERBOSITY > 1) { |
|
1099 | $type = $this->tokens[$stackPtr]['type']; |
|
1100 | echo str_repeat("\t", ($level + 1)); |
|
1101 | echo "=> Found scope opener for $stackPtr:$type".PHP_EOL; |
|
1102 | } |
|
1103 | ||
1104 | $stackPtr = $this->tokens[$i]['scope_condition']; |
|
1105 | ||
@@ 1189-1193 (lines=5) @@ | ||
1186 | } |
|
1187 | ||
1188 | $conditions[$stackPtr] = $this->tokens[$stackPtr]['code']; |
|
1189 | if (PHP_CodeSniffer_VERBOSITY > 1) { |
|
1190 | $type = $this->tokens[$stackPtr]['type']; |
|
1191 | echo str_repeat("\t", ($level + 1)); |
|
1192 | echo "* token $stackPtr:$type added to conditions array *".PHP_EOL; |
|
1193 | } |
|
1194 | ||
1195 | $lastOpener = $this->tokens[$i]['scope_opener']; |
|
1196 | if ($lastOpener !== null) { |