Open
Description
Symfony version(s) affected
7.2.1
Description
If an object have static methods with same name as a property they are used to get value of this properties
How to reproduce
#[AsCommand(name: 'app:issue', description: 'Serialization issue')]
class IssueCommand extends Command
{
public function __construct(private readonly SerializerInterface $serializer)
{
parent::__construct();
}
protected function execute(InputInterface $input, OutputInterface $output): int
{
$foo = new Foo('id');
$output->writeln($this->serializer->serialize($foo, 'json'));
return Command::SUCCESS;
}
}
final readonly class Foo
{
public static function id(string $id): self
{
return new self($id);
}
public function __construct(public ?string $id = null)
{
}
}
Got Too few arguments to function App\Command\Foo::id(), 0 passed
Possible Solution
No response
Additional Context
No response