vendor/squizlabs/php_codesniffer/CodeSniffer/Standards/MySource/Sniffs/Commenting/FunctionCommentSniff.php 1 location
|
@@ 75-78 (lines=4) @@
|
| 72 |
|
|
| 73 |
|
// There needs to be a blank line before the @api tag. |
| 74 |
|
$prev = $phpcsFile->findPrevious(array(T_DOC_COMMENT_STRING, T_DOC_COMMENT_TAG), ($tag - 1)); |
| 75 |
|
if ($tokens[$prev]['line'] !== ($tokens[$tag]['line'] - 2)) { |
| 76 |
|
$error = 'There must be one blank line before the @api tag in a function comment'; |
| 77 |
|
$phpcsFile->addError($error, $tag, 'ApiSpacing'); |
| 78 |
|
} |
| 79 |
|
} else if (substr($tokens[$tag]['content'], 0, 5) === '@api-') { |
| 80 |
|
$hasApiTag = true; |
| 81 |
|
|
vendor/squizlabs/php_codesniffer/CodeSniffer/Standards/MySource/Sniffs/Objects/AssignThisSniff.php 1 location
|
@@ 84-87 (lines=4) @@
|
| 81 |
|
} |
| 82 |
|
|
| 83 |
|
// We can only assign "this" to a var called "self". |
| 84 |
|
if ($tokens[$prev]['content'] !== 'self' && $tokens[$prev]['content'] !== '_self') { |
| 85 |
|
$error = 'Keyword "this" can only be assigned to a variable called "self" or "_self"'; |
| 86 |
|
$phpcsFile->addError($error, $prev, 'NotSelf'); |
| 87 |
|
} |
| 88 |
|
|
| 89 |
|
}//end process() |
| 90 |
|
|
vendor/squizlabs/php_codesniffer/CodeSniffer/Standards/MySource/Sniffs/Objects/CreateWidgetTypeCallbackSniff.php 1 location
|
@@ 177-182 (lines=6) @@
|
| 174 |
|
if ($passedCallback === false) { |
| 175 |
|
// The first argument must be "this" or "self". |
| 176 |
|
$arg = $phpcsFile->findNext(T_WHITESPACE, ($i + 4), null, true); |
| 177 |
|
if ($tokens[$arg]['content'] !== 'this' |
| 178 |
|
&& $tokens[$arg]['content'] !== 'self' |
| 179 |
|
) { |
| 180 |
|
$error = 'The first argument passed to the callback function must be "this" or "self"'; |
| 181 |
|
$phpcsFile->addError($error, $arg, 'FirstArgNotSelf'); |
| 182 |
|
} |
| 183 |
|
} |
| 184 |
|
|
| 185 |
|
// Now it must be followed by a return statement or the end of the function. |
vendor/squizlabs/php_codesniffer/CodeSniffer/Standards/PEAR/Sniffs/Commenting/FunctionCommentSniff.php 2 locations
|
@@ 86-89 (lines=4) @@
|
| 83 |
|
return; |
| 84 |
|
} |
| 85 |
|
|
| 86 |
|
if ($tokens[$commentEnd]['line'] !== ($tokens[$stackPtr]['line'] - 1)) { |
| 87 |
|
$error = 'There must be no blank lines after the function comment'; |
| 88 |
|
$phpcsFile->addError($error, $commentEnd, 'SpacingAfter'); |
| 89 |
|
} |
| 90 |
|
|
| 91 |
|
$commentStart = $tokens[$commentEnd]['comment_opener']; |
| 92 |
|
foreach ($tokens[$commentStart]['comment_tags'] as $tag) { |
|
@@ 96-99 (lines=4) @@
|
| 93 |
|
if ($tokens[$tag]['content'] === '@see') { |
| 94 |
|
// Make sure the tag isn't empty. |
| 95 |
|
$string = $phpcsFile->findNext(T_DOC_COMMENT_STRING, $tag, $commentEnd); |
| 96 |
|
if ($string === false || $tokens[$string]['line'] !== $tokens[$tag]['line']) { |
| 97 |
|
$error = 'Content missing for @see tag in function comment'; |
| 98 |
|
$phpcsFile->addError($error, $tag, 'EmptySees'); |
| 99 |
|
} |
| 100 |
|
} |
| 101 |
|
} |
| 102 |
|
|
vendor/squizlabs/php_codesniffer/CodeSniffer/Standards/PEAR/Sniffs/Formatting/MultiLineAssignmentSniff.php 1 location
|
@@ 71-75 (lines=5) @@
|
| 68 |
|
return; |
| 69 |
|
} |
| 70 |
|
|
| 71 |
|
if ($tokens[$next]['line'] !== $tokens[$stackPtr]['line']) { |
| 72 |
|
$error = 'Multi-line assignments must have the equal sign on the second line'; |
| 73 |
|
$phpcsFile->addError($error, $stackPtr, 'EqualSignLine'); |
| 74 |
|
return; |
| 75 |
|
} |
| 76 |
|
|
| 77 |
|
// Make sure it is the first thing on the line, otherwise we ignore it. |
| 78 |
|
$prev = $phpcsFile->findPrevious(T_WHITESPACE, ($stackPtr - 1), false, true); |
vendor/squizlabs/php_codesniffer/CodeSniffer/Standards/Squiz/Sniffs/Commenting/BlockCommentSniff.php 3 locations
|
@@ 336-339 (lines=4) @@
|
| 333 |
|
if (isset($tokens[$contentBefore]['scope_closer']) === true |
| 334 |
|
&& $tokens[$contentBefore]['scope_opener'] === $contentBefore |
| 335 |
|
) { |
| 336 |
|
if (($tokens[$stackPtr]['line'] - $tokens[$contentBefore]['line']) !== 1) { |
| 337 |
|
$error = 'Empty line not required before block comment'; |
| 338 |
|
$phpcsFile->addError($error, $stackPtr, 'HasEmptyLineBefore'); |
| 339 |
|
} |
| 340 |
|
} else { |
| 341 |
|
if (($tokens[$stackPtr]['line'] - $tokens[$contentBefore]['line']) < 2) { |
| 342 |
|
$error = 'Empty line required before block comment'; |
|
@@ 340-345 (lines=6) @@
|
| 337 |
|
$error = 'Empty line not required before block comment'; |
| 338 |
|
$phpcsFile->addError($error, $stackPtr, 'HasEmptyLineBefore'); |
| 339 |
|
} |
| 340 |
|
} else { |
| 341 |
|
if (($tokens[$stackPtr]['line'] - $tokens[$contentBefore]['line']) < 2) { |
| 342 |
|
$error = 'Empty line required before block comment'; |
| 343 |
|
$phpcsFile->addError($error, $stackPtr, 'NoEmptyLineBefore'); |
| 344 |
|
} |
| 345 |
|
} |
| 346 |
|
|
| 347 |
|
$commentCloser = $commentLines[$lastIndex]; |
| 348 |
|
$contentAfter = $phpcsFile->findNext(T_WHITESPACE, ($commentCloser + 1), null, true); |
|
@@ 349-352 (lines=4) @@
|
| 346 |
|
|
| 347 |
|
$commentCloser = $commentLines[$lastIndex]; |
| 348 |
|
$contentAfter = $phpcsFile->findNext(T_WHITESPACE, ($commentCloser + 1), null, true); |
| 349 |
|
if ($contentAfter !== false && ($tokens[$contentAfter]['line'] - $tokens[$commentCloser]['line']) < 2) { |
| 350 |
|
$error = 'Empty line required after block comment'; |
| 351 |
|
$phpcsFile->addError($error, $commentCloser, 'NoEmptyLineAfter'); |
| 352 |
|
} |
| 353 |
|
|
| 354 |
|
}//end process() |
| 355 |
|
|
vendor/squizlabs/php_codesniffer/CodeSniffer/Standards/Squiz/Sniffs/Commenting/ClassCommentSniff.php 1 location
|
@@ 82-85 (lines=4) @@
|
| 79 |
|
return; |
| 80 |
|
} |
| 81 |
|
|
| 82 |
|
if ($tokens[$commentEnd]['line'] !== ($tokens[$stackPtr]['line'] - 1)) { |
| 83 |
|
$error = 'There must be no blank lines after the class comment'; |
| 84 |
|
$phpcsFile->addError($error, $commentEnd, 'SpacingAfter'); |
| 85 |
|
} |
| 86 |
|
|
| 87 |
|
$commentStart = $tokens[$commentEnd]['comment_opener']; |
| 88 |
|
foreach ($tokens[$commentStart]['comment_tags'] as $tag) { |
vendor/squizlabs/php_codesniffer/CodeSniffer/Standards/Squiz/Sniffs/Commenting/FileCommentSniff.php 2 locations
|
@@ 119-122 (lines=4) @@
|
| 116 |
|
$phpcsFile->recordMetric($stackPtr, 'File has doc comment', 'yes'); |
| 117 |
|
|
| 118 |
|
// No blank line between the open tag and the file comment. |
| 119 |
|
if ($tokens[$commentStart]['line'] > ($tokens[$stackPtr]['line'] + 1)) { |
| 120 |
|
$error = 'There must be no blank lines before the file comment'; |
| 121 |
|
$phpcsFile->addError($error, $stackPtr, 'SpacingAfterOpen'); |
| 122 |
|
} |
| 123 |
|
|
| 124 |
|
// Exactly one blank line after the file comment. |
| 125 |
|
$next = $phpcsFile->findNext(T_WHITESPACE, ($commentEnd + 1), null, true); |
|
@@ 126-129 (lines=4) @@
|
| 123 |
|
|
| 124 |
|
// Exactly one blank line after the file comment. |
| 125 |
|
$next = $phpcsFile->findNext(T_WHITESPACE, ($commentEnd + 1), null, true); |
| 126 |
|
if ($tokens[$next]['line'] !== ($tokens[$commentEnd]['line'] + 2)) { |
| 127 |
|
$error = 'There must be exactly one blank line after the file comment'; |
| 128 |
|
$phpcsFile->addError($error, $commentEnd, 'SpacingAfterComment'); |
| 129 |
|
} |
| 130 |
|
|
| 131 |
|
// Required tags in correct order. |
| 132 |
|
$required = array( |
vendor/squizlabs/php_codesniffer/CodeSniffer/Standards/Squiz/Sniffs/Commenting/VariableCommentSniff.php 2 locations
|
@@ 86-89 (lines=4) @@
|
| 83 |
|
} else if ($tokens[$tag]['content'] === '@see') { |
| 84 |
|
// Make sure the tag isn't empty. |
| 85 |
|
$string = $phpcsFile->findNext(T_DOC_COMMENT_STRING, $tag, $commentEnd); |
| 86 |
|
if ($string === false || $tokens[$string]['line'] !== $tokens[$tag]['line']) { |
| 87 |
|
$error = 'Content missing for @see tag in member variable comment'; |
| 88 |
|
$phpcsFile->addError($error, $tag, 'EmptySees'); |
| 89 |
|
} |
| 90 |
|
} else { |
| 91 |
|
$error = '%s tag is not allowed in member variable comment'; |
| 92 |
|
$data = array($tokens[$tag]['content']); |
|
@@ 112-116 (lines=5) @@
|
| 109 |
|
|
| 110 |
|
// Make sure the tag isn't empty and has the correct padding. |
| 111 |
|
$string = $phpcsFile->findNext(T_DOC_COMMENT_STRING, $foundVar, $commentEnd); |
| 112 |
|
if ($string === false || $tokens[$string]['line'] !== $tokens[$foundVar]['line']) { |
| 113 |
|
$error = 'Content missing for @var tag in member variable comment'; |
| 114 |
|
$phpcsFile->addError($error, $foundVar, 'EmptyVar'); |
| 115 |
|
return; |
| 116 |
|
} |
| 117 |
|
|
| 118 |
|
$varType = $tokens[($foundVar + 2)]['content']; |
| 119 |
|
$suggestedType = PHP_CodeSniffer::suggestType($varType); |
vendor/squizlabs/php_codesniffer/CodeSniffer/Standards/Squiz/Sniffs/ControlStructures/InlineIfDeclarationSniff.php 1 location
|
@@ 77-81 (lines=5) @@
|
| 74 |
|
} |
| 75 |
|
|
| 76 |
|
// Make sure it's all on the same line. |
| 77 |
|
if ($tokens[$statementEnd]['line'] !== $tokens[$stackPtr]['line']) { |
| 78 |
|
$error = 'Inline shorthand IF statement must be declared on a single line'; |
| 79 |
|
$phpcsFile->addError($error, $stackPtr, 'NotSingleLine'); |
| 80 |
|
return; |
| 81 |
|
} |
| 82 |
|
|
| 83 |
|
// Make sure there are spaces around the question mark. |
| 84 |
|
$contentBefore = $phpcsFile->findPrevious(T_WHITESPACE, ($stackPtr - 1), null, true); |
vendor/squizlabs/php_codesniffer/CodeSniffer/Standards/Squiz/Sniffs/ControlStructures/SwitchDeclarationSniff.php 1 location
|
@@ 193-196 (lines=4) @@
|
| 190 |
|
} |
| 191 |
|
|
| 192 |
|
$prev = $phpcsFile->findPrevious(T_WHITESPACE, ($nextBreak - 1), $stackPtr, true); |
| 193 |
|
if ($tokens[$prev]['line'] !== ($tokens[$nextBreak]['line'] - 1)) { |
| 194 |
|
$error = 'Blank lines are not allowed before case breaking statements'; |
| 195 |
|
$phpcsFile->addError($error, $nextBreak, 'SpacingBeforeBreak'); |
| 196 |
|
} |
| 197 |
|
|
| 198 |
|
$nextLine = $tokens[$tokens[$stackPtr]['scope_closer']]['line']; |
| 199 |
|
$semicolon = $phpcsFile->findEndOfStatement($nextBreak); |
vendor/squizlabs/php_codesniffer/CodeSniffer/Standards/Squiz/Sniffs/CSS/SemicolonSpacingSniff.php 1 location
|
@@ 65-69 (lines=5) @@
|
| 62 |
|
$tokens = $phpcsFile->getTokens(); |
| 63 |
|
|
| 64 |
|
$semicolon = $phpcsFile->findNext(T_SEMICOLON, ($stackPtr + 1)); |
| 65 |
|
if ($semicolon === false || $tokens[$semicolon]['line'] !== $tokens[$stackPtr]['line']) { |
| 66 |
|
$error = 'Style definitions must end with a semicolon'; |
| 67 |
|
$phpcsFile->addError($error, $stackPtr, 'NotAtEnd'); |
| 68 |
|
return; |
| 69 |
|
} |
| 70 |
|
|
| 71 |
|
if ($tokens[($semicolon - 1)]['code'] === T_WHITESPACE) { |
| 72 |
|
$length = strlen($tokens[($semicolon - 1)]['content']); |