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
167517
public function process(File $phpcsFile, $stackPtr)
    {
        if ($this->supportsBelow('5.2')) {
            $phpcsFile->addError(
                'Closures / anonymous functions are not available in PHP 5.2 or earlier',
                $stackPtr,
                'Found'
            );
        }

        /*
         * Closures can only be declared as static since PHP 5.4.
         */
        $isStatic = $this->isClosureStatic($phpcsFile, $stackPtr);
        if ($this->supportsBelow('5.3') && $isStatic === true) {
            $phpcsFile->addError(
                'Closures / anonymous functions could not be declared as static in PHP 5.3 or earlier',
                $stackPtr,
                'StaticFound'
            );
        }

        $tokens = $phpcsFile->getTokens();

        if (isset($tokens[$stackPtr]['scope_opener'], $tokens[$stackPtr]['scope_closer']) === false) {
            // Live coding or parse error.
            return;
        }

        $scopeStart = ($tokens[$stackPtr]['scope_opener'] + 1);
        $scopeEnd   = $tokens[$stackPtr]['scope_closer'];
        $usesThis   = $this->findThisUsageInClosure($phpcsFile, $scopeStart, $scopeEnd);

        if ($this->supportsBelow('5.3')) {
            /*
             * Closures declared within classes only have access to $this since PHP 5.4.
             */
            if ($usesThis !== false) {
                $thisFound = $usesThis;
                do {
                    $phpcsFile->addError(
                        'Closures / anonymous functions did not have access to $this in PHP 5.3 or earlier',
                        $thisFound,
                        'ThisFound'
                    );

                    $thisFound = $this->findThisUsageInClosure($phpcsFile, ($thisFound + 1), $scopeEnd);

                } while ($thisFound !== false);
            }

            /*
             * Closures declared within classes only have access to self/parent/static since PHP 5.4.
             */
            $usesClassRef = $this->findClassRefUsageInClosure($phpcsFile, $scopeStart, $scopeEnd);

            if ($usesClassRef !== false) {
                do {
                    $phpcsFile->addError(
                        'Closures / anonymous functions could not use "%s::" in PHP 5.3 or earlier',
                        $usesClassRef,
                        'ClassRefFound',
                        array(strtolower($tokens[$usesClassRef]['content']))
                    );

                    $usesClassRef = $this->findClassRefUsageInClosure($phpcsFile, ($usesClassRef + 1), $scopeEnd);

                } while ($usesClassRef !== false);
            }
        }

        /*
         * Check for correct usage.
         */
        if ($this->supportsAbove('5.4') && $usesThis !== false) {

            $thisFound = $usesThis;

            do {
                /*
                 * Closures only have access to $this if not declared as static.
                 */
                if ($isStatic === true) {
                    $phpcsFile->addError(
                        'Closures / anonymous functions declared as static do not have access to $this',
                        $thisFound,
                        'ThisFoundInStatic'
                    );
                }

                /*
                 * Closures only have access to $this if used within a class context.
                 */
                elseif ($this->inClassScope($phpcsFile, $stackPtr, false) === false) {
                    $phpcsFile->addWarning(
                        'Closures / anonymous functions only have access to $this if used within a class or when bound to an object using bindTo(). Please verify.',
                        $thisFound,
                        'ThisFoundOutsideClass'
                    );
                }

                $thisFound = $this->findThisUsageInClosure($phpcsFile, ($thisFound + 1), $scopeEnd);

            } while ($thisFound !== false);
        }

        // Prevent double reporting for nested closures.
        return $scopeEnd;
    }
642622
public function process(File $phpcsFile, $stackPtr)
    {
        if ($this->supportsBelow('5.4') === false) {
            return;
        }

        $tokens = $phpcsFile->getTokens();

        $open = $phpcsFile->findNext(Tokens::$emptyTokens, ($stackPtr + 1), null, true, null, true);
        if ($open === false
            || $tokens[$open]['code'] !== \T_OPEN_PARENTHESIS
            || isset($tokens[$open]['parenthesis_closer']) === false
        ) {
            return;
        }

        $close = $tokens[$open]['parenthesis_closer'];

        $nestingLevel = 0;
        if ($close !== ($open + 1) && isset($tokens[$open + 1]['nested_parenthesis'])) {
            $nestingLevel = \count($tokens[$open + 1]['nested_parenthesis']);
        }

        if ($this->isVariable($phpcsFile, ($open + 1), $close, $nestingLevel) === true) {
            return;
        }

        $phpcsFile->addError(
            'Only variables can be passed to empty() prior to PHP 5.5.',
            $stackPtr,
            'Found'
        );
    }
754807
public function process(PHP_CodeSniffer_File $phpcsFile, $stackPtr)
    {
        $tokens = $phpcsFile->getTokens();

        $beforeToken = $tokens[$stackPtr - 1];
        if ($beforeToken['code'] !== T_WHITESPACE) {
            $phpcsFile->addError('Expected 1 space before =>, 0 found', $stackPtr, 'SpaceBeforeArrow');
        } elseif ($beforeToken['content'] !== ' ') {
            $phpcsFile->addError('Expected 1 space before =>, %s found', $stackPtr, 'SpaceBeforeArrow', [strlen($beforeToken['content'])]);
        }

        $afterToken = $tokens[$stackPtr + 1];
        if ($afterToken['code'] !== T_WHITESPACE) {
            $phpcsFile->addError('Expected 1 space after =>, 0 found', $stackPtr, 'SpaceAfterArrow');
        } elseif ($afterToken['content'] !== ' ') {
            $phpcsFile->addError('Expected 1 space after =>, %s found', $stackPtr, 'SpaceAfterArrow', [strlen($afterToken['content'])]);
        }
    }
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');
		}
	}
220588
public function process(PHP_CodeSniffer_File $phpcsFile, $stackPtr)
    {
        $tokens    = $phpcsFile->getTokens();
        $errorData = [strtolower($tokens[$stackPtr]['content'])];

        if (false === isset($tokens[$stackPtr]['scope_opener']))
        {
            // @todo sort while thing...
            if ($tokens[$stackPtr]['code'] !== T_WHILE)
            {
                $error = 'Possible parse error: %s missing opening or closing brace';
                $phpcsFile->addWarning($error, $stackPtr, 'MissingBrace', $errorData);
            }

            return;
        }

        $curlyBrace  = $tokens[$stackPtr]['scope_opener'];
        $lastContent = $phpcsFile->findPrevious(T_WHITESPACE, ($curlyBrace - 1), $stackPtr, true);
        $classLine   = $tokens[$lastContent]['line'];
        $braceLine   = $tokens[$curlyBrace]['line'];

        if ($braceLine === $classLine)
        {
            $phpcsFile->recordMetric($stackPtr, 'Class opening brace placement', 'same line');
            $error = 'Opening brace of a %s must be on the line after the definition';
            $fix   = $phpcsFile->addFixableError($error, $curlyBrace, 'OpenBraceNewLine', $errorData);

            if (true === $fix)
            {
                $phpcsFile->fixer->beginChangeset();

                if (T_WHITESPACE === $tokens[($curlyBrace - 1)]['code'])
                {
                    $phpcsFile->fixer->replaceToken(($curlyBrace - 1), '');
                }

                $phpcsFile->fixer->addNewlineBefore($curlyBrace);
                $phpcsFile->fixer->endChangeset();
            }

            return;
        }
        else
        {
            $phpcsFile->recordMetric($stackPtr, 'Class opening brace placement', 'new line');

            if ($braceLine > ($classLine + 1))
            {
                $error = 'Opening brace of a %s must be on the line following the %s declaration.; Found %s line(s).';
                $data  = [
                          $tokens[$stackPtr]['content'],
                          $tokens[$stackPtr]['content'],
                          ($braceLine - $classLine - 1),
                         ];
                $fix   = $phpcsFile->addFixableError($error, $curlyBrace, 'OpenBraceWrongLine', $data);

                if (true === $fix)
                {
                    $phpcsFile->fixer->beginChangeset();

                    for ($i = ($curlyBrace - 1); $i > $lastContent; $i--)
                    {
                        if ($tokens[$i]['line'] === ($tokens[$curlyBrace]['line'] + 1))
                        {
                            break;
                        }

                        $phpcsFile->fixer->replaceToken($i, '');
                    }

                    $phpcsFile->fixer->endChangeset();
                }

                return;
            }
        }

        if ($tokens[($curlyBrace + 1)]['content'] !== $phpcsFile->eolChar)
        {
            $error = 'Opening %s brace must be on a line by itself.';
            $fix   = $phpcsFile->addFixableError($error, $curlyBrace, 'OpenBraceNotAlone', $errorData);

            if (true === $fix)
            {
                $phpcsFile->fixer->addContent($curlyBrace, $phpcsFile->eolChar);
            }
        }

        if (T_WHITESPACE === $tokens[($curlyBrace - 1)]['code'])
        {
            $prevContent = $tokens[($curlyBrace - 1)]['content'];

            if ($prevContent === $phpcsFile->eolChar)
            {
                $spaces = 0;
            }
            else
            {
                $blankSpace = substr($prevContent, strpos($prevContent, $phpcsFile->eolChar));
                $spaces     = strlen($blankSpace);
            }

            $expected = ($tokens[$stackPtr]['level'] * $this->indent);

            if ($spaces !== $expected)
            {
                $error = 'Expected %s spaces before opening brace; %s found';
                $data  = [
                          $expected,
                          $spaces,
                         ];
                $fix   = $phpcsFile->addFixableError($error, $curlyBrace, 'SpaceBeforeBrace', $data);

                if ($fix === true)
                {
                    $indent = str_repeat(' ', $expected);

                    if ($spaces === 0)
                    {
                        $phpcsFile->fixer->addContentBefore($curlyBrace, $indent);
                    }
                    else
                    {
                        $phpcsFile->fixer->replaceToken(($curlyBrace - 1), $indent);
                    }
                }
            }
        }
    }
881658
public function process(File $phpcsFile, $stackPtr)
    {
        $tokens    = $phpcsFile->getTokens();
        $prevToken = $phpcsFile->findPrevious(
            Tokens::$emptyTokens,
            ($stackPtr - 1),
            null,
            true
        );

        $expectedBlankLineCount = 1;
        $leadingLinePtr         = $this->getLeadingLinePointer($phpcsFile, $stackPtr, $prevToken);
        $blankLineCount         = ($tokens[$leadingLinePtr]['line'] - ($tokens[$prevToken]['line'] + 1));

        if (isset($tokens[$prevToken]['scope_opener']) === true && $tokens[$prevToken]['scope_opener'] === $prevToken) {
            $expectedBlankLineCount = 0;
        }

        if ($blankLineCount !== $expectedBlankLineCount) {
            $error = 'Expected %s blank line before return statement; %s found';
            $data  = array(
                      $expectedBlankLineCount,
                      $blankLineCount,
                     );
            $phpcsFile->addError($error, $stackPtr, 'BlankLineBeforeReturn', $data);
        }
    }
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), ' ');
            }
        }
    }
233242
public function process(File $phpcsFile, $stackPtr)
    {
        $tokens = $phpcsFile->getTokens();

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

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

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

        // Ignore if the next token is ELSE or ELSEIF, which means this is a IF/ELSEIF/ELSE block
        // Also, if it's a another closing bracket, this is OK, as we are closing a nesting of blocks
        if (in_array($tokens[$trailingContent]['code'], array(T_ELSE, T_ELSEIF, T_CLOSE_CURLY_BRACKET))) {
            return;
        }

        if ($tokens[$trailingContent]['line'] === ($tokens[$scopeCloser]['line'] + 1)) {
            $error = 'No blank line found after control structure';
            $phpcsFile->addError($error, $scopeCloser, 'NeedBlankLineAfterControlStruct');
        }
    }
834171
public function process(File $phpcsFile, $stackPtr)
    {
        $tokens = $phpcsFile->getTokens();

        if ($tokens[($stackPtr - 1)]['code'] === T_WHITESPACE
            && $tokens[($stackPtr - 2)]['line'] === $tokens[$stackPtr]['line']
        ) {
            $error = 'Space found before object operator';
            $fix   = $phpcsFile->addFixableError($error, $stackPtr, 'Before');
            if ($fix === true) {
                $phpcsFile->fixer->replaceToken(($stackPtr - 1), '');
            }
        }

        if ($tokens[($stackPtr + 1)]['code'] === T_WHITESPACE
            && $tokens[($stackPtr + 2)]['line'] === $tokens[$stackPtr]['line']
        ) {
            $error = 'Space found after object operator';
            $fix   = $phpcsFile->addFixableError($error, $stackPtr, 'After');
            if ($fix === true) {
                $phpcsFile->fixer->replaceToken(($stackPtr + 1), '');
            }
        }
    }
1193267
public function process(File $phpcsFile, $stackPtr)
    {
        $tokens = $phpcsFile->getTokens();
        $token  = $tokens[$stackPtr];

        // Check if the break/continue is within a valid loop structure.
        if (empty($token['conditions']) === false) {
            foreach ($token['conditions'] as $tokenCode) {
                if (isset($this->validLoopStructures[$tokenCode]) === true) {
                    return;
                }
            }
        } else {
            // Deal with older PHPCS versions.
            if (isset($token['scope_condition']) === true && isset($this->backCompat[$tokens[$token['scope_condition']]['code']]) === true) {
                return;
            }
        }

        // If we're still here, no valid loop structure container has been found, so throw an error.
        $error     = "Using '%s' outside of a loop or switch structure is invalid";
        $isError   = false;
        $errorCode = 'Found';
        $data      = array($token['content']);

        if ($this->supportsAbove('7.0')) {
            $error    .= ' and will throw a fatal error since PHP 7.0';
            $isError   = true;
            $errorCode = 'FatalError';
        }

        $this->addMessage($phpcsFile, $error, $stackPtr, $isError, $errorCode, $data);
    }
957083
public function process(PHP_CodeSniffer_File $phpcsFile, $stackPtr)
    {
        $tokens = $phpcsFile->getTokens();

        /**
         * We distinguish between the class, function and namespace names or the define statements
         */
        if ($tokens[$stackPtr]['type'] == 'T_STRING') {
            $this->processString($phpcsFile, $stackPtr, $tokens);
        } else {
            $this->processNonString($phpcsFile, $stackPtr, $tokens);
        }
    }
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);
        }

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

        $ignore = array(
                   T_DOUBLE_COLON => true,
                   T_FUNCTION     => true,
                   T_CONST        => true,
                   T_PUBLIC       => true,
                   T_PRIVATE      => true,
                   T_PROTECTED    => true,
                   T_AS           => true,
                   T_NEW          => true,
                   T_INSTEADOF    => true,
                   T_NS_SEPARATOR => true,
                   T_IMPLEMENTS   => true,
                  );

        $prevToken = $phpcsFile->findPrevious(T_WHITESPACE, ($stackPtr - 1), null, true);

        // If function call is directly preceded by a NS_SEPARATOR it points to the
        // global namespace, so we should still catch it.
        if ($tokens[$prevToken]['code'] === T_NS_SEPARATOR) {
            $prevToken = $phpcsFile->findPrevious(T_WHITESPACE, ($prevToken - 1), null, true);
            if ($tokens[$prevToken]['code'] === T_STRING) {
                // Not in the global namespace.
                return;
            }
        }

        if (isset($ignore[$tokens[$prevToken]['code']]) === true) {
            // Not a call to a PHP function.
            return;
        }

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

        if ($tokens[$stackPtr]['code'] === T_STRING && $tokens[$nextToken]['code'] !== T_OPEN_PARENTHESIS) {
            // 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->forbiddenFunctionNames,
                $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;
            }
        }//end if

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

    }
569051
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);

        $isSingleLine = $tokens[$arrayStart]['line'] === $tokens[$arrayEnd]['line'];

        $commas = DWS_Helpers_Array::commaPositions($phpcsFile, $arrayStart);

        $lastComma = array_pop($commas);
        $trailingComma = $phpcsFile->findNext(PHP_CodeSniffer_Tokens::$emptyTokens, $lastComma + 1, $arrayEnd, true) === false;

        if ($isSingleLine) {
            if ($trailingComma) {
                $phpcsFile->addError('No trailing comma allowed on single-line arrays', $lastComma, 'SingleLineTrailingComma');
            }
        } elseif (!$trailingComma) {
            $previousItem = $phpcsFile->findPrevious(PHP_CodeSniffer_Tokens::$emptyTokens, $arrayEnd - 1, $arrayStart, true);
            $phpcsFile->addError('Trailing comma required for multi-line arrays', $previousItem, 'MultiLineTrailingComma');
        }
    }
902021
public function process(PHP_CodeSniffer_File $phpcsFile, $stackPtr)
	{
		$tokens = $phpcsFile->getTokens();
		// Single space after the keyword.
		$found = 1;
		if ($tokens[($stackPtr + 1)]['code'] !== T_WHITESPACE) {
			$found = 0;
		} else if ( ! in_array($tokens[($stackPtr + 1)]['content'], [' ', $phpcsFile->eolChar])) {
			$found = strlen($tokens[($stackPtr + 1)]['content']);
		}
		if ($found !== 1) {
			$error = 'Expected 1 space after %s keyword; %s found';
			$data  = array(
				strtoupper($tokens[$stackPtr]['content']),
				$found,
			);
			$fix = $phpcsFile->addFixableError($error, $stackPtr, 'SpaceAfterKeyword', $data);
			if ($fix === true) {
				if ($found === 0) {
					$phpcsFile->fixer->addContent($stackPtr, ' ');
				} else {
					$phpcsFile->fixer->replaceToken(($stackPtr + 1), ' ');
				}
			}
		}
		// Single space after closing parenthesis.
		if (isset($tokens[$stackPtr]['parenthesis_closer']) === true
			&& isset($tokens[$stackPtr]['scope_opener']) === true
		) {
			$closer  = $tokens[$stackPtr]['parenthesis_closer'];
			$opener  = $tokens[$stackPtr]['scope_opener'];
			$content = $phpcsFile->getTokensAsString(($closer + 1), ($opener - $closer - 1));

			if (isset($content[0]) && $content[0] !== $phpcsFile->eolChar) {
				$error = 'Expected 1 new line after closing parenthesis; found "%s"';
				$data  = array(str_replace($phpcsFile->eolChar, '\n', $content));
				$fix   = $phpcsFile->addFixableError($error, $closer, 'SpaceAfterCloseParenthesis', $data);
				if ($fix === true) {
					if ($closer === ($opener - 1)) {
						$phpcsFile->fixer->addContent($closer, ' ');
					} else {
						$phpcsFile->fixer->beginChangeset();
						for ($i = ($closer + 1); $i < $opener; $i++) {
							$phpcsFile->fixer->replaceToken($i, '');
						}
						$phpcsFile->fixer->addContent($closer, ' ');
						$phpcsFile->fixer->endChangeset();
					}
				}
			}
		}//end if
		// Single newline after opening brace.
		if (isset($tokens[$stackPtr]['scope_opener']) === true) {
			$opener = $tokens[$stackPtr]['scope_opener'];
			$next   = $phpcsFile->findNext(T_WHITESPACE, ($opener + 1), null, true);
			$found  = ($tokens[$next]['line'] - $tokens[$opener]['line']);
			if ($found !== 1) {
				$error = 'Expected 1 newline after opening brace; %s found';
				$data  = array($found);
				$fix   = $phpcsFile->addFixableError($error, $opener, 'NewlineAfterOpenBrace', $data);
				if ($fix === true) {
					$phpcsFile->fixer->beginChangeset();
					for ($i = ($opener + 1); $i < $next; $i++) {
						if ($found > 0 && $tokens[$i]['line'] === $tokens[$next]['line']) {
							break;
						}
						$phpcsFile->fixer->replaceToken($i, '');
					}
					$phpcsFile->fixer->addContent($opener, $phpcsFile->eolChar);
					$phpcsFile->fixer->endChangeset();
				}
			}
		} else if ($tokens[$stackPtr]['code'] === T_WHILE) {
			// Zero spaces after parenthesis closer.
			$closer = $tokens[$stackPtr]['parenthesis_closer'];
			$found  = 0;
			if ($tokens[($closer + 1)]['code'] === T_WHITESPACE) {
				if (strpos($tokens[($closer + 1)]['content'], $phpcsFile->eolChar) !== false) {
					$found = 'newline';
				} else {
					$found = strlen($tokens[($closer + 1)]['content']);
				}
			}
			if ($found !== 0) {
				$error = 'Expected 0 spaces before semicolon; %s found';
				$data  = array($found);
				$fix   = $phpcsFile->addFixableError($error, $closer, 'SpaceBeforeSemicolon', $data);
				if ($fix === true) {
					$phpcsFile->fixer->replaceToken(($closer + 1), '');
				}
			}
		}//end if
		// Only want to check multi-keyword structures from here on.
		if ($tokens[$stackPtr]['code'] === T_TRY
			|| $tokens[$stackPtr]['code'] === T_DO
		) {
			$closer = $tokens[$stackPtr]['scope_closer'];
		} else if ($tokens[$stackPtr]['code'] === T_ELSE
			|| $tokens[$stackPtr]['code'] === T_ELSEIF
		) {
			$closer = $phpcsFile->findPrevious(T_CLOSE_CURLY_BRACKET, ($stackPtr - 1));
		} else {
			return;
		}
		// Single space after closing brace.
		$found = 1;
		if ($tokens[($closer + 1)]['code'] !== T_WHITESPACE) {
			$found = 0;
		} else if ( ! in_array($tokens[($closer + 1)]['content'], [' ', $phpcsFile->eolChar])) {
			if (strpos($tokens[($closer + 1)]['content'], $phpcsFile->eolChar) !== false) {
				$found = 'newline';
			} else {
				$found = strlen($tokens[($closer + 1)]['content']);
			}
		}
		if ($found !== 1) {
			$error = 'Expected 1 space after closing brace; %s found';
			$data  = array($found);
			$fix   = $phpcsFile->addFixableError($error, $closer, 'SpaceAfterCloseBrace', $data);
			if ($fix === true) {
				if ($found === 0) {
					$phpcsFile->fixer->addContent($closer, ' ');
				} else {
					$phpcsFile->fixer->replaceToken(($closer + 1), ' ');
				}
			}
		}
	}
657883
public function process(PHP_CodeSniffer_File $phpcsFile, $stackPtr)
    {
        $fileName = $phpcsFile->getFilename();
        if ($this->shouldIgnoreMissingNamespace($fileName)) {
            return;
        }

        $tokens = $phpcsFile->getTokens();
        $errorData = array(strtolower($tokens[$stackPtr]['content']));
        $namespace = $phpcsFile->findPrevious(T_NAMESPACE, ($stackPtr - 1));
        if ($namespace === false) {
            $error = 'Each %s must be in a namespace of at least one level (a top-level vendor name)';
            $phpcsFile->addError($error, $stackPtr, 'MissingNamespace', $errorData);
        }
    }
107165
protected function processCompact(
        PHP_CodeSniffer_File
        $phpcsFile,
        $stackPtr
    ) {
        $tokens = $phpcsFile->getTokens();
        $token  = $tokens[$stackPtr];

        $currScope = $this->findVariableScope($phpcsFile, $stackPtr);

        if (($arguments = $this->findFunctionCallArguments($phpcsFile, $stackPtr)) !== false) {
            $this->processCompactArguments($phpcsFile, $stackPtr, $arguments, $currScope);
        }
    }