-
-
Notifications
You must be signed in to change notification settings - Fork 9.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Config] Provide shorthand methods for ArrayNodeDefinition::prototype() #20921
Labels
Comments
skafandri
added a commit
to skafandri/symfony
that referenced
this issue
Dec 14, 2016
…ion::prototype()
skafandri
added a commit
to skafandri/symfony
that referenced
this issue
Dec 14, 2016
skafandri
added a commit
to skafandri/symfony
that referenced
this issue
Dec 14, 2016
skafandri
added a commit
to skafandri/symfony
that referenced
this issue
Dec 15, 2016
I think it's too much verbosity. 100 lines of code only for ide support is too much. /**
* Sets a prototype for child nodes.
*
* @param string $type the type of node
*
* @return IntergerDefinition|ArrayDefinition| ScalarNodeDefinition // you get the point
*/
public function prototype($type)
{
... but again, you would need to support those comments, if any |
fabpot
pushed a commit
that referenced
this issue
Dec 19, 2016
fabpot
added a commit
that referenced
this issue
Dec 19, 2016
…eDefinition::pr… (skafandri) This PR was squashed before being merged into the 3.3-dev branch (closes #20923). Discussion ---------- #20921 [Config] Provide shorthand methods for ArrayNodeDefinition::pr… | Q | A | ------------- | --- | Branch? | master | Bug fix? | no | New feature? | yes | BC breaks? | no | Deprecations? | no | Tests pass? | yes | Fixed tickets | #20921 | License | MIT Commits ------- 22b8490 #20921 [Config] Provide shorthand methods for ArrayNodeDefinition::pr…
Merged
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
ArrayNodeDefinition::prototype() returns a
NodeDefinition
. However in reality it returns anIntegerNodeDefinition
,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 annoyingI 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
As a result, your IDE will recognize that it returns
NumericNodeDefinition
and can follow the call.The text was updated successfully, but these errors were encountered: