Processes this test, when one of its tokens is encountered.

@param \PHP_CodeSniffer_File $phpcsFile The file being scanned.
@param int                   $stackPtr  The position of the current token in
the stack passed in $tokens.

@return void
766630
public function process(File $phpcsFile, $stackPtr)
    {
        if ($this->bowOutEarly() === true) {
            return;
        }

        $tokens     = $phpcsFile->getTokens();
        $function   = $tokens[$stackPtr]['content'];
        $functionLc = strtolower($function);

        if (isset($this->targetFunctions[$functionLc]) === false) {
            return;
        }

        $prevNonEmpty = $phpcsFile->findPrevious(Tokens::$emptyTokens, ($stackPtr - 1), null, true);

        if ($this->isMethod === true) {
            if ($tokens[$prevNonEmpty]['code'] !== \T_DOUBLE_COLON
                && $tokens[$prevNonEmpty]['code'] !== \T_OBJECT_OPERATOR
            ) {
                // Not a call to a PHP method.
                return;
            }
        } else {
            if (isset($this->ignoreTokens[$tokens[$prevNonEmpty]['code']]) === true) {
                // Not a call to a PHP function.
                return;
            }

            if ($tokens[$prevNonEmpty]['code'] === \T_NS_SEPARATOR
                && $tokens[$prevNonEmpty - 1]['code'] === \T_STRING
            ) {
                // Namespaced function.
                return;
            }
        }

        $parameters = $this->getFunctionCallParameters($phpcsFile, $stackPtr);

        if (empty($parameters)) {
            return $this->processNoParameters($phpcsFile, $stackPtr, $function);
        } else {
            return $this->processParameters($phpcsFile, $stackPtr, $function, $parameters);
        }
    }
842573
protected function processMemberVar(
        PHP_CodeSniffer_File $phpcsFile,
        $stackPtr
    ) {
        $tokens = $phpcsFile->getTokens();
        $token  = $tokens[$stackPtr];
        // TODO: don't care for now
    }
889576
public function process(PHP_CodeSniffer_File $phpcsFile, $stackPtr) {
		$tokens = $phpcsFile->getTokens();
		$commentStart = $stackPtr;
		$commentEnd = $tokens[$stackPtr]['comment_closer'];
		$empty = array(
			T_DOC_COMMENT_WHITESPACE,
			T_DOC_COMMENT_STAR,
		);

		$short = $phpcsFile->findNext($empty, ($stackPtr + 1), $commentEnd, true);
		if ($short === false) {
			// No content at all.
			$error = 'Doc comment is empty';
			$phpcsFile->addError($error, $stackPtr, 'Empty');
			return;
		}

		// The first line of the comment should have /** comment openning and short description.
		if ($tokens[$short]['line'] !== $tokens[$stackPtr]['line']) {
			$error = 'Short description must follow doc comment open tag immediatelly';
			$fix = $phpcsFile->addFixableWarning($error, $stackPtr, 'DescriptionOnAnotherLine');
			if ($fix === true) {
				$phpcsFile->fixer->beginChangeset();
				for ($ptr = $stackPtr + 1; $ptr < $short; ++$ptr) {
					$phpcsFile->fixer->replaceToken($ptr, '');
				}
				$phpcsFile->fixer->addContentBefore($short, ' ');
				$phpcsFile->fixer->endChangeset();
			}
		}
	}
400960
public function process(PHP_CodeSniffer_File $phpcsFile, $stackPtr)
    {
        $tokens = $phpcsFile->getTokens();
        $operator = $tokens[$stackPtr]['content'];
        $previousToken = $tokens[$stackPtr - 1];
        $nextToken = $tokens[$stackPtr + 1];

        $previousSpaces = $previousToken['code'] === T_WHITESPACE ? strlen($previousToken['content']) : 0;
        $nextSpaces = $nextToken['code'] === T_WHITESPACE ? strlen($nextToken['content']) : 0;

        $previousNonEmpty = $phpcsFile->findPrevious(T_WHITESPACE, $stackPtr - 1, null, true);
        $previousSplitsLine = $tokens[$previousNonEmpty]['line'] !== $tokens[$stackPtr]['line'];

        $nextNonEmpty = $phpcsFile->findNext(T_WHITESPACE, $stackPtr + 1, null, true);
        $nextSplitsLine = $tokens[$nextNonEmpty]['line'] !== $tokens[$stackPtr]['line'];

        if (DWS_Helpers_Operator::isUnary($phpcsFile, $stackPtr)) {
            if (
                !$previousSplitsLine &&
                $previousSpaces !== 1 &&
                !in_array($tokens[$previousNonEmpty]['code'], [T_OPEN_PARENTHESIS, T_OPEN_SQUARE_BRACKET, T_OPEN_SHORT_ARRAY])
            ) {
                $phpcsFile->addError('Expected 1 space before "%s"; %s found', $stackPtr, 'SpacingBefore', [$operator, $previousSpaces]);
            }

            if ($nextSpaces !== 0) {
                $phpcsFile->addError('Expected 0 spaces after "%s"; %s found', $stackPtr, 'SpacingAfterUnary', [$operator, $nextSpaces]);
            }
        } else {
            if ($tokens[$stackPtr]['code'] === T_INLINE_ELSE && $tokens[$previousNonEmpty]['code'] === T_INLINE_THEN) {
                if ($previousSpaces !== 0) {
                    $phpcsFile->addError('Expected 0 spaces inside "?:"; %s found', $stackPtr, 'SpacingInTernary', [$previousSpaces]);
                }
            } elseif (!$previousSplitsLine && $previousSpaces !== 1) {
                $phpcsFile->addError('Expected 1 space before "%s"; %s found', $stackPtr, 'SpacingBefore', [$operator, $previousSpaces]);
            }

            $isTernaryShortcut = $tokens[$stackPtr]['code'] === T_INLINE_THEN && $tokens[$nextNonEmpty]['code'] === T_INLINE_ELSE;
            if (!$isTernaryShortcut && !$nextSplitsLine && $nextSpaces !== 1) {
                $phpcsFile->addError('Expected 1 space after "%s"; %s found', $stackPtr, 'SpacingAfter', [$operator, $nextSpaces]);
            }
        }
    }
1073507
public function process(PHP_CodeSniffer_File $phpcsFile, $stackPtr)
    {
        $tokens = $phpcsFile->getTokens();

        $ignore = array(
                   T_DOUBLE_COLON,
                   T_OBJECT_OPERATOR,
                   T_FUNCTION,
                   T_CONST,
                  );

        $prevToken = $phpcsFile->findPrevious(T_WHITESPACE, ($stackPtr - 1), null, true);
        if (in_array($tokens[$prevToken]['code'], $ignore) === true) {
            // Not a call to a PHP function.
            return;
        }

        $function = strtolower($tokens[$stackPtr]['content']);
        if ($function != 'ini_get' && $function != 'ini_set') {
            return;
        }
        $iniToken = $phpcsFile->findNext(T_CONSTANT_ENCAPSED_STRING, $stackPtr, null);

        $filteredToken = str_replace(array('"', "'"), array("", ""), $tokens[$iniToken]['content']);
        if (in_array($filteredToken, array_keys($this->newIniDirectives)) === false) {
            return;
        }

        $error = '';

        foreach ($this->newIniDirectives[$filteredToken] as $version => $present) {
            if ($this->supportsBelow($version)) {
                if ($present === true) {
                    $error .= " not available before version " . $version;
                }
            }
        }

        if (strlen($error) > 0) {
            $error = "INI directive '" . $filteredToken . "' is" . $error;

            $phpcsFile->addWarning($error, $stackPtr);
        }

    }
1081444
public function process(File $phpcsFile, $stackPtr)
    {
        $tokens = $phpcsFile->getTokens();

        $varName = $tokens[$stackPtr]['content'];
        if ($varName !== '$GLOBALS'
            && $varName !== '$HTTP_RAW_POST_DATA'
            && $varName !== '$_COOKIE'
            && $varName !== '$_ENV'
            && $varName !== '$_FILES'
            && $varName !== '$_GET'
            && $varName !== '$_POST'
            && $varName !== '$_REQUEST'
            && $varName !== '$_SERVER'
        ) {
            return;
        }

        $error = "The $varName super global must not be accessed directly.";
        $phpcsFile->addError($error, $stackPtr, 'NoSuperGlobals');
    }
1285707
public function process(PHP_CodeSniffer_File $phpcsFile, $stackPtr)
    {
        $tokens = $phpcsFile->getTokens();

		$end_position = $tokens[$stackPtr]['parenthesis_closer'];

		// states: -1 = normal, 0 = start function call (probably), 1 = in function
		$function = -1;

		for ($position = $stackPtr; $position < $end_position; $position++)
		{
			if ($tokens[$position]['type'] == 'T_STRING')
			{
				$function = 0;
				continue;
			}

			if ($function === 0)
			{
				if ($tokens[$position]['type'] == 'T_OPEN_PARENTHESIS')
				{
					$function = 1;
					continue;
				}
			}
			elseif ($function !== 1)
			{
				$function = -1;
				if ($tokens[$position]['type'] == 'T_EQUAL')
				{
					$error = 'Inline assignment not allowed in if statements';
					$phpcsFile->addError($error, $stackPtr, 'IncDecLeft');
					return;
				}
			}
		}
    }
349677
public function process(PHP_CodeSniffer_File $phpcsFile, $stackPtr)
    {
        $tokens = $phpcsFile->getTokens();

        $ignore = array(
                T_DOUBLE_COLON,
                T_OBJECT_OPERATOR,
                T_FUNCTION,
                T_CONST,
        );

        $prevToken = $phpcsFile->findPrevious(T_WHITESPACE, ($stackPtr - 1), null, true);
        if (in_array($tokens[$prevToken]['code'], $ignore) === true) {
            // Not a call to a PHP function.
            return;
        }

        $function = strtolower($tokens[$stackPtr]['content']);
        $pattern  = null;

        if ($this->patternMatch === true) {
            $count   = 0;
            $pattern = preg_replace(
                    $this->forbiddenFunctionNames,
                    $this->forbiddenFunctionsNames,
                    $function,
                    1,
                    $count
            );

            if ($count === 0) {
                return;
            }

            // Remove the pattern delimiters and modifier.
            $pattern = substr($pattern, 1, -2);
        } else {
            if (in_array($function, $this->forbiddenFunctionNames) === false) {
                return;
            }
        }

        $this->addError($phpcsFile, $stackPtr, $function, $pattern);

    }
1196437
public function process(PHP_CodeSniffer_File $phpcsFile, $stackPtr)
    {
        $tokens = $phpcsFile->getTokens();
        $stackPrev = $stackPtr - 1;
        $stackNext = $stackPtr + 1;

        // One space after the namespace keyword.
        if ($tokens[$stackNext]['content'] !== ' ') {
            $error = 'There must be a single space after the NAMESPACE keyword';
            $fix = $phpcsFile->addFixableError($error, $stackPtr, 'SpaceAfterNamespace');
            if ($fix === true) {
                $phpcsFile->fixer->replaceToken($stackNext, ' ');
            }
        }

        // Find the previous token that is NOT whitespace
        $lastNonWhitespace = $phpcsFile->findPrevious(T_WHITESPACE, $stackPrev, null, true);

        // should not happen; something is horribly wrong
        if ($lastNonWhitespace === false) {
            return;
        }

        $diff = ($tokens[$stackPtr]['line'] - $tokens[$lastNonWhitespace]['line']);

        if ($diff !== 2) {
            $error = 'There must be one blank line before the namespace declaration';
            $fix = $phpcsFile->addFixableError($error, $stackPtr, 'BlankLineBefore');

            if ($fix === true) {
                /*
                 * If there is less than a 2 line difference, add newlines in.
                 * If there is more than a 2 line difference, take newlines out.
                 */
                if ($diff < 2) {
                    $phpcsFile->fixer->beginChangeset();
                    for ($i = 0; $i < (2 - $diff); $i++) {
                        $phpcsFile->fixer->addNewlineBefore($stackPtr);
                    }
                    $phpcsFile->fixer->endChangeset();
                } else {
                    /*
                     * Remove all whitespace between the namespace and the previous non-whitespace
                     * tokens. If a newline was removed from the same line as the previous
                     * non-whitespace token, we need to make sure to add that back in.
                     */
                    $phpcsFile->fixer->beginChangeset();
                    $newlineRemoved = false;
                    for ($i = ($lastNonWhitespace + 1); $i < $stackPtr; $i++) {
                        if ($tokens[$lastNonWhitespace]['line'] === $tokens[$i]['line']) {
                            $newlineRemoved = true;
                        }
                        $phpcsFile->fixer->replaceToken($i, '');
                    }
                    if ($newlineRemoved) {
                        $phpcsFile->fixer->addNewline($lastNonWhitespace);
                    }
                    $phpcsFile->fixer->addNewline($lastNonWhitespace);
                    $phpcsFile->fixer->endChangeset();
                }
            }
        } elseif ($tokens[$stackPtr]['column'] !== 1) {
            $error = 'Line indented incorrectly; expected 0 spaces, found '.($tokens[$stackPtr]['column'] - 1);
            $fix = $phpcsFile->addFixableError($error, $stackPtr, 'NoSpaceBeforeNamespace');

            if ($fix === true) {
                $content = explode("\n", $tokens[$stackPrev]['content']);
                $content[count($content) - 1] = '';
                $phpcsFile->fixer->replaceToken($stackPrev, implode("\n", $content));
            }
        }
    }
1068627
public function process(File $phpcsFile, $stackPtr)
    {
        $functionName   = $phpcsFile->getDeclarationName($stackPtr);
        $functionNameLc = strtolower($functionName);

        if (isset($this->newMagicMethods[$functionNameLc]) === false) {
            return;
        }

        if ($this->inClassScope($phpcsFile, $stackPtr, false) === false) {
            return;
        }

        $itemInfo = array(
            'name'   => $functionName,
            'nameLc' => $functionNameLc,
        );
        $this->handleFeature($phpcsFile, $stackPtr, $itemInfo);
    }
1161451
public function process(File $phpcsFile, $stackPtr)
    {
        $tokens = $phpcsFile->getTokens();

        $ignore = array(
            \T_DOUBLE_COLON    => true,
            \T_OBJECT_OPERATOR => true,
            \T_FUNCTION        => true,
            \T_CONST           => true,
        );

        $prevToken = $phpcsFile->findPrevious(\T_WHITESPACE, ($stackPtr - 1), null, true);
        if (isset($ignore[$tokens[$prevToken]['code']]) === true) {
            // Not a call to a PHP function.
            return;
        }

        $function   = $tokens[$stackPtr]['content'];
        $functionLc = strtolower($function);

        if (isset($this->functionParameters[$functionLc]) === false) {
            return;
        }

        $parameterCount  = $this->getFunctionCallParameterCount($phpcsFile, $stackPtr);
        $openParenthesis = $phpcsFile->findNext(Tokens::$emptyTokens, $stackPtr + 1, null, true, null, true);

        // If the parameter count returned > 0, we know there will be valid open parenthesis.
        if ($parameterCount === 0 && $tokens[$openParenthesis]['code'] !== \T_OPEN_PARENTHESIS) {
            return;
        }

        $parameterOffsetFound = $parameterCount - 1;

        foreach ($this->functionParameters[$functionLc] as $offset => $parameterDetails) {
            if ($offset > $parameterOffsetFound) {
                $itemInfo = array(
                    'name'   => $function,
                    'nameLc' => $functionLc,
                    'offset' => $offset,
                );
                $this->handleFeature($phpcsFile, $openParenthesis, $itemInfo);
            }
        }
    }
300164
public function process(File $phpcsFile, $stackPtr)
    {
        $tokens = $phpcsFile->getTokens();

        $ignore = array(
            \T_DOUBLE_COLON    => true,
            \T_OBJECT_OPERATOR => true,
            \T_FUNCTION        => true,
            \T_CONST           => true,
        );

        $prevToken = $phpcsFile->findPrevious(\T_WHITESPACE, ($stackPtr - 1), null, true);
        if (isset($ignore[$tokens[$prevToken]['code']]) === true) {
            // Not a call to a PHP function.
            return;
        }

        $functionLc = strtolower($tokens[$stackPtr]['content']);
        if (isset($this->iniFunctions[$functionLc]) === false) {
            return;
        }

        $iniToken = $this->getFunctionCallParameter($phpcsFile, $stackPtr, $this->iniFunctions[$functionLc]);
        if ($iniToken === false) {
            return;
        }

        $filteredToken = $this->stripQuotes($iniToken['raw']);
        if (isset($this->newIniDirectives[$filteredToken]) === false) {
            return;
        }

        $itemInfo = array(
            'name'       => $filteredToken,
            'functionLc' => $functionLc,
        );
        $this->handleFeature($phpcsFile, $iniToken['end'], $itemInfo);
    }
429238
public function process(File $phpcsFile, $stackPtr)
    {
        $tokens = $phpcsFile->getTokens();

        $ignore = array(
            \T_DOUBLE_COLON    => true,
            \T_OBJECT_OPERATOR => true,
            \T_FUNCTION        => true,
            \T_CLASS           => true,
            \T_CONST           => true,
            \T_USE             => true,
            \T_NS_SEPARATOR    => true,
        );

        $prevToken = $phpcsFile->findPrevious(\T_WHITESPACE, ($stackPtr - 1), null, true);
        if (isset($ignore[$tokens[$prevToken]['code']]) === true) {
            // Not a call to a PHP function.
            return;
        }

        $function   = $tokens[$stackPtr]['content'];
        $functionLc = strtolower($function);

        if (isset($this->removedFunctions[$functionLc]) === false) {
            return;
        }

        $itemInfo = array(
            'name'   => $function,
            'nameLc' => $functionLc,
        );
        $this->handleFeature($phpcsFile, $stackPtr, $itemInfo);
    }
1257356
public function process(PHP_CodeSniffer_File $phpcsFile, $stackPtr)
    {
        $tokens = $phpcsFile->getTokens();
        if (isset($tokens[$stackPtr]['scope_closer']) === false) {
            return;
        }

        $errorData = array(strtolower($tokens[$stackPtr]['content']));

        $nextClass = $phpcsFile->findNext(array(T_CLASS, T_INTERFACE, T_TRAIT), ($stackPtr + 1));
        if ($nextClass !== false) {
            $error = 'Each %s must be in a file by itself';
            $phpcsFile->addError($error, $nextClass, 'MultipleClasses', $errorData);
        }
    }
457368
public function process(File $phpcsFile, $stackPtr)
    {
        // Only cover places, that are not handled by "Squiz.WhiteSpace.OperatorSpacing" sniff.
        $tokens = $phpcsFile->getTokens();

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

        if ($tokens[($stackPtr - 2)]['line'] !== $tokens[$stackPtr]['line']) {
            $found = 'newline';
        } else {
            $found = $tokens[($stackPtr - 1)]['length'];
        }

        if (isset($phpcsFile->fixer) === true) {
            $phpcsFile->recordMetric($stackPtr, 'Space before operator', $found);
        }

        if ($found !== 1) {
            $error = 'Expected 1 space before "%s"; %s found';
            $data  = array(
                      $tokens[$stackPtr]['content'],
                      $found,
                     );
            $fix   = $phpcsFile->addFixableError($error, $stackPtr, 'SpacingBefore', $data);

            if ($fix === true) {
                $phpcsFile->fixer->replaceToken(($stackPtr - 1), ' ');
            }
        }
    }
687877
public function process(PHP_CodeSniffer_File $phpcsFile, $stackPtr)
    {
        $tokens = $phpcsFile->getTokens();
        $content = $tokens[$stackPtr]['content'];
        $error = 'Inline HTML "%s" is not allowed';
        $data = array(trim($content));
        $phpcsFile->addError($error, $stackPtr, 'DisallowedInlineHtmlUsed', $data);
    }
518384
public function process(PHP_CodeSniffer_File $phpcsFile, $stackPtr)
    {
        if ($this->supportsAbove('5.4')) {
            $tokens = $phpcsFile->getTokens();
            $nextSemicolonToken = $phpcsFile->findNext(T_SEMICOLON, ($stackPtr), null, false);
            for ($curToken = $stackPtr + 1; $curToken < $nextSemicolonToken; $curToken++) {
                $gotError = false;
                if ($tokens[$curToken]['type'] == 'T_STRING') {
                    // If the next non-whitespace token after the string
                    // is an opening parenthesis then it's a function call.
                    $openBracket = $phpcsFile->findNext(PHP_CodeSniffer_Tokens::$emptyTokens, $curToken + 1, null, true);
                    if ($tokens[$openBracket]['code'] !== T_OPEN_PARENTHESIS) {
                        continue;
                    } else {
                        $gotError = true;
                    }
                }
                switch ($tokens[$curToken]['type']) {
                    case 'T_VARIABLE':
                    case 'T_FUNCTION':
                        $gotError = true;
                        break;
                }
                if ($gotError === true) {
                    $error = 'Using a variable argument on break or continue is forbidden since PHP 5.4';
                    $phpcsFile->addError($error, $stackPtr);
                }
            }
        }
    }