diff --git a/coder_sniffer/Drupal/Sniffs/Files/LineLengthSniff.php b/coder_sniffer/Drupal/Sniffs/Files/LineLengthSniff.php index e959ceed50af5533991bf670aba2a0a2a977be0e..48210712e0cc32ff032f125c347214aba679f423 100644 --- a/coder_sniffer/Drupal/Sniffs/Files/LineLengthSniff.php +++ b/coder_sniffer/Drupal/Sniffs/Files/LineLengthSniff.php @@ -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 diff --git a/tests/Drupal/Files/LineLengthUnitTest.inc b/tests/Drupal/Files/LineLengthUnitTest.inc index 8c0daabcc3ec32a85aa560013dfd40a672dc3fed..9a96802aa1c9c13368bf9dd83c6b238502f70ff9 100644 --- a/tests/Drupal/Files/LineLengthUnitTest.inc +++ b/tests/Drupal/Files/LineLengthUnitTest.inc @@ -2,4 +2,13 @@ function foo() { echo 'test'; -}//end foo() \ No newline at end of file +}//end foo() + +class Test { + + /** + * The search score. + */ + public string $search_score; // phpcs:ignore Drupal.NamingConventions.ValidVariableName.LowerCamelName + +}