diff --git a/tests/PHPStan/Rules/Properties/PropertyInClassRuleTest.php b/tests/PHPStan/Rules/Properties/PropertyInClassRuleTest.php index 6d61e5c7cc..20541e8f19 100644 --- a/tests/PHPStan/Rules/Properties/PropertyInClassRuleTest.php +++ b/tests/PHPStan/Rules/Properties/PropertyInClassRuleTest.php @@ -174,6 +174,10 @@ public function testPhp84AndReadonlyHookedProperties(): void 'Hooked properties cannot be readonly.', 19, ], + [ + 'Hooked properties cannot be readonly.', + 24, + ], ]); } diff --git a/tests/PHPStan/Rules/Properties/data/readonly-property-hooks.php b/tests/PHPStan/Rules/Properties/data/readonly-property-hooks.php index f727d148b3..f97afbb542 100644 --- a/tests/PHPStan/Rules/Properties/data/readonly-property-hooks.php +++ b/tests/PHPStan/Rules/Properties/data/readonly-property-hooks.php @@ -18,3 +18,11 @@ abstract class HiWorld { public abstract readonly string $firstName { get { return 'jake'; } set; } } + +readonly class GoodMorningWorld +{ + public string $firstName { + get => $this->firstName; + set => $this->firstName; + } +}