Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions coder_sniffer/Drupal/Sniffs/Files/LineLengthSniff.php
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,11 @@ class LineLengthSniff extends GenericLineLengthSniff
protected function checkLineLength($phpcsFile, $tokens, $stackPtr)
{
if (isset(Tokens::$commentTokens[$tokens[($stackPtr - 1)]['code']]) === true) {
// Allow any PHPCS ignore comments to exceed the 80 character limit.
if (isset(Tokens::$phpcsCommentTokens[$tokens[($stackPtr - 1)]['code']]) === true) {
return;
}

$docCommentTag = $phpcsFile->findFirstOnLine(T_DOC_COMMENT_TAG, ($stackPtr - 1));
if ($docCommentTag !== false) {
// Allow doc comment tags such as long @param tags to exceed the 80
Expand Down
11 changes: 10 additions & 1 deletion tests/Drupal/Files/LineLengthUnitTest.inc
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,13 @@

function foo() {
echo 'test';
}//end foo()
}//end foo()

class Test {

/**
* The search score.
*/
public string $search_score; // phpcs:ignore Drupal.NamingConventions.ValidVariableName.LowerCamelName

}
Loading