@param \PHP_CodeSniffer\Files\File $phpcsFile
@param int $startIndex
@param int $endIndex

@throws \RuntimeException

@return array
197082
protected function parse(File $phpcsFile, int $startIndex, int $endIndex): array
    {
        $tokens = $phpcsFile->getTokens();
        if (empty($tokens[$endIndex])) {
            throw new RuntimeException('Should not happen');
        }

        $classIndex = $phpcsFile->findNext(Tokens::$emptyTokens, $startIndex + 1, null, true);
        if (empty($tokens[$classIndex])) {
            throw new RuntimeException('Should not happen');
        }

        $implements = [];

        $i = $classIndex;
        while ($i < $endIndex) {
            if (empty($tokens[$i])) {
                break;
            }

            while ($tokens[$i]['code'] !== T_NS_SEPARATOR && $tokens[$i]['code'] !== T_STRING) {
                $i++;
                if (empty($tokens[$i])) {
                    break;
                }

                continue;
            }

            if (empty($tokens[$i])) {
                break;
            }

            $current = $i;
            $className = $tokens[$i]['content'];
            $i++;

            if (empty($tokens[$i])) {
                break;
            }

            while ($tokens[$i]['code'] === T_NS_SEPARATOR || $tokens[$i]['code'] === T_STRING) {
                $className .= $tokens[$i]['content'];
                $i++;

                if (empty($tokens[$i])) {
                    break;
                }
            }

            $implements[] = [
                'start' => $current,
                'end' => $i - 1,
                'content' => $className,
            ];
        }

        return $implements;
    }
253738
protected function clearWhitespacesBeforeIndex(File $phpcsFile, int $index): void
    {
        $tokens = $phpcsFile->getTokens();

        if ($tokens[$index - 1]['code'] !== T_WHITESPACE) {
            return;
        }

        $phpcsFile->fixer->replaceToken($index - 1, '');
    }
736874
protected function findErrors(File $phpCsFile, int $contentIndex): array
    {
        $tokens = $phpCsFile->getTokens();

        $comment = $tokens[$contentIndex]['content'];

        preg_match('|^(.+?)(\s+)(.+?)\s*$|', $comment, $contentMatches);
        if (!$contentMatches || !$contentMatches[1] || !$contentMatches[3]) {
            $phpCsFile->addError('Invalid Inline Doc Block content', $contentIndex, 'ContentInvalid');
            return [];
        }

        $errors = [];

        if (!preg_match('|([a-z0-9]) $|i', $comment)) {
            $errors['space-before-end'] = 'Expected single space before ´*/´';
        }

        if (!preg_match('|^\$[a-z0-9]+$|i', $contentMatches[3])) {
            $errors['order'] = 'Expected ´{Type} ${var}´, got `' . $contentMatches[1] . $contentMatches[2] . $contentMatches[3] . '`';
        }

        return $errors;
    }
