The generation is crashing easily when using array or collection.
The only way I found it works:
#[DataCollectionOf(PollOptionDto::class)]
public ?DataCollection $choices;
But if it is Collection or array, it fails both with the attribute and PhpDocs.
These are all crashing:
// This is from docs example!
#[DataCollectionOf(PollOptionDto::class)]
public ?Collection $choices;
/**
* Avoid using @var is also mentioned in docs
* @var Collection<int, PollOptionDto>
*/
public ?Collection $choices;
/**
* @property Collection<int, PollOptionDto>
*/
public ?Collection $choices;
/**
* @property Collection<int, PollOptionDto>
*/
class MyDto extends Data {
public ?Collection $choices;
}
// and the same with arrays
/**
* @property PollOptionDto[]
*/
public ?Collection $choices;
So, even if all these will fail, I recommend to update the docs to include the working example.
The generation is crashing easily when using array or collection.
The only way I found it works:
But if it is
Collection
orarray
, it fails both with the attribute and PhpDocs.These are all crashing:
So, even if all these will fail, I recommend to update the docs to include the working example.