From 0c185aeb655b8479e04ded5344d5c2f3155970a4 Mon Sep 17 00:00:00 2001 From: Jan Nedbal Date: Tue, 3 Jan 2023 13:10:55 +0100 Subject: [PATCH] EnforceReadonlyPublicPropertyRule: test for readonly class (#69) * EnforceReadonlyPublicPropertyRule: test for readonly class * bump parser and phpstan to ensure readonly class support --- composer.json | 4 ++-- .../data/EnforceReadonlyPublicPropertyRule/code.php | 12 ++++++++++++ 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/composer.json b/composer.json index 6081421..2922aeb 100644 --- a/composer.json +++ b/composer.json @@ -10,8 +10,8 @@ ], "require": { "php": "^7.4 || ^8.0", - "nikic/php-parser": "^4.13.2", - "phpstan/phpstan": "^1.8.1" + "nikic/php-parser": "^4.14.0", + "phpstan/phpstan": "^1.8.7" }, "require-dev": { "editorconfig-checker/editorconfig-checker": "^10.3.0", diff --git a/tests/Rule/data/EnforceReadonlyPublicPropertyRule/code.php b/tests/Rule/data/EnforceReadonlyPublicPropertyRule/code.php index 1d8b5a1..0aa4d23 100644 --- a/tests/Rule/data/EnforceReadonlyPublicPropertyRule/code.php +++ b/tests/Rule/data/EnforceReadonlyPublicPropertyRule/code.php @@ -28,3 +28,15 @@ class MyClass { } +readonly class MyReadonlyClass { + + public ?int $foo; + + public readonly int $bar; + + protected int $baz; + + private int $bag; + +} +