Skip to content

Commit 358c476

Browse files
committed
PHP 8.2 | Squiz/LowercaseClassKeywords: add support for readonly classes/properties
Includes unit test. Ref: * https://wiki.php.net/rfc/readonly_properties_v2 * https://wiki.php.net/rfc/readonly_classes
1 parent 3f7b9ba commit 358c476

File tree

4 files changed

+4
-2
lines changed

4 files changed

+4
-2
lines changed

src/Standards/Squiz/Sniffs/Classes/LowercaseClassKeywordsSniff.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ public function register()
2929
$targets[] = T_IMPLEMENTS;
3030
$targets[] = T_ABSTRACT;
3131
$targets[] = T_FINAL;
32+
$targets[] = T_READONLY;
3233
$targets[] = T_VAR;
3334
$targets[] = T_CONST;
3435

src/Standards/Squiz/Tests/Classes/LowercaseClassKeywordsUnitTest.inc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ Interface MyInterface {}
55
Trait MyTrait {}
66
Enum MyEnum IMPLEMENTS Colorful {}
77

8-
class MyClass
8+
ReadOnly class MyClass
99
{
1010
Var $myVar = null;
1111
Const myConst = true;

src/Standards/Squiz/Tests/Classes/LowercaseClassKeywordsUnitTest.inc.fixed

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ interface MyInterface {}
55
trait MyTrait {}
66
enum MyEnum implements Colorful {}
77

8-
class MyClass
8+
readonly class MyClass
99
{
1010
var $myVar = null;
1111
const myConst = true;

src/Standards/Squiz/Tests/Classes/LowercaseClassKeywordsUnitTest.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ public function getErrorList()
3131
4 => 1,
3232
5 => 1,
3333
6 => 2,
34+
8 => 1,
3435
10 => 1,
3536
11 => 1,
3637
14 => 1,

0 commit comments

Comments
 (0)