Closed
Description
Symfony version(s) affected
6.1.0
Description
PropertyInfo incorrectly detects collection type for types not documented in docblock since 6.1 version. Deserialization then fails with error
In ArrayDenormalizer.php line 40:
[Symfony\Component\Serializer\Exception\InvalidArgumentException]
Data expected to be an array, int given.
This is because before, ConstructorExtractor has been called, but now this is no longer the case. Now, PhpstanExtractor is called, which resolves types documented in phpdoc only. I've checked a bit why is this the case and looks like on 6.0, this line is triggered
, while on 6.1 it isn't. But looks like real issue is that PhpStanExtractor is not returning null ingetDocBlockFromProperty
for such (non-documented) properties.
How to reproduce
deserialize
{"id": 1, "variations": []}
into
namespace Haushalt\Bl\DomainBundle\Domain\Product\Entity;
final class Product
{
/**
* @param \stdClass[] $variations
*/
public function __construct(
public int $id,
public array $variations,
) {
}
public function getId(): int
{
return $this->id;
}
}
Possible Solution
No response
Additional Context
No response