-
-
Notifications
You must be signed in to change notification settings - Fork 742
Closed
rectorphp/rector-src
#6758Labels
Description
Bug Report
| Subject | Details |
|---|---|
| Rector version | last dev-main |
| Installed as | composer dependency |
Minimal PHP Code Causing Issue
See https://getrector.com/demo/03e2e9fb-45b2-4e79-a30f-ef479e20bd5b
<?php
declare(strict_types=1);
final class Foo
{
private int $propertyHook {
get => random_int(1, 100);
set => 1;
}
public function bar(): int
{
return $this->propertyHook * 1000;
}
}Responsible rules
ReadOnlyPropertyRectorReadOnlyClassRector
Expected Behavior
ReadOnlyPropertyRector rule should not set readonly for property hooks
From documentation
Property hooks are incompatible with readonly properties. If there is a need to restrict access to a get or set operation in addition to altering its behavior, use asymmetric property visibility.
Reactions are currently unavailable