223754
public function process(PHP_CodeSniffer_File $phpcsFile, $stackPtr)
        {
            $tokens = $phpcsFile->getTokens();

            // Find the next non whitespace token.
            $commentStart = $phpcsFile->findNext(T_WHITESPACE, ($stackPtr + 1), null, true);

            // Allow declare() statements at the top of the file.
            if ($tokens[$commentStart]['code'] === T_DECLARE) {
                $semicolon    = $phpcsFile->findNext(T_SEMICOLON, ($commentStart + 1));
                $commentStart = $phpcsFile->findNext(T_WHITESPACE, ($semicolon + 1), null, true);
            }

            // Ignore vim header.
            if ($tokens[$commentStart]['code'] === T_COMMENT) {
                if (strstr($tokens[$commentStart]['content'], 'vim:') !== false) {
                    $commentStart = $phpcsFile->findNext(
                        T_WHITESPACE,
                        ($commentStart + 1),
                        null,
                        true
                    );
                }
            }

            $errorToken = ($stackPtr + 1);
            if (isset($tokens[$errorToken]) === false) {
                $errorToken--;
            }

            if ($tokens[$commentStart]['code'] === T_CLOSE_TAG) {
                // We are only interested if this is the first open tag.
                return ($phpcsFile->numTokens + 1);
            } else if ($tokens[$commentStart]['code'] === T_COMMENT) {
                $error = 'You must use "/**" style comments for a file comment';
                $phpcsFile->addError($error, $errorToken, 'WrongStyle');
                $phpcsFile->recordMetric($stackPtr, 'File has doc comment', 'yes');
                return ($phpcsFile->numTokens + 1);
            } else if ($commentStart === false
                || $tokens[$commentStart]['code'] !== T_DOC_COMMENT_OPEN_TAG
            ) {
                $phpcsFile->addError('Missing file doc comment', $errorToken, 'Missing');
                $phpcsFile->recordMetric($stackPtr, 'File has doc comment', 'no');
                return ($phpcsFile->numTokens + 1);
            } else {
                $phpcsFile->recordMetric($stackPtr, 'File has doc comment', 'yes');
            }

            // Check the PHP Version, which should be in some text before the first tag.
            $commentEnd = $tokens[$commentStart]['comment_closer'];
            $found      = false;
            for ($i = ($commentStart + 1); $i < $commentEnd; $i++) {
                if ($tokens[$i]['code'] === T_DOC_COMMENT_TAG) {
                    break;
                } else if ($tokens[$i]['code'] === T_DOC_COMMENT_STRING
                    && strstr(strtolower($tokens[$i]['content']), 'php version') !== false
                ) {
                    $found = true;
                    break;
                }
            }

            if ($found === false) {
                $error = 'PHP version not specified';
                $phpcsFile->addWarning($error, $commentEnd, 'MissingVersion');
            }

            // Check each tag.
            $this->processTags($phpcsFile, $stackPtr, $commentStart);

            // Ignore the rest of the file.
            return ($phpcsFile->numTokens + 1);

        }
1097223
public function process(File $phpcsFile, $stackPtr) {
		$utils = new Utils();

		$tokens = $phpcsFile->getTokens();

		// Array of dynamic queries methods	and vulnerable params
		// TODO https://drupal.org/node/310085 db_merge()
		$dynq = array(
			'condition' => 3,
			'where' => 1,
			'having' => 1,
			'havingCondition' => 3,
			'orderBy' => array(1,2),
			'groupBy' => 1,
			'addExpression' => 1,
			'join' => 3,
			'innerJoin' => 3,
			'leftJoin' => 3,
			'rightJoin' => 3,
			'expression' => array(1,2),
			'fields' => 1, //special case with sub array() in param #1
		);

		if (!array_key_exists($tokens[$stackPtr]['content'], $dynq)) {
			return;
		}
		$paramnumlist = $dynq[$tokens[$stackPtr]['content']];

		if (!is_array($paramnumlist)) {
			$paramnumlist = array($paramnumlist);
		}

		foreach ($paramnumlist as $paramnum) {
			$t = $utils::get_param_tokens($phpcsFile, $stackPtr, $paramnum);
			if (!$t) {
				// Param not found or empty
				return;
			}

			$closer = end($t)['stackPtr']+1;
			$s = $t[0]['stackPtr'] - 1;
			$warn = FALSE;
			$already = FALSE;
			$next = false;
			while ($s < $closer) {
				$s = $phpcsFile->findNext(\PHP_CodeSniffer\Util\Tokens::$emptyTokens, $s + 1, $closer, true);
				if (!$s) {
					break;
				}
				if ($tokens[$stackPtr]['content'] == 'fields' && ($tokens[$s]['content'] == 'array' || $next)) {
					$next = $phpcsFile->findNext(T_DOUBLE_ARROW, $s + 1, $closer);
					if ($next) {
						$s = $phpcsFile->findPrevious(\PHP_CodeSniffer\Util\Tokens::$emptyTokens, $next - 1, null, true);
						if (is_numeric($paramnum)) {
							$paramnum .= ' with array key value';
						}
					} else {
						// End of Array or empty Array
						break;
					}
				}
				if ($utils::is_token_user_input($tokens[$s])) {
					$phpcsFile->addError('SQL injection found in ' . $tokens[$stackPtr]['content'] . " with param #$paramnum", $s, 'D7DynQueriesSQLi');
				} elseif ($tokens[$s]['code'] == T_DOUBLE_QUOTED_STRING || $tokens[$s]['code'] == T_VARIABLE) {
					$phpcsFile->addWarning('Potential SQL injection with direct variable usage in ' . $tokens[$stackPtr]['content'] . " with param #$paramnum", $s, 'D7DynQueriesDirectVar');
				} elseif ($tokens[$s]['code'] != T_CONSTANT_ENCAPSED_STRING && $tokens[$s]['code'] != T_LNUMBER) {
					$warn = TRUE;
				}
			}

			if ($warn && \PHP_CodeSniffer\Config::getConfigData('ParanoiaMode')) {
				$phpcsFile->addWarning('Potential SQL injection in ' . $tokens[$stackPtr]['content'] . " with param #$paramnum", $stackPtr, 'D7DynQueriesWarn');
			}
		}
	}
