Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Fix beforeNormalization #132

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

Merged
ondrejmirtes merged 5 commits into phpstan:master from VincentLanglet:beforeNormalization
Feb 15, 2021

Conversation

Copy link
Contributor

@VincentLanglet VincentLanglet commented Feb 15, 2021

Related to #131 cc @ruudk

BeforeNormalization has the same behavior than validate.

This fix an issue with

->children()
 ->arrayNode('information')
 ->useAttributeAsKey('id')
 ->prototype('array')
 ->beforeNormalization()
 ->ifString()
 ->then(static function ($v) {
 return [$v];
 })
 ->end()
 ->prototype('scalar')->end()
 ->end(
Call to an undefined method Symfony\Component\Config\Definition\Builder\NodeDefinition::prototype().

I tried it on my project and it fix the error. A release after the merge could be great if you have time @ondrejmirtes :)

Copy link
Contributor

ruudk commented Feb 15, 2021
edited
Loading

Thanks for creating the PR 🙌

Could you please also add a test case in

yield ['
$arrayRootNode
->children()
->arrayNode("methods")
->prototype("scalar")
->validate()
->ifNotInArray(["one", "two"])
->thenInvalid("%s is not a valid method.")
->end()
->end()
->end()
->end()
', 'Symfony\Component\Config\Definition\Builder\ArrayNodeDefinition'];
?

Copy link
Contributor Author

I added the test

->end()
->end()
->end()
->end()
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

While you're at it, could you please fix the indentation of this test case (plus the ones above that I forgot too)? 🙏 Would make it easier to understand.

Copy link
Contributor Author

@VincentLanglet VincentLanglet Feb 15, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

Copy link
Contributor

@ruudk ruudk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great! 👏

@ondrejmirtes ondrejmirtes merged commit d986994 into phpstan:master Feb 15, 2021
Copy link
Member

Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Reviewers
2 more reviewers

@ruudk ruudk ruudk approved these changes

@OskarStark OskarStark OskarStark approved these changes

Reviewers whose approvals may not affect merge requirements
Assignees
No one assigned
Labels
None yet
Projects
None yet
Milestone
No milestone
Development

Successfully merging this pull request may close these issues.

AltStyle によって変換されたページ (->オリジナル) /