Skip to content

[DependencyInjection] Allow trimming service parameters value in XML configuration files #49412

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
Feb 21, 2023

Conversation

alexandre-daubois
Copy link
Member

Q A
Branch? 6.3
Bug fix? no
New feature? yes
Deprecations? no
Tickets NA
License MIT
Doc PR Todo

While coming across this documentation page, I learnt that strings as service parameters value aren't trimmed when using the XML multi-line style to define the value. I think adding the possibility of trimming the value if wanted could be a plus, allowing more flexibility when writing XML files.

Also, when using the binary parameter type, base64_decode actually trims the string and allows to use the multi-line syntax. So we could see an added consistency here by allowing this with string parameters. 🙂

@alexandre-daubois alexandre-daubois force-pushed the xml-trim-values branch 2 times, most recently from 35ffcde to 06b2f39 Compare February 17, 2023 09:38
@@ -258,6 +258,7 @@
<xsd:attribute name="id" type="xsd:string" />
<xsd:attribute name="key" type="xsd:string" />
<xsd:attribute name="on-invalid" type="invalid_sequence" />
<xsd:attribute name="trim" type="boolean" />
Copy link
Member

Choose a reason for hiding this comment

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

boolean is a type that support both xsd:boolean and DIC parameters as value. This trim should not support DI parameters as it is a value used by the loader directly.

Copy link
Member

Choose a reason for hiding this comment

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

depends whether DIC parameters work there or no.

Copy link
Member Author

Choose a reason for hiding this comment

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

I tried and it doesn't work. I'll leave xsd:boolean for exclude-self as well 👍

@nicolas-grekas
Copy link
Member

Thank you @alexandre-daubois.

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.

4 participants