Bug Report
| Subject |
Details |
| Rector version |
v1.2.10 |
Rector removes seemingly unused properties, but which are used by get_object_vars.
Minimal PHP Code Causing Issue
class Foo implements \JsonSerializable {
public function __construct(private readonly string $foo) {
}
public function jsonSerialize(): array {
return get_object_vars($this);
}
}
Expected Behaviour
Rector should not remove property $foo here.
I would think that whenever there is a get_object_vars($this) in a class, rector should not remove any non-static properties or see them as used.
Bug Report
Rector removes seemingly unused properties, but which are used by
get_object_vars.Minimal PHP Code Causing Issue
Expected Behaviour
Rector should not remove property
$foohere.I would think that whenever there is a
get_object_vars($this)in a class, rector should not remove any non-static properties or see them as used.