Skip to content

Commit b7604d7

Browse files
committed
PHP 8.2 | Squiz/FileComment: allow for readonly classes
Includes unit test. Ref: * https://wiki.php.net/rfc/readonly_classes
1 parent 4ee40b3 commit b7604d7

File tree

4 files changed

+15
-0
lines changed

4 files changed

+15
-0
lines changed

package.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1719,6 +1719,7 @@ http://pear.php.net/dtd/package-2.0.xsd">
17191719
<file baseinstalldir="PHP/CodeSniffer" name="FileCommentUnitTest.7.inc" role="test" />
17201720
<file baseinstalldir="PHP/CodeSniffer" name="FileCommentUnitTest.8.inc" role="test" />
17211721
<file baseinstalldir="PHP/CodeSniffer" name="FileCommentUnitTest.9.inc" role="test" />
1722+
<file baseinstalldir="PHP/CodeSniffer" name="FileCommentUnitTest.10.inc" role="test" />
17221723
<file baseinstalldir="PHP/CodeSniffer" name="FileCommentUnitTest.1.js" role="test" />
17231724
<file baseinstalldir="PHP/CodeSniffer" name="FileCommentUnitTest.1.js.fixed" role="test" />
17241725
<file baseinstalldir="PHP/CodeSniffer" name="FileCommentUnitTest.2.js" role="test" />

src/Standards/Squiz/Sniffs/Commenting/FileCommentSniff.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,7 @@ public function process(File $phpcsFile, $stackPtr)
104104
T_FINAL,
105105
T_STATIC,
106106
T_ABSTRACT,
107+
T_READONLY,
107108
T_CONST,
108109
T_PROPERTY,
109110
T_INCLUDE,
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
<?php
2+
/**
3+
* This should not be recognized as a file comment, but as a class comment.
4+
*
5+
* @package Package
6+
* @subpackage Subpackage
7+
* @author Squiz Pty Ltd <products@squiz.net>
8+
* @copyright 2010-2014 Squiz Pty Ltd (ABN 77 084 670 600)
9+
*/
10+
11+
readonly class Foo {
12+
}

src/Standards/Squiz/Tests/Commenting/FileCommentUnitTest.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ public function getErrorList($testFile='FileCommentUnitTest.inc')
4646
case 'FileCommentUnitTest.6.inc':
4747
case 'FileCommentUnitTest.7.inc':
4848
case 'FileCommentUnitTest.9.inc':
49+
case 'FileCommentUnitTest.10.inc':
4950
return [1 => 1];
5051

5152
case 'FileCommentUnitTest.5.inc':

0 commit comments

Comments
 (0)