231091
public function findLastOnLine(File $phpcsFile, $start)
    {
        $tokens = $phpcsFile->getTokens();

        for ($i = $start; $i <= $phpcsFile->numTokens; $i++) {
            if ($tokens[$i]['line'] === $tokens[$start]['line']) {
                continue;
            }

            return ($i - 1);
        }

        return false;
    }
848178
public function process(PHP_CodeSniffer_File $phpcsFile, $stackPtr)
    {
        $tokens = $phpcsFile->getTokens();
        $token = $tokens[$stackPtr];
        $length = 0;
        if (isset($token['scope_opener']) === false) {
            //ignore empty methods
            return;
        }

        //get the full length of the method
        $firstToken = $tokens[$token['scope_opener']];
        $lastToken = $tokens[$token['scope_closer']];
        $length = $lastToken['line'] - $firstToken['line'];

        if ($length > $this->absoluteMaxLength) {
            $error = sprintf("Method's length (%d) exceeds maximum length of %d", $length, $this->absoluteMaxLength);
            $phpcsFile->addError($error, $stackPtr, 'MethodTooBig');
            return;
        }

        if ($length > $this->maxLength) {
            $error = sprintf("Method's length (%d) exceeds %d, consider refactoring", $length, $this->maxLength);
            $phpcsFile->addWarning($error, $stackPtr, 'MethodTooBig');
        }
    }
1295917
protected function contains(File $phpcsFile, $search, $start, $end, $skipNested = true) {
		$tokens = $phpcsFile->getTokens();

		for ($i = $start; $i <= $end; $i++) {
			if ($skipNested && $tokens[$i]['code'] === T_OPEN_PARENTHESIS) {
				$i = $tokens[$i]['parenthesis_closer'];
				continue;
			}
			if ($skipNested && $tokens[$i]['code'] === T_OPEN_SHORT_ARRAY) {
				$i = $tokens[$i]['bracket_closer'];
				continue;
			}
			if ($skipNested && $tokens[$i]['code'] === T_OPEN_CURLY_BRACKET) {
				$i = $tokens[$i]['bracket_closer'];
				continue;
			}

			if ($this->isGivenKind($search, $tokens[$i])) {
				return true;
			}
		}

		return false;
	}
