Closed as duplicate of#60795
Closed as duplicate of#60795
Description
Symfony version(s) affected
7.3.0
Description
I'm migrating from Symfony 6.4 to 7.3 and my classes are not correctly deserializing after the upgrade due to the fact that I'm having my types hinted in @var
PHPDoc segments instead of one single block with @param
.
This doesn't work anymore (emails
are deserialized into an array of plain PHP array
s):
class ContactDto {
public function __construct(
/** @var ContactEmailDto[] */
protected ?array $emails = null,
)
{
}
}
but it starts working once I change it to:
class ContactDto {
/**
* @param ContactEmailDto[]|null $emails
*/
public function __construct(
protected ?array $emails = null,
)
{
}
}
I don't see any valid reason for dropping support of @var
How to reproduce
- Create a dummy class similar to
class ContactDto {
public function __construct(
/** @var ContactEmailDto[] */
protected ?array $emails = null,
)
{
}
}
- Try to deserialize it and see that the
emails
were deserialized into an array of plain PHP arrays instead of instances ofContactEmailDto
Possible Solution
No response
Additional Context
No response