Skip to content

Commit cabb92a

Browse files
committed
Merge branch 'feature/squiz-doccommentalignment-readonly' of https://github.com/jrfnl/PHP_CodeSniffer
2 parents 04ca9c4 + 1043c54 commit cabb92a

File tree

4 files changed

+19
-0
lines changed

4 files changed

+19
-0
lines changed

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,7 @@ public function process(File $phpcsFile, $stackPtr)
7474
T_OBJECT => true,
7575
T_PROTOTYPE => true,
7676
T_VAR => true,
77+
T_READONLY => true,
7778
];
7879

7980
if ($nextToken === false || isset($ignore[$tokens[$nextToken]['code']]) === false) {

src/Standards/Squiz/Tests/Commenting/DocCommentAlignmentUnitTest.inc

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,14 @@ class MyClass2
7777
var $x;
7878
}
7979

80+
abstract class MyClass
81+
{
82+
/**
83+
* Property comment
84+
*/
85+
readonly public string $prop;
86+
}
87+
8088
/** ************************************************************************
8189
* Example with no errors.
8290
**************************************************************************/

src/Standards/Squiz/Tests/Commenting/DocCommentAlignmentUnitTest.inc.fixed

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,14 @@ class MyClass2
7777
var $x;
7878
}
7979

80+
abstract class MyClass
81+
{
82+
/**
83+
* Property comment
84+
*/
85+
readonly public string $prop;
86+
}
87+
8088
/** ************************************************************************
8189
* Example with no errors.
8290
**************************************************************************/

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,8 @@ public function getErrorList($testFile='DocCommentAlignmentUnitTest.inc')
4545

4646
if ($testFile === 'DocCommentAlignmentUnitTest.inc') {
4747
$errors[75] = 1;
48+
$errors[83] = 1;
49+
$errors[84] = 1;
4850
}
4951

5052
return $errors;

0 commit comments

Comments
 (0)