250000
public function process(PHP_CodeSniffer_File $phpcsFile, $stackPtr) {
		$tokens = $phpcsFile->getTokens();
		$token = $tokens[$stackPtr];
		// Skip for-loop without body.
		if (isset($token['parenthesis_opener']) === false) {
			return;
		}
		$next = ++$token['parenthesis_opener'];
		$end = --$token['parenthesis_closer'];
		$goodCondition = false;
		for (; $next <= $end; ++$next) {
			$code = $tokens[$next]['code'];
			if (isset(PHP_CodeSniffer_Tokens::$emptyTokens[$code])) {
				continue;
			} else if (!in_array($code, array(T_TRUE, T_FALSE, T_LNUMBER, T_CONSTANT_ENCAPSED_STRING, T_STRING))) {
				$goodCondition = true;
				break;
			}
		}
		if (!$goodCondition) {
			$error = 'Avoid IF statements that are always true or false';
			$phpcsFile->addError($error, $stackPtr, 'Found');
		}
	}
1014610
public function process(PHP_CodeSniffer_File $phpcsFile, $stackPtr)
    {
        $tokens = $phpcsFile->getTokens();

        if (isset($tokens[$stackPtr]['scope_closer']) === false) {
            return;
        }

        if (isset($tokens[$stackPtr]['parenthesis_opener']) === true) {
            $parenOpener = $tokens[$stackPtr]['parenthesis_opener'];
            $parenCloser = $tokens[$stackPtr]['parenthesis_closer'];

            if ($tokens[($parenOpener + 1)]['code'] === T_WHITESPACE
                && !$this->isNextTokenAnException($tokens, $parenOpener + 1)
            ) {
                $gap   = strlen($tokens[($parenOpener + 1)]['content']);
                $error = 'Expected 0 spaces after opening bracket; %s found';
                $data  = array($gap);
                $phpcsFile->addError($error, ($parenOpener + 1), 'SpacingAfterOpenBrace', $data);
            }

            if ($tokens[$parenOpener]['line'] === $tokens[$parenCloser]['line']
                && $tokens[($parenCloser - 1)]['code'] === T_WHITESPACE
            ) {
                $gap   = strlen($tokens[($parenCloser - 1)]['content']);
                $error = 'Expected 0 spaces before closing bracket; %s found';
                $data  = array($gap);
                $phpcsFile->addError($error, ($parenCloser - 1), 'SpaceBeforeCloseBrace', $data);
            }
        }//end if

        $scopeOpener = $tokens[$stackPtr]['scope_opener'];
        $scopeCloser = $tokens[$stackPtr]['scope_closer'];

        $firstContent = $phpcsFile->findNext(
            T_WHITESPACE,
            ($scopeOpener + 1),
            null,
            true
        );

        if ($tokens[$firstContent]['line'] !== ($tokens[$scopeOpener]['line'] + 1)) {
            $error = 'Blank line found at start of control structure';
            $phpcsFile->addError($error, $scopeOpener, 'SpacingBeforeOpen');
        }

        $lastContent = $phpcsFile->findPrevious(
            T_WHITESPACE,
            ($scopeCloser - 1),
            null,
            true
        );

        if ($tokens[$lastContent]['line'] !== ($tokens[$scopeCloser]['line'] - 1)) {
            $errorToken = $scopeCloser;
            for ($i = ($scopeCloser - 1); $i > $lastContent; $i--) {
                if ($tokens[$i]['line'] < $tokens[$scopeCloser]['line']) {
                    $errorToken = $i;
                    break;
                }
            }

            $error = 'Blank line found at end of control structure';
            $phpcsFile->addError($error, $errorToken, 'SpacingAfterClose');
        }

        $trailingContent = $phpcsFile->findNext(
            T_WHITESPACE,
            ($scopeCloser + 1),
            null,
            true
        );

        if ($tokens[$trailingContent]['code'] === T_ELSE) {
            if ($tokens[$stackPtr]['code'] === T_IF) {
                // IF with ELSE.
                return;
            }
        }

        if ($tokens[$trailingContent]['code'] === T_COMMENT) {
            if ($tokens[$trailingContent]['line'] === $tokens[$scopeCloser]['line']) {
                if (substr($tokens[$trailingContent]['content'], 0, 5) === '//end') {
                    // There is an end comment, so we have to get the next piece
                    // of content.
                    $trailingContent = $phpcsFile->findNext(
                        T_WHITESPACE,
                        ($trailingContent + 1),
                        null,
                        true
                    );
                }
            }
        }

        // If this token is closing a CASE or DEFAULT, we don't need the
        // blank line after this control structure.
        if (isset($tokens[$trailingContent]['scope_condition']) === true) {
            $condition = $tokens[$trailingContent]['scope_condition'];
            if ($tokens[$condition]['code'] === T_CASE
                || $tokens[$condition]['code'] === T_DEFAULT
            ) {
                return;
            }
        }

        if ($tokens[$trailingContent]['code'] === T_CLOSE_TAG) {
            // At the end of the script or embedded code.
            return;
        }

        if ($tokens[$trailingContent]['code'] === T_CLOSE_CURLY_BRACKET) {
            // Another control structure's closing brace.
            if (isset($tokens[$trailingContent]['scope_condition']) === true) {
                $owner = $tokens[$trailingContent]['scope_condition'];
                if ($tokens[$owner]['code'] === T_FUNCTION) {
                    // The next content is the closing brace of a function
                    // so normal function rules apply and we can ignore it.
                    return;
                }
            }

            if ($tokens[$trailingContent]['line'] !== ($tokens[$scopeCloser]['line'] + 1)) {
                $error = 'Blank line found after control structure';
                $phpcsFile->addError($error, $scopeCloser, 'LineAfterClose');
            }
        } else {
            if ($tokens[$trailingContent]['line'] === ($tokens[$scopeCloser]['line'] + 1)) {
                $error = 'No blank line found after control structure';
                $phpcsFile->addError($error, $scopeCloser, 'NoLineAfterClose');
            }
        }

    }
