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

Bastian Waidelich bastian at typo3.org
Fri Feb 27 11:05:11 CET 2015


On 06.02.15, at 08:43, Christian Müller wrote:

Hi Christian,

> I am currently against doing that, for the following reasons

Good points and I agree.
But there are cases where this IDE support is a tremendous help (usage 
reference, refactoring, less typos, better readability than inline @var 
annotations, ...).

> - We need to use development resources to adapt Flow to understand this
> format (Reflection, PropertyMapping etc.)

True, but maybe it's worth putting some effort into supporting this 
syntax *in addition*.


> - We don't have a good solution for Collection types, so they would most
> probably end up with a different syntax

For collections (i.e. "generics") we already use
Collection<ElementType>

And I think that's perfectly fine (it would be even better if IDEs like 
PhpStorm would support that syntax, too and there are similar feature 
requests [1]).


> - IMHO it's syntactically crappy to read ("User in Array" vs. "Array of
> User")

So for "User[]" you read "User in Array"?
I think it's probably a matter of getting used to.


What do you think about the following:
We don't change the CGL in that regard but we're free to use the 
"array-syntax" if it increases readability. In addition I'll try to add 
reflection/property mapping support for it so that it *could* be used in 
action arguments and injections too!?

[1] https://youtrack.jetbrains.com/issue/WI-6558

-- 
Bastian Waidelich


More information about the Flow mailing list