Lines Matching refs:tokens

168         $tokens  = $phpcsFile->getTokens();
170 $trimmed = ltrim($tokens[$first]['content']);
172 $currentIndent = ($tokens[$stackPtr]['column'] - 1);
174 $currentIndent = (strlen($tokens[$first]['content']) - strlen($trimmed));
178 $line = $tokens[$stackPtr]['line'];
210 if ($exact === true && isset($tokens[$i]['nested_parenthesis']) === true) {
218 if ($tokens[$i]['column'] === 1) {
219 $trimmed = ltrim($tokens[$i]['content']);
221 if (isset($tokens[($i + 1)]) === true
222 && $tokens[$i]['line'] === $tokens[($i + 1)]['line']
225 $tokenIndent = ($tokens[($i + 1)]['column'] - 1);
229 $tokenIndent = (strlen($tokens[$i]['content']) - strlen($trimmed));
236 && $tokens[$checkToken]['code'] === T_CLOSE_PARENTHESIS
237 && isset($tokens[$checkToken]['parenthesis_opener']) === true)
238 || ($tokens[$i]['code'] === T_CLOSE_PARENTHESIS
239 && isset($tokens[$i]['parenthesis_opener']) === true)
248 $line = $tokens[$i]['line'];
252 $parenOpener = $tokens[$parenCloser]['parenthesis_opener'];
253 if ($tokens[$parenCloser]['line'] !== $tokens[$parenOpener]['line']) {
255 if (isset($tokens[$parenCloser]['nested_parenthesis']) === true
256 && empty($tokens[$parenCloser]['nested_parenthesis']) === false
258 end($tokens[$parenCloser]['nested_parenthesis']);
259 $parens = key($tokens[$parenCloser]['nested_parenthesis']);
261 $line = $tokens[$parens]['line'];
267 if (isset($tokens[$parenCloser]['conditions']) === true
268 && empty($tokens[$parenCloser]['conditions']) === false
270 end($tokens[$parenCloser]['conditions']);
271 $condition = key($tokens[$parenCloser]['conditions']);
273 $line = $tokens[$condition]['line'];
274 $type = $tokens[$condition]['type'];
297 $lastOpenTagConditions = array_keys($tokens[$lastOpenTag]['conditions']);
305 $checkIndent = ($tokens[$lastOpenTag]['column'] - 1);
313 $type = $tokens[$lastOpenTag]['type'];
317 && isset($tokens[$condition]['scope_opener']) === true
318 && isset($setIndents[$tokens[$condition]['scope_opener']]) === true
320 $checkIndent = $setIndents[$tokens[$condition]['scope_opener']];
328 $type = $tokens[$condition]['type'];
334 $checkIndent = ($tokens[$first]['column'] - 1);
340 $line = $tokens[$first]['line'];
341 $type = $tokens[$first]['type'];
345 if ($first === $tokens[$parenCloser]['parenthesis_opener']) {
355 $line = $tokens[$prev]['line'];
356 $type = $tokens[$prev]['type'];
364 $line = $tokens[$first]['line'];
365 $type = $tokens[$first]['type'];
370 if (isset($tokens[$first]['scope_closer']) === true
371 && $tokens[$first]['scope_closer'] === $first
377 if (isset($tokens[$first]['scope_condition']) === true) {
379 …$first = $phpcsFile->findFirstOnLine(T_WHITESPACE, $tokens[$scopeCloser]['scope_condition'],…
381 $currentIndent = ($tokens[$first]['column'] - 1);
387 … if ($tokens[$tokens[$scopeCloser]['scope_condition']]['code'] !== T_CLOSURE) {
394 $type = $tokens[$first]['type'];
401 $currentIndent = ($tokens[$first]['column'] - 1);
409 $type = $tokens[$first]['type'];
421 if ($tokens[$i]['code'] === T_CLOSE_SHORT_ARRAY
423 && $tokens[$checkToken]['code'] === T_CLOSE_SHORT_ARRAY)
432 $line = $tokens[$arrayCloser]['line'];
436 $arrayOpener = $tokens[$arrayCloser]['bracket_opener'];
437 if ($tokens[$arrayCloser]['line'] !== $tokens[$arrayOpener]['line']) {
439 $checkIndent = ($tokens[$first]['column'] - 1);
447 $line = $tokens[$first]['line'];
448 $type = $tokens[$first]['type'];
452 if ($first === $tokens[$arrayCloser]['bracket_opener']) {
462 $line = $tokens[$prev]['line'];
463 $type = $tokens[$prev]['type'];
471 $line = $tokens[$first]['line'];
472 $type = $tokens[$first]['type'];
475 } else if ($tokens[$first]['code'] === T_WHITESPACE) {
479 if (isset($tokens[$first]['scope_closer']) === true
480 && $tokens[$first]['scope_closer'] === $first
498 $currentIndent = ($tokens[$first]['column'] - 1);
506 $type = $tokens[$first]['type'];
518 && (empty($tokens[$checkToken]['conditions']) === false
519 || (isset($tokens[$checkToken]['scope_opener']) === true
520 && $tokens[$checkToken]['scope_opener'] === $checkToken))
522 if (empty($tokens[$checkToken]['conditions']) === false) {
523 end($tokens[$checkToken]['conditions']);
524 $condition = key($tokens[$checkToken]['conditions']);
526 $condition = $tokens[$checkToken]['scope_condition'];
557 $line = $tokens[$checkToken]['line'];
558 $type = $tokens[$checkToken]['type'];
565 $line = $tokens[$checkToken]['line'];
566 $type = $tokens[$checkToken]['type'];
575 || (isset($tokens[$checkToken]['scope_condition']) === true
576 && isset($tokens[$checkToken]['scope_closer']) === true
577 && $tokens[$checkToken]['scope_closer'] === $checkToken
578 … && $tokens[$checkToken]['line'] !== $tokens[$tokens[$checkToken]['scope_opener']]['line']))
581 || (isset($tokens[$i]['scope_condition']) === true
582 && isset($tokens[$i]['scope_closer']) === true
583 && $tokens[$i]['scope_closer'] === $i
584 && $tokens[$i]['line'] !== $tokens[$tokens[$i]['scope_opener']]['line']))
588 $type = $tokens[$tokens[$i]['scope_condition']]['type'];
589 $line = $tokens[$i]['line'];
591 $type = $tokens[$tokens[$checkToken]['scope_condition']]['type'];
592 $line = $tokens[$checkToken]['line'];
605 if (isset($tokens[$scopeCloser]['scope_condition']) === true) {
606 …$first = $phpcsFile->findFirstOnLine(T_WHITESPACE, $tokens[$scopeCloser]['scope_condition'], true);
608 $currentIndent = ($tokens[$first]['column'] - 1);
614 if ($tokens[$tokens[$scopeCloser]['scope_condition']]['code'] !== T_CLOSURE) {
621 $type = $tokens[$scopeCloser]['type'];
627 if ($tokens[$scopeCloser]['code'] === T_CLOSE_CURLY_BRACKET) {
638 && $tokens[$checkToken]['code'] === T_CLOSE_OBJECT
639 … && $tokens[$checkToken]['line'] !== $tokens[$tokens[$checkToken]['bracket_opener']]['line'])
641 && $tokens[$i]['code'] === T_CLOSE_OBJECT
642 && $tokens[$i]['line'] !== $tokens[$tokens[$i]['bracket_opener']]['line']))
645 $line = $tokens[$i]['line'];
657 if (isset($tokens[$scopeCloser]['nested_parenthesis']) === true
658 && empty($tokens[$scopeCloser]['nested_parenthesis']) === false
660 end($tokens[$scopeCloser]['nested_parenthesis']);
661 $parens = key($tokens[$scopeCloser]['nested_parenthesis']);
663 $line = $tokens[$parens]['line'];
669 if (isset($tokens[$scopeCloser]['conditions']) === true
670 && empty($tokens[$scopeCloser]['conditions']) === false
672 end($tokens[$scopeCloser]['conditions']);
673 $condition = key($tokens[$scopeCloser]['conditions']);
675 $line = $tokens[$condition]['line'];
676 $type = $tokens[$condition]['type'];
697 $line = $tokens[$tokens[$scopeCloser]['bracket_opener']]['line'];
701 … $first = $phpcsFile->findFirstOnLine(T_WHITESPACE, $tokens[$scopeCloser]['bracket_opener'], true);
704 $currentIndent = ($tokens[$first]['column'] - 1);
710 $checkIndent = ($tokens[$first]['column'] - 1);
730 $type = $tokens[$first]['type'];
736 … && isset(PHP_CodeSniffer_Tokens::$scopeOpeners[$tokens[$checkToken]['code']]) === true
737 && in_array($tokens[$checkToken]['code'], $this->nonIndentingScopes) === false
738 && isset($tokens[$checkToken]['scope_opener']) === true
753 && isset($tokens[$lastOpener]['scope_closer']) === true
754 && $tokens[$lastOpener]['level'] === $tokens[$checkToken]['level']
755 && $tokens[$lastOpener]['scope_closer'] === $tokens[$checkToken]['scope_closer']
760 $line = $tokens[$i]['line'];
761 $type = $tokens[$lastOpener]['type'];
767 if ($tokens[$checkToken]['code'] === T_CLOSURE
776 $line = $tokens[$i]['line'];
786 … && isset(PHP_CodeSniffer_Tokens::$methodPrefixes[$tokens[$checkToken]['code']]) === true
787 && $tokens[($checkToken + 1)]['code'] !== T_DOUBLE_COLON
794 if ($checkToken !== null && $tokens[$checkToken]['code'] === T_PROPERTY) {
802 && ($tokens[$checkToken]['code'] === T_OPEN_TAG
803 || $tokens[$checkToken]['code'] === T_OPEN_TAG_WITH_ECHO
804 || $tokens[$checkToken]['code'] === T_CLOSE_TAG)
807 $checkIndent = ($tokens[$checkToken]['column'] - 1);
814 if ($checkToken !== null && $tokens[$checkToken]['code'] === T_ELSE) {
834 && isset($this->_ignoreIndentationTokens[$tokens[$checkToken]['code']]) === false
860 $line = $tokens[$checkToken]['line'];
888 $line = $tokens[$checkToken]['line'];
889 $type = $tokens[$checkToken]['type'];
907 if ($tokens[$i]['code'] === T_START_HEREDOC
908 || $tokens[$i]['code'] === T_START_NOWDOC
916 if ($tokens[$i]['code'] === T_CONSTANT_ENCAPSED_STRING
917 || $tokens[$i]['code'] === T_DOUBLE_QUOTED_STRING
919 $i = $phpcsFile->findNext($tokens[$i]['code'], ($i + 1), null, true);
926 if ($tokens[$i]['code'] === T_DOC_COMMENT_OPEN_TAG) {
927 $i = $tokens[$i]['comment_closer'];
932 if ($tokens[$i]['code'] === T_OPEN_TAG
933 || $tokens[$i]['code'] === T_OPEN_TAG_WITH_ECHO
936 $line = $tokens[$i]['line'];
942 … $currentIndent = (strlen($tokens[$first]['content']) - strlen(ltrim($tokens[$first]['content'])));
944 $currentIndent = ($tokens[$i]['column'] - 1);
958 $type = $tokens[$i]['type'];
967 if ($tokens[$i]['code'] === T_CLOSE_TAG) {
969 $line = $tokens[$i]['line'];
973 if ($tokens[$lastOpenTag]['line'] !== $tokens[$i]['line']) {
974 $currentIndent = ($tokens[$i]['column'] - 1);
980 $currentIndent = ($tokens[$lastCloseTag]['column'] - 1);
993 $type = $tokens[$i]['type'];
1001 if ($tokens[$i]['code'] === T_CLOSURE || $tokens[$i]['code'] === T_ANON_CLASS) {
1002 $closer = $tokens[$i]['scope_closer'];
1003 if ($tokens[$i]['line'] === $tokens[$closer]['line']) {
1005 $type = str_replace('_', ' ', strtolower(substr($tokens[$i]['type'], 2)));
1006 $line = $tokens[$i]['line'];
1015 $type = str_replace('_', ' ', strtolower(substr($tokens[$i]['type'], 2)));
1016 $line = $tokens[$i]['line'];
1021 $currentIndent = (($tokens[$first]['column'] - 1) + $this->indent);
1029 $i = $tokens[$i]['scope_opener'];
1033 $type = $tokens[$i]['type'];
1041 if (isset($tokens[$i]['scope_condition']) === true
1042 && isset($tokens[$i]['scope_opener']) === true
1043 && $tokens[$i]['scope_opener'] === $i
1045 $closer = $tokens[$i]['scope_closer'];
1046 if ($tokens[$i]['line'] === $tokens[$closer]['line']) {
1048 $line = $tokens[$i]['line'];
1049 $type = $tokens[$i]['type'];
1057 $condition = $tokens[$tokens[$i]['scope_condition']]['code'];
1062 $line = $tokens[$i]['line'];
1063 $type = $tokens[$tokens[$i]['scope_condition']]['type'];
1069 $openScopes[$tokens[$i]['scope_closer']] = $tokens[$i]['scope_condition'];
1072 $type = $tokens[$i]['type'];
1082 && $tokens[$i]['code'] === T_OBJECT
1084 $closer = $tokens[$i]['bracket_closer'];
1085 if ($tokens[$i]['line'] === $tokens[$closer]['line']) {
1087 $line = $tokens[$i]['line'];
1096 $line = $tokens[$i]['line'];
1101 $currentIndent = (($tokens[$first]['column'] - 1) + $this->indent);
1111 $type = $tokens[$first]['type'];
1119 if (isset($tokens[$i]['scope_condition']) === true
1120 && $tokens[$i]['scope_closer'] === $i
1121 && ($tokens[$tokens[$i]['scope_condition']]['code'] === T_CLOSURE
1122 || $tokens[$tokens[$i]['scope_condition']]['code'] === T_ANON_CLASS)
1125 …$type = str_replace('_', ' ', strtolower(substr($tokens[$tokens[$i]['scope_condition']]['type'], 2…
1126 $line = $tokens[$i]['line'];
1134 $conditions = $tokens[$i]['conditions'];
1144 $line = $tokens[$object]['line'];
1150 if (isset($tokens[$i]['nested_parenthesis']) === true
1151 && empty($tokens[$i]['nested_parenthesis']) === false
1153 end($tokens[$i]['nested_parenthesis']);
1154 $parens = key($tokens[$i]['nested_parenthesis']);
1156 $line = $tokens[$parens]['line'];
1162 if (isset($tokens[$i]['conditions']) === true
1163 && empty($tokens[$i]['conditions']) === false
1165 end($tokens[$i]['conditions']);
1166 $condition = key($tokens[$i]['conditions']);
1168 $line = $tokens[$condition]['line'];
1169 $type = $tokens[$condition]['type'];
1201 …$prev = $phpcsFile->findPrevious(array(T_EQUAL, T_RETURN), ($tokens[$i]['scope_condition'] - 1), n…
1211 $line = $tokens[$prev]['line'];
1212 $type = $tokens[$prev]['type'];
1218 $line = $tokens[$first]['line'];
1219 $type = $tokens[$first]['type'];
1227 $line = $tokens[$prev]['line'];
1228 $type = $tokens[$prev]['type'];
1234 $line = $tokens[$first]['line'];
1235 $type = $tokens[$first]['type'];
1240 $currentIndent = ($tokens[$first]['column'] - 1);
1245 if (isset($tokens[$first]['scope_closer']) === true
1246 && $tokens[$first]['scope_closer'] === $first
1252 if ($condition === 0 || $tokens[$condition]['scope_opener'] < $first) {
1264 $type = $tokens[$first]['type'];