557215
public function process(PHP_CodeSniffer_File $phpcsFile, $stackPtr)
    {
        $tokens = $phpcsFile->getTokens();
        $bracketStart = DWS_Helpers_Bracket::bracketStart($phpcsFile, $stackPtr);
        $bracketEnd = DWS_Helpers_Bracket::bracketEnd($phpcsFile, $stackPtr);

        if ($tokens[$bracketStart]['line'] === $tokens[$bracketEnd]['line']) {
            return; // Single-line expressions don't have indentation to worry about.
        }

        $beginningIndent = DWS_Helpers_WhiteSpace::indentOfLine($phpcsFile, $bracketStart);

        if ($tokens[$bracketEnd]['column'] !== $beginningIndent) {
            $data = [$beginningIndent - 1, $tokens[$bracketEnd]['column'] - 1, $tokens[$bracketEnd]['content']];
            $phpcsFile->addError('Expected indentation of %s spaces, %s found for ending bracket "%s"', $bracketEnd, 'EndIndent', $data);
        }

        $nextToken = $phpcsFile->findNext(PHP_CodeSniffer_Tokens::$emptyTokens, $bracketStart + 1, $bracketEnd, true);
        if ($nextToken !== false && $tokens[$nextToken]['line'] === $tokens[$bracketStart]['line']) {
            $data = [$tokens[$bracketStart]['content']];
            $phpcsFile->addError('Expected first item after opening "%s" to be indented on a new line', $nextToken, 'OpeningIndent', $data);
        }

        $firstOnLine = $bracketStart + 1;
        for ($line = $tokens[$bracketStart]['line'] + 1; $line < $tokens[$bracketEnd]['line']; $line++) {
            while ($tokens[$firstOnLine]['line'] < $line || in_array($tokens[$firstOnLine]['code'], PHP_CodeSniffer_Tokens::$emptyTokens)) {
                if (array_key_exists('parenthesis_closer', $tokens[$firstOnLine])) {
                    $firstOnLine = $tokens[$firstOnLine]['parenthesis_closer'] + 1;
                    $line = $tokens[$firstOnLine]['line'];
                    continue 2;
                } elseif (array_key_exists('bracket_closer', $tokens[$firstOnLine])) {
                    $firstOnLine = $tokens[$firstOnLine]['bracket_closer'] + 1;
                    $line = $tokens[$firstOnLine]['line'];
                    continue 2;
                }

                $firstOnLine++;
            }

            if ($tokens[$firstOnLine]['line'] === $line && $tokens[$firstOnLine]['column'] !== $beginningIndent + 4) {
                $data = [$beginningIndent + 3, $tokens[$firstOnLine]['column'] - 1];
                $phpcsFile->addError('Expected indentation of %s spaces, %s found', $firstOnLine, 'MultiLineIndent', $data);
            }
        }
    }
