[Flow] [RFC] CGL: Allow "ArrayElementType[]" syntax

Adrian Föder adrian at foeder.de
Thu Feb 5 17:14:25 CET 2015


I would also second that; but that might lead into "usability" trouble 
with the property mapper. Developers would need a rather good Flow 
knowledge of when the property mapper is used, hence which "annotation 
style" has to be done.

Currently, the property mapper checks for an annotation style like

```
@var \Doctrine\Common\Collections\Collection<\Acme\Shop\Domain\Model\Category>
```

The IDE friendly variant would be

```
@var \Doctrine\Common\Collections\Collection|\Acme\Shop\Domain\Model\Category[]
```

(note the OR-pipe between the two hints and the array brackets at the 
end) At least that's the way how PhpStorm would work.

IF we allow that in the CGL we almost *must* adjust the property mapper 
to support that format, too. Should be not that hard, though. If 
there's only one annotation, ending with the brackets, an array is 
expected as top-level type, and if there's a hint with a bracket in 
OR-conjunction with a collection, that collection is used as top level 
type.

WDYT?

-Adrian



More information about the Flow mailing list