diff --git a/src/Standards/PSR12/Sniffs/Files/FileHeaderSniff.php b/src/Standards/PSR12/Sniffs/Files/FileHeaderSniff.php index 8a8255cf47..c3d0d0cadc 100644 --- a/src/Standards/PSR12/Sniffs/Files/FileHeaderSniff.php +++ b/src/Standards/PSR12/Sniffs/Files/FileHeaderSniff.php @@ -188,6 +188,7 @@ public function getHeaderLines(File $phpcsFile, $stackPtr) if (isset($commentOpeners[$tokens[$docToken]['code']]) === false && isset(Tokens::$methodPrefixes[$tokens[$docToken]['code']]) === false + && $tokens[$docToken]['code'] !== T_READONLY ) { // Check for an @var annotation. $annotation = false; diff --git a/src/Standards/PSR12/Tests/Files/FileHeaderUnitTest.18.inc b/src/Standards/PSR12/Tests/Files/FileHeaderUnitTest.18.inc new file mode 100644 index 0000000000..be7c11ac91 --- /dev/null +++ b/src/Standards/PSR12/Tests/Files/FileHeaderUnitTest.18.inc @@ -0,0 +1,16 @@ +