You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Using ReflectionExtractor::getType on a property typed with ?array and an adder typed with an object incorrectly returns the type as non nullable.
This issue can lead to problems using symfony/serializer during denormalization for example, causing it to fail since the denormalizer expect the fetched type from the ReflectionExtractor to be non-nullable even when given property is properly declared as such
How to reproduce
An example using a Video class with an array of Comment class on a $comments property (phpDoc is only indicative here for clarity purposes)
class Video
{
public ?string$title = null;
/** * @var Comment[]|null */publicarray|null$comments;
privatefunctionsetTitle(?string$title): void
{
$this->title = $title;
}
privatefunctionaddComment(Comment$comment): void
{
$this->comments[] = $comment;
}
}