602690
protected function findUnnecessaryTrailingComparisonEnd(File $phpcsFile, int $index): ?int
    {
        $tokens = $phpcsFile->getTokens();

        $next = (int)$phpcsFile->findNext(T_WHITESPACE, ($index + 1), null, true);
        if (!$next || !in_array($tokens[$next]['code'], [T_IS_IDENTICAL, T_IS_NOT_IDENTICAL])) {
            return null;
        }

        $next = (int)$phpcsFile->findPrevious(T_WHITESPACE, ($next - 1), null, true);
        if (!$next || !in_array($tokens[$next]['code'], [T_TRUE, T_FALSE])) {
            return null;
        }

        return $next;
    }
766128
protected function readTags(File $phpCsFile, int $docBlockStartIndex, int $docBlockEndIndex): array
    {
        $tokens = $phpCsFile->getTokens();

        $tags = [];

        for ($i = $docBlockStartIndex; $i < $docBlockEndIndex; $i++) {
            if ($tokens[$i]['code'] !== T_DOC_COMMENT_TAG) {
                continue;
            }

            $start = $this->getFirstTokenOfLine($tokens, $i);
            $end = $this->getEndIndex($tokens, $i);
            $tagEnd = $this->getTagEndIndex($tokens, $start, $end);

            $tag = [
                'index' => $i,
                'tag' => $tokens[$i]['content'],
                'tagEnd' => $tagEnd,
                'start' => $start,
                'end' => $end,
                'content' => $this->getContent($tokens, $i, $tagEnd),
            ];
            $tags[] = $tag;
            $i = $end;
        }

        return $tags;
    }
381600
protected function checkFirstAnnotationTag(File $phpCsFile, int $docBlockStartIndex, int $docBlockEndIndex): void
    {
        $tokens = $phpCsFile->getTokens();

        $nextIndex = $phpCsFile->findNext(T_DOC_COMMENT_TAG, $docBlockStartIndex + 1, $docBlockEndIndex);
        if (!$nextIndex) {
            return;
        }

        $prevIndex = $phpCsFile->findPrevious(T_DOC_COMMENT_STRING, $nextIndex - 1, $docBlockStartIndex + 1);
        if (!$prevIndex) {
            $this->checkBeginningOfDocBlock($phpCsFile, $docBlockStartIndex, $nextIndex);
            return;
        }

        $diff = $tokens[$nextIndex]['line'] - $tokens[$prevIndex]['line'];
        if ($diff === 2) {
            return;
        }

        $fix = $phpCsFile->addFixableError('Expected 1 extra new line before tags, got ' . ($diff - 1), $nextIndex, 'ExtraLineMissing');
        if (!$fix) {
            return;
        }

        if ($diff > 2) {
            $phpCsFile->fixer->beginChangeset();

            for ($i = $prevIndex; $i < $nextIndex; $i++) {
                if ($tokens[$i]['line'] <= $tokens[$prevIndex]['line'] + 1 || $tokens[$i]['line'] >= $tokens[$nextIndex]['line']) {
                    continue;
                }
                $phpCsFile->fixer->replaceToken($i, '');
            }

            $phpCsFile->fixer->endChangeset();

            return;
        }

        $i = $nextIndex;
        while ($tokens[$i]['line'] === $tokens[$nextIndex]['line']) {
            $i--;
        }

        $phpCsFile->fixer->beginChangeset();

        $indentation = $this->getIndentationWhitespace($phpCsFile, $docBlockEndIndex);
        $phpCsFile->fixer->addContentBefore($i, $indentation . '*');
        $phpCsFile->fixer->addNewlineBefore($i);

        $phpCsFile->fixer->endChangeset();
    }
