Closed
Description
Q | A |
---|---|
Bug report? | no |
Feature request? | yes |
BC Break report? | no |
RFC? | no |
Symfony version | ? |
Currenly PhpDocExtractor works only with class properties. It's not possible to clarify the type of the constructor parameter through docblock comment.
class A
{
private $b;
/**
* @param B[] $b
*/
public function __construct(array $b)
{
$this->b = $b;
}
public function getB()
{
return $this->b;
}
}
class B
{
private $c;
public function __construct($c)
{
$this->c = $c;
}
public function getC()
{
return $this->c;
}
}
$a = $serializer->denormalize(['b' => [['c' => 1], ['c' => 2], ['c' => 3]]], A::class);
print_r($a);
Expected result:
App\A Object
(
[b:App\A:private] => Array
(
[0] => App\B Object
(
[c:App\B:private] => 1
)
[1] => App\B Object
(
[c:App\B:private] => 2
)
[2] => App\B Object
(
[c:App\B:private] => 3
)
)
)
Actual result:
App\A Object
(
[b:App\A:private] => Array
(
[0] => Array
(
[c] => 1
)
[1] => Array
(
[c] => 2
)
[2] => Array
(
[c] => 3
)
)
)