@@ 589-593 (lines=5) @@ | ||
586 | && $opener === null |
|
587 | && $this->tokens[$i]['code'] === T_SEMICOLON |
|
588 | ) { |
|
589 | if (PHP_CodeSniffer_VERBOSITY > 1) { |
|
590 | $type = $this->tokens[$stackPtr]['type']; |
|
591 | echo str_repeat("\t", $depth); |
|
592 | echo "=> Found semicolon before scope opener for $stackPtr:$type, bailing".PHP_EOL; |
|
593 | } |
|
594 | ||
595 | return $i; |
|
596 | } |
|
@@ 607-611 (lines=5) @@ | ||
604 | && $tokenType === T_CLOSE_CURLY_BRACKET |
|
605 | && isset($this->scopeOpeners[$currType]['end'][$tokenType]) === true |
|
606 | ) { |
|
607 | if (PHP_CodeSniffer_VERBOSITY > 1) { |
|
608 | $type = $this->tokens[$stackPtr]['type']; |
|
609 | echo str_repeat("\t", $depth); |
|
610 | echo "=> Found curly brace closer before scope opener for $stackPtr:$type, bailing".PHP_EOL; |
|
611 | } |
|
612 | ||
613 | return ($i - 1); |
|
614 | } |
|
@@ 637-641 (lines=5) @@ | ||
634 | // The opener is a curly bracket so the closer must be a curly bracket as well. |
|
635 | // We ignore this closer to handle cases such as T_ELSE or T_ELSEIF being considered |
|
636 | // a closer of T_IF when it should not. |
|
637 | if (PHP_CodeSniffer_VERBOSITY > 1) { |
|
638 | $type = $this->tokens[$stackPtr]['type']; |
|
639 | echo str_repeat("\t", $depth); |
|
640 | echo "=> Ignoring non-curly scope closer for $stackPtr:$type".PHP_EOL; |
|
641 | } |
|
642 | } else { |
|
643 | $scopeCloser = $i; |
|
644 | $todo = array( |
|
@@ 738-742 (lines=5) @@ | ||
735 | && $this->tokens[$stackPtr]['code'] !== T_FUNCTION |
|
736 | ) { |
|
737 | // Probably a closure, so process it manually. |
|
738 | if (PHP_CodeSniffer_VERBOSITY > 1) { |
|
739 | $type = $this->tokens[$stackPtr]['type']; |
|
740 | echo str_repeat("\t", $depth); |
|
741 | echo "=> Found function before scope opener for $stackPtr:$type, processing manually".PHP_EOL; |
|
742 | } |
|
743 | ||
744 | if (isset($this->tokens[$i]['scope_closer']) === true) { |
|
745 | // We've already processed this closure. |
|
@@ 761-765 (lines=5) @@ | ||
758 | ||
759 | // Found another opening condition but still haven't |
|
760 | // found our opener, so we are never going to find one. |
|
761 | if (PHP_CodeSniffer_VERBOSITY > 1) { |
|
762 | $type = $this->tokens[$stackPtr]['type']; |
|
763 | echo str_repeat("\t", $depth); |
|
764 | echo "=> Found new opening condition before scope opener for $stackPtr:$type, "; |
|
765 | } |
|
766 | ||
767 | if (($this->tokens[$stackPtr]['code'] === T_IF |
|
768 | || $this->tokens[$stackPtr]['code'] === T_ELSEIF |
|
@@ 907-911 (lines=5) @@ | ||
904 | ||
905 | if ($ignore === 0 || $tokenType !== T_OPEN_CURLY_BRACKET) { |
|
906 | // We found the opening scope token for $currType. |
|
907 | if (PHP_CodeSniffer_VERBOSITY > 1) { |
|
908 | $type = $this->tokens[$stackPtr]['type']; |
|
909 | echo str_repeat("\t", $depth); |
|
910 | echo "=> Found scope opener for $stackPtr:$type".PHP_EOL; |
|
911 | } |
|
912 | ||
913 | $opener = $i; |
|
914 | } |
|
@@ 966-974 (lines=9) @@ | ||
963 | echo str_repeat("\t", $depth); |
|
964 | echo "=> Still looking for $stackPtr:$type scope opener after $lines lines".PHP_EOL; |
|
965 | } |
|
966 | } else { |
|
967 | if (PHP_CodeSniffer_VERBOSITY > 1) { |
|
968 | $type = $this->tokens[$stackPtr]['type']; |
|
969 | echo str_repeat("\t", $depth); |
|
970 | echo "=> Couldn't find scope opener for $stackPtr:$type, bailing".PHP_EOL; |
|
971 | } |
|
972 | ||
973 | return $stackPtr; |
|
974 | } |
|
975 | } |
|
976 | } else if ($opener !== null |
|
977 | && $tokenType !== T_BREAK |
|
@@ 994-998 (lines=5) @@ | ||
991 | // have a condition, so it belongs to another token and |
|
992 | // our token doesn't have a closer, so pretend this is |
|
993 | // the closer. |
|
994 | if (PHP_CodeSniffer_VERBOSITY > 1) { |
|
995 | $type = $this->tokens[$stackPtr]['type']; |
|
996 | echo str_repeat("\t", $depth); |
|
997 | echo "=> Found (unexpected) scope closer for $stackPtr:$type".PHP_EOL; |
|
998 | } |
|
999 | ||
1000 | foreach (array($stackPtr, $opener) as $token) { |
|
1001 | $this->tokens[$token]['scope_condition'] = $stackPtr; |
|
@@ 1069-1073 (lines=5) @@ | ||
1066 | // Check to see if this token opened the scope. |
|
1067 | if ($this->tokens[$i]['scope_opener'] === $i) { |
|
1068 | $stackPtr = $this->tokens[$i]['scope_condition']; |
|
1069 | if (PHP_CodeSniffer_VERBOSITY > 1) { |
|
1070 | $type = $this->tokens[$stackPtr]['type']; |
|
1071 | echo str_repeat("\t", ($level + 1)); |
|
1072 | echo "=> Found scope opener for $stackPtr:$type".PHP_EOL; |
|
1073 | } |
|
1074 | ||
1075 | $stackPtr = $this->tokens[$i]['scope_condition']; |
|
1076 | ||
@@ 1160-1164 (lines=5) @@ | ||
1157 | } |
|
1158 | ||
1159 | $conditions[$stackPtr] = $this->tokens[$stackPtr]['code']; |
|
1160 | if (PHP_CodeSniffer_VERBOSITY > 1) { |
|
1161 | $type = $this->tokens[$stackPtr]['type']; |
|
1162 | echo str_repeat("\t", ($level + 1)); |
|
1163 | echo "* token $stackPtr:$type added to conditions array *".PHP_EOL; |
|
1164 | } |
|
1165 | ||
1166 | $lastOpener = $this->tokens[$i]['scope_opener']; |
|
1167 | if ($lastOpener !== null) { |