822100
protected function parseImplements(File $phpcsFile, int $implementsStartIndex): array
    {
        $implementsEndIndex = $phpcsFile->findNext(T_OPEN_CURLY_BRACKET, $implementsStartIndex + 1);

        return $this->parse($phpcsFile, $implementsStartIndex, $implementsEndIndex);
    }
95550
public function process(PHP_CodeSniffer_File $phpcsFile, $stackPtr)
	{
		$tokens = $phpcsFile->getTokens();

		// Find the next non whitespace token.
		$commentStart = $phpcsFile->findNext(T_WHITESPACE, ($stackPtr + 1), null, true);

		// Allow declare() statements at the top of the file.
		if ($tokens[$commentStart]['code'] === T_DECLARE)
		{
			$semicolon    = $phpcsFile->findNext(T_SEMICOLON, ($commentStart + 1));
			$commentStart = $phpcsFile->findNext(T_WHITESPACE, ($semicolon + 1), null, true);
		}

		// Ignore vim header.
		if ($tokens[$commentStart]['code'] === T_COMMENT)
		{
			if (strstr($tokens[$commentStart]['content'], 'vim:') !== false)
			{
				$commentStart = $phpcsFile->findNext(
					T_WHITESPACE,
					($commentStart + 1),
					null,
					true
				);
			}
		}

		$errorToken = ($stackPtr + 1);

		if (isset($tokens[$errorToken]) === false)
		{
			$errorToken--;
		}

		if ($tokens[$commentStart]['code'] === T_CLOSE_TAG)
		{
			// We are only interested if this is the first open tag.
			return ($phpcsFile->numTokens + 1);
		}
		elseif ($tokens[$commentStart]['code'] === T_COMMENT)
		{
			$error = 'You must use "/**" style comments for a file comment';
			$phpcsFile->addError($error, $errorToken, 'WrongStyle');
			$phpcsFile->recordMetric($stackPtr, 'File has doc comment', 'yes');

			return ($phpcsFile->numTokens + 1);
		}
		elseif ($commentStart === false
			|| $tokens[$commentStart]['code'] !== T_DOC_COMMENT_OPEN_TAG
		)
		{
			$phpcsFile->addError('Missing file doc comment', $errorToken, 'Missing');
			$phpcsFile->recordMetric($stackPtr, 'File has doc comment', 'no');

			return ($phpcsFile->numTokens + 1);
		}
		else
		{
			$phpcsFile->recordMetric($stackPtr, 'File has doc comment', 'yes');
		}

		// Check each tag.
		$this->processTags($phpcsFile, $stackPtr, $commentStart);

		// Ignore the rest of the file.
		return ($phpcsFile->numTokens + 1);
	}
602320
public function process(PHP_CodeSniffer_File $phpcsFile, $stackPtr)
    {
        $tokens = $phpcsFile->getTokens();
        $arrayStart = DWS_Helpers_Bracket::bracketStart($phpcsFile, $stackPtr);
        $arrayEnd = DWS_Helpers_Bracket::bracketEnd($phpcsFile, $stackPtr);

        if (!in_array($arrayStart, [$stackPtr, $stackPtr + 1])) {
            $phpcsFile->addError('No whitespace allowed between the array keyword and the opening parenthesis', $stackPtr, 'SpaceAfterKeyword');
        }

        $firstMember = $phpcsFile->findNext(T_WHITESPACE, $arrayStart + 1, $arrayEnd, true);
        if ($firstMember === false && $arrayEnd - $arrayStart !== 1) {
            $phpcsFile->addError('Empty array declaration must have no space between the brackets', $stackPtr, 'SpaceInEmptyArray');
        }
    }