Closed
Description
Q | A |
---|---|
Bug report? | no |
Feature request? | yes |
BC Break report? | no |
RFC? | yes |
Symfony version | master |
ArrayNodeDefinition::prototype() returns a NodeDefinition
. However in reality it returns an IntegerNodeDefinition
, ArrayNodeDefinition
and so on.
This makes the last line of the following code ->max(10)
not recognizable by IDEs and with a bit TreeBuilder is can become annoying
$node = new ArrayNodeDefinition('name');
$node
->prototype('integer')
->max(10);
I propose to provide shorthand methods for the standard node types (variable, scalar, boolean, integer, float, array, enum)
So the previous snippet could be written as
$node = new ArrayNodeDefinition('name');
$node
->prototypeInteger()
->max(10);
As a result, your IDE will recognize that it returns NumericNodeDefinition
and can follow the call.