Run Rector on your code to see what it can do for you:
<?php readonly class Foo { - public function __construct(private string $foo) { - } - public function toArray(): array { return get_object_vars($this); } }
Applied Rules:
Not a change you expect?
rector.php