Skip to content

[FrameworkBundle] Configuration : Fix !php/const syntax in yaml #18761

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
merged 1 commit into from
Aug 28, 2023

Conversation

ppelisset
Copy link
Contributor

Hello,

I would like to suggest a correction for the FrameworkBundle configuration documentation. In a configuration example, the Yaml syntax to use the value of a PHP constant as a key is incorrect. Indeed, in Symfony's Yaml parser source code, only unquoted scalars are evaluated. Therefore, the configuration key should not be enclosed in quotes for the example to work.

Please feel free to question me if you need any further information.

@ppelisset
Copy link
Contributor Author

The CI seems to be in error because in the code block checker, the parsing of Yaml is done without the Yaml::PARSE_CONSTANT flag, unlike what is done when parsing Yaml files in the Configuration Loader.

In code-block-checker :
https://github.com/symfony-tools/code-block-checker/blob/main/src/Service/CodeValidator/YamlValidator.php#L22

In Symfony YamlLoader :
https://github.com/symfony/symfony/blob/6.4/src/Symfony/Component/DependencyInjection/Loader/YamlFileLoader.php#L778

@OskarStark OskarStark requested a review from xabbuh August 17, 2023 16:39
@ppelisset
Copy link
Contributor Author

I just submit a small PR in code-block-checker to fix the problem: symfony-tools/code-block-checker#49

@ppelisset ppelisset changed the base branch from 6.4 to 5.4 August 18, 2023 09:18
@OskarStark
Copy link
Contributor

I released the code block checker 0.3.0, can you please rebase your PR, to verify the CI is back green? Thanks

Quoted scalar is not evaluated
@ppelisset
Copy link
Contributor Author

I've just done it, everything seems to be fine now.

@javiereguiluz
Copy link
Member

Pierre, this was a very good catch and a great first contribution. Thanks a lot for your patience during the review and for fixing the Symfony Tools issue too. Thanks also to reviewers.

Finally, congrats on your first Symfony Docs contribution 🎉

@javiereguiluz javiereguiluz modified the milestones: 6.4, 5.4 Aug 28, 2023
@javiereguiluz javiereguiluz merged commit 87f58a9 into symfony:5.4 Aug 28, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants