vendor/squizlabs/php_codesniffer/CodeSniffer/Standards/PEAR/Sniffs/Classes/ClassDeclarationSniff.php 1 location
|
@@ 142-158 (lines=17) @@
|
| 139 |
|
} |
| 140 |
|
|
| 141 |
|
$expected = ($tokens[$stackPtr]['level'] * $this->indent); |
| 142 |
|
if ($spaces !== $expected) { |
| 143 |
|
$error = 'Expected %s spaces before opening brace; %s found'; |
| 144 |
|
$data = array( |
| 145 |
|
$expected, |
| 146 |
|
$spaces, |
| 147 |
|
); |
| 148 |
|
|
| 149 |
|
$fix = $phpcsFile->addFixableError($error, $curlyBrace, 'SpaceBeforeBrace', $data); |
| 150 |
|
if ($fix === true) { |
| 151 |
|
$indent = str_repeat(' ', $expected); |
| 152 |
|
if ($spaces === 0) { |
| 153 |
|
$phpcsFile->fixer->addContentBefore($curlyBrace, $indent); |
| 154 |
|
} else { |
| 155 |
|
$phpcsFile->fixer->replaceToken(($curlyBrace - 1), $indent); |
| 156 |
|
} |
| 157 |
|
} |
| 158 |
|
} |
| 159 |
|
}//end if |
| 160 |
|
|
| 161 |
|
}//end process() |
vendor/squizlabs/php_codesniffer/CodeSniffer/Standards/PEAR/Sniffs/ControlStructures/MultiLineConditionSniff.php 1 location
|
@@ 171-187 (lines=17) @@
|
| 168 |
|
$foundIndent = strlen($tokens[$i]['content']); |
| 169 |
|
} |
| 170 |
|
|
| 171 |
|
if ($expectedIndent !== $foundIndent) { |
| 172 |
|
$error = 'Multi-line IF statement not indented correctly; expected %s spaces but found %s'; |
| 173 |
|
$data = array( |
| 174 |
|
$expectedIndent, |
| 175 |
|
$foundIndent, |
| 176 |
|
); |
| 177 |
|
|
| 178 |
|
$fix = $phpcsFile->addFixableError($error, $i, 'Alignment', $data); |
| 179 |
|
if ($fix === true) { |
| 180 |
|
$spaces = str_repeat(' ', $expectedIndent); |
| 181 |
|
if ($foundIndent === 0) { |
| 182 |
|
$phpcsFile->fixer->addContentBefore($i, $spaces); |
| 183 |
|
} else { |
| 184 |
|
$phpcsFile->fixer->replaceToken($i, $spaces); |
| 185 |
|
} |
| 186 |
|
} |
| 187 |
|
} |
| 188 |
|
|
| 189 |
|
$next = $phpcsFile->findNext(PHP_CodeSniffer_Tokens::$emptyTokens, $i, null, true); |
| 190 |
|
if ($next !== $closeBracket) { |
vendor/squizlabs/php_codesniffer/CodeSniffer/Standards/PEAR/Sniffs/Functions/FunctionDeclarationSniff.php 1 location
|
@@ 353-369 (lines=17) @@
|
| 350 |
|
$foundIndent = strlen($tokens[$i]['content']); |
| 351 |
|
} |
| 352 |
|
|
| 353 |
|
if ($expectedIndent !== $foundIndent) { |
| 354 |
|
$error = 'Multi-line function declaration not indented correctly; expected %s spaces but found %s'; |
| 355 |
|
$data = array( |
| 356 |
|
$expectedIndent, |
| 357 |
|
$foundIndent, |
| 358 |
|
); |
| 359 |
|
|
| 360 |
|
$fix = $phpcsFile->addFixableError($error, $i, 'Indent', $data); |
| 361 |
|
if ($fix === true) { |
| 362 |
|
$spaces = str_repeat(' ', $expectedIndent); |
| 363 |
|
if ($foundIndent === 0) { |
| 364 |
|
$phpcsFile->fixer->addContentBefore($i, $spaces); |
| 365 |
|
} else { |
| 366 |
|
$phpcsFile->fixer->replaceToken($i, $spaces); |
| 367 |
|
} |
| 368 |
|
} |
| 369 |
|
} |
| 370 |
|
|
| 371 |
|
$lastLine = $tokens[$i]['line']; |
| 372 |
|
}//end if |
vendor/squizlabs/php_codesniffer/CodeSniffer/Standards/PEAR/Sniffs/WhiteSpace/ObjectOperatorIndentSniff.php 1 location
|
@@ 144-160 (lines=17) @@
|
| 141 |
|
$foundIndent = 0; |
| 142 |
|
} |
| 143 |
|
|
| 144 |
|
if ($foundIndent !== $requiredIndent) { |
| 145 |
|
$error = 'Object operator not indented correctly; expected %s spaces but found %s'; |
| 146 |
|
$data = array( |
| 147 |
|
$requiredIndent, |
| 148 |
|
$foundIndent, |
| 149 |
|
); |
| 150 |
|
|
| 151 |
|
$fix = $phpcsFile->addFixableError($error, $next, 'Incorrect', $data); |
| 152 |
|
if ($fix === true) { |
| 153 |
|
$spaces = str_repeat(' ', $requiredIndent); |
| 154 |
|
if ($foundIndent === 0) { |
| 155 |
|
$phpcsFile->fixer->addContentBefore($next, $spaces); |
| 156 |
|
} else { |
| 157 |
|
$phpcsFile->fixer->replaceToken(($next - 1), $spaces); |
| 158 |
|
} |
| 159 |
|
} |
| 160 |
|
} |
| 161 |
|
}//end if |
| 162 |
|
|
| 163 |
|
// It cant be the last thing on the line either. |
vendor/squizlabs/php_codesniffer/CodeSniffer/Standards/PSR2/Sniffs/Classes/ClassDeclarationSniff.php 1 location
|
@@ 319-334 (lines=16) @@
|
| 316 |
|
} |
| 317 |
|
|
| 318 |
|
$expected = ($classIndent + $this->indent); |
| 319 |
|
if ($found !== $expected) { |
| 320 |
|
$error = 'Expected %s spaces before interface name; %s found'; |
| 321 |
|
$data = array( |
| 322 |
|
$expected, |
| 323 |
|
$found, |
| 324 |
|
); |
| 325 |
|
$fix = $phpcsFile->addFixableError($error, $className, 'InterfaceWrongIndent', $data); |
| 326 |
|
if ($fix === true) { |
| 327 |
|
$padding = str_repeat(' ', $expected); |
| 328 |
|
if ($found === 0) { |
| 329 |
|
$phpcsFile->fixer->addContent($prev, $padding); |
| 330 |
|
} else { |
| 331 |
|
$phpcsFile->fixer->replaceToken($prev, $padding); |
| 332 |
|
} |
| 333 |
|
} |
| 334 |
|
} |
| 335 |
|
}//end if |
| 336 |
|
} else if ($tokens[($className - 1)]['code'] !== T_NS_SEPARATOR |
| 337 |
|
|| $tokens[($className - 2)]['code'] !== T_STRING |
vendor/squizlabs/php_codesniffer/CodeSniffer/Standards/Squiz/Sniffs/CSS/IndentationSniff.php 1 location
|
@@ 132-148 (lines=17) @@
|
| 129 |
|
$phpcsFile->fixer->replaceToken($i, ''); |
| 130 |
|
} |
| 131 |
|
} |
| 132 |
|
} else if ($foundIndent !== $expectedIndent) { |
| 133 |
|
$error = 'Line indented incorrectly; expected %s spaces, found %s'; |
| 134 |
|
$data = array( |
| 135 |
|
$expectedIndent, |
| 136 |
|
$foundIndent, |
| 137 |
|
); |
| 138 |
|
|
| 139 |
|
$fix = $phpcsFile->addFixableError($error, $i, 'Incorrect', $data); |
| 140 |
|
if ($fix === true) { |
| 141 |
|
$indent = str_repeat(' ', $expectedIndent); |
| 142 |
|
if ($foundIndent === 0) { |
| 143 |
|
$phpcsFile->fixer->addContentBefore($i, $indent); |
| 144 |
|
} else { |
| 145 |
|
$phpcsFile->fixer->replaceToken($i, $indent); |
| 146 |
|
} |
| 147 |
|
} |
| 148 |
|
}//end if |
| 149 |
|
}//end for |
| 150 |
|
|
| 151 |
|
}//end process() |
vendor/squizlabs/php_codesniffer/CodeSniffer/Standards/Squiz/Sniffs/PHP/EmbeddedPhpSniff.php 1 location
|
@@ 167-182 (lines=16) @@
|
| 164 |
|
} |
| 165 |
|
|
| 166 |
|
$contentColumn = ($tokens[$firstContent]['column'] - 1); |
| 167 |
|
if ($contentColumn !== $indent) { |
| 168 |
|
$error = 'First line of embedded PHP code must be indented %s spaces; %s found'; |
| 169 |
|
$data = array( |
| 170 |
|
$indent, |
| 171 |
|
$contentColumn, |
| 172 |
|
); |
| 173 |
|
$fix = $phpcsFile->addFixableError($error, $firstContent, 'Indent', $data); |
| 174 |
|
if ($fix === true) { |
| 175 |
|
$padding = str_repeat(' ', $indent); |
| 176 |
|
if ($contentColumn === 0) { |
| 177 |
|
$phpcsFile->fixer->addContentBefore($firstContent, $padding); |
| 178 |
|
} else { |
| 179 |
|
$phpcsFile->fixer->replaceToken(($firstContent - 1), $padding); |
| 180 |
|
} |
| 181 |
|
} |
| 182 |
|
} |
| 183 |
|
}//end if |
| 184 |
|
}//end if |
| 185 |
|
|