Skip to content

Commit

Permalink
PHP 8.2 | PEAR/FileComment: allow for readonly classes
Browse files Browse the repository at this point in the history
  • Loading branch information
jrfnl committed May 18, 2023
1 parent 39b1956 commit af87457
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 2 deletions.
1 change: 1 addition & 0 deletions package.xml
Original file line number Diff line number Diff line change
Expand Up @@ -1077,6 +1077,7 @@ http://pear.php.net/dtd/package-2.0.xsd">
<file baseinstalldir="PHP/CodeSniffer" name="FileCommentUnitTest.1.inc" role="test" />
<file baseinstalldir="PHP/CodeSniffer" name="FileCommentUnitTest.2.inc" role="test" />
<file baseinstalldir="PHP/CodeSniffer" name="FileCommentUnitTest.3.inc" role="test" />
<file baseinstalldir="PHP/CodeSniffer" name="FileCommentUnitTest.4.inc" role="test" />
<file baseinstalldir="PHP/CodeSniffer" name="FileCommentUnitTest.php" role="test" />
<file baseinstalldir="PHP/CodeSniffer" name="FunctionCommentUnitTest.inc" role="test" />
<file baseinstalldir="PHP/CodeSniffer" name="FunctionCommentUnitTest.inc.fixed" role="test" />
Expand Down
1 change: 1 addition & 0 deletions src/Standards/PEAR/Sniffs/Commenting/FileCommentSniff.php
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,7 @@ public function process(File $phpcsFile, $stackPtr)
T_FINAL,
T_STATIC,
T_ABSTRACT,
T_READONLY,
T_CONST,
T_PROPERTY,
];
Expand Down
7 changes: 7 additions & 0 deletions src/Standards/PEAR/Tests/Commenting/FileCommentUnitTest.4.inc
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<?php
/**
* This should not be recognized as a file comment, but as a class comment.
*/

readonly class Foo {
}
3 changes: 1 addition & 2 deletions src/Standards/PEAR/Tests/Commenting/FileCommentUnitTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -48,9 +48,8 @@ public function getErrorList($testFile='FileCommentUnitTest.inc')
];

case 'FileCommentUnitTest.2.inc':
return [1 => 1];

case 'FileCommentUnitTest.3.inc':
case 'FileCommentUnitTest.4.inc':
return [1 => 1];

default:
Expand Down

0 comments on commit af87457

Please sign in to comment.