'Upgrade symfony 5.2 to 5.3 - serializer array of objects not working

After upgrade Symfony project from 5.2 to 5.3, the serializer not working properly.

Example classes:

class A {
    public int $number;
}

class ParentDTO {
    /**
     * @var A[]|array
     */
    public array $a;
}

Example input:

{
  "a": [
    {
      "number": 1
    },
    {
      "number": 2
    }
  ]
}

Symfony 5.2.* output: "a" is an array of objects - correct

Symfony 5.3.* output: "a" is an array of array - not correct

Any idea what should I do?



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source