-
-
Notifications
You must be signed in to change notification settings - Fork 737
Closed
rectorphp/rector-src
#6736Labels
Description
Bug Report
Rector adds a default value on a property hook.
| Subject | Details |
|---|---|
| Rector version | last dev-main |
| Installed as | composer dependency |
Minimal PHP Code Causing Issue
See https://getrector.com/demo/e5dc1994-dc4a-4476-87fb-ec080ca08736
<?php
declare(strict_types=1);
interface Foo
{
public ?string $bar { get; }
}
final class FooImpl implements Foo
{
public ?string $bar {
get => 'bar';
}
}Responsible rules
RestoreDefaultNullToNullableTypePropertyRector
Expected Behavior
Rector should not set a default value on a hooked property. As detected by PHPStan:
phpstan: Virtual hooked properties cannot have a default value
Reactions are currently unavailable