Skip to content

Commit 52ab8ea

Browse files
jrfnlgsherwood
authored andcommitted
PHP 8.2 | Squiz/FileComment: allow for readonly classes
Includes unit test. Ref: * https://wiki.php.net/rfc/readonly_classes
1 parent 8b48843 commit 52ab8ea

File tree

3 files changed

+14
-0
lines changed

3 files changed

+14
-0
lines changed

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,7 @@ public function process(File $phpcsFile, $stackPtr)
9494
T_FINAL,
9595
T_STATIC,
9696
T_ABSTRACT,
97+
T_READONLY,
9798
T_CONST,
9899
T_PROPERTY,
99100
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 <[email protected]>
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
@@ -45,6 +45,7 @@ public function getErrorList($testFile='FileCommentUnitTest.inc')
4545
case 'FileCommentUnitTest.6.inc':
4646
case 'FileCommentUnitTest.7.inc':
4747
case 'FileCommentUnitTest.9.inc':
48+
case 'FileCommentUnitTest.10.inc':
4849
return [1 => 1];
4950

5051
case 'FileCommentUnitTest.5.inc':

0 commit comments

Comments
 (0)