8 use PHP_CodeSniffer\Sniffs\Sniff;
9 use PHP_CodeSniffer\Files\File;
46 private $styleCodesToSkip = [T_ASPERAND, T_COLON, T_OPEN_PARENTHESIS, T_CLOSE_PARENTHESIS];
51 public function register()
61 public function process(File $phpcsFile, $stackPtr)
63 $tokens = $phpcsFile->getTokens();
65 $numTokens = (count(
$tokens) - 2);
67 for (
$i = 1;
$i < $numTokens;
$i++) {
73 if (
$tokens[
$i][
'code'] === T_OPEN_CURLY_BRACKET) {
84 if (
$tokens[
$i][
'code'] === T_WHITESPACE) {
92 if (!($expectedIndent > 0 && strpos(
$tokens[
$i][
'content'], $phpcsFile->eolChar) !==
false)
93 && ($foundIndent !== $expectedIndent)
94 && (!in_array(
$tokens[
$i + 1][
'code'], $this->styleCodesToSkip))
96 $error =
'Line indented incorrectly; expected %s spaces, found %s';
97 $phpcsFile->addError($error,
$i,
'Incorrect', [$expectedIndent, $foundIndent]);
100 if ($indentLevel > $this->maxIndentLevel) {
process(File $phpcsFile, $stackPtr)
elseif(isset( $params[ 'redirect_parent']))