Movatterモバイル変換


[0]ホーム

URL:


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

[Validator] Deprecate XML configuration format#61288

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Conversation

@MatTheCat
Copy link
Contributor

QA
Branch?7.4
Bug fix?no
New feature?no
Deprecations?yes
IssuesN/A
LicenseMIT

Split from#60568

@MatTheCat
Copy link
ContributorAuthor

high-deps failure seems related to#61101; how could it be fixed?

@MatTheCatMatTheCatforce-pushed thedeprecate_validator_xml_loader branch 2 times, most recently fromd89cbc6 to2efe806CompareAugust 3, 2025 12:00
@xabbuh
Copy link
Member

As written in#60568 (comment) I don't think it's worth doing this for the Validator component. Maintaining theXmlFileLoader is not much work.

@javiereguiluz@OskarStark@wouterj Do you think getting rid of the XML format would make the life for Symfony docs that much easier that dropping support for it would be worth it?

@alexandre-daubois
Copy link
Member

Writing XML config in the docs was a real pain until Copilot is a thing. Last time I checked, Copilot (and other tools) are extremely efficient for that.

@stof
Copy link
Member

I think this might be too early to do that deprecation in 7.4, as the suggested replacement API (#61528) will be shipped only in 7.4 as well. This would make it hard for bundles to migrate to the new API while keeping support for multiple Symfony versions.

I suggest delaying that deprecation until some 8.x release (the maintenance cost of this XmlFileLoader is not an issue regarding maintaining it for 2 more years IMO, as it has basically not changed since years)

nicolas-grekas added a commit that referenced this pull requestSep 3, 2025
…time constraint metadata (nicolas-grekas)This PR was merged into the 7.4 branch.Discussion----------[Validator] Allow using attributes to declare compile-time constraint metadata| Q             | A| ------------- | ---| Branch?       | 7.4| Bug fix?      | no| New feature?  | yes| Deprecations? | no| Issues        | -| License       | MITPrerequisite for#61288At the moment, validation attributes are read at runtime when `framework.validation.enable_attributes` is true.This means they don't fit for bundles nor can't they be warmed up.This PR fixes both issues by using a new `validator.attribute_metadata` resource tag, that's turned into a list of classes to parse for attributes at compile-time.For apps, the tag is added by autoconfiguration: any `Constraint`-derived attributes found on a class in the `src/` folder will trigger the rule to add the tag.For bundles (and for apps if they want to), the tag is added by explicit service configuration. In an "eat your own dog-food" spirit, this capability is used to declare the constraints of the `Form` class: instead of loading the `validation.xml` file, we now declare this service resource:```php        ->set('validator.form.attribute_metadata', Form::class)            ->tag('container.excluded')            ->tag('validator.attribute_metadata')```This reads the attributes added to the `Form` class:```php#[AssertForm()]#[Traverse(false)]class Form implements \IteratorAggregate, FormInterface, ClearableErrorsInterface```Bundles can do the same and replace their XML files by attributes.As a next step, we could also deprecate runtime-discovery of attributes. This could be worth it if this discovery has a measurable performance impact. To be measured if one wants to dig this idea.Side note: I'm hoping this could allow removing the yaml and xml config formats one day. For serialization metadata also (PR coming). BUT, this doesn't (yet) cover the use case of overriding metadata defined by bundles. For that, apps still have to use xml or yaml in config/validation/. I have an idea to cover this, coming to a next PR if it works.(failures unrelated)Commits-------0197b50 [Validator] Allow using attributes to declare compile-time constraint metadata
@nicolas-grekas
Copy link
Member

Let me close for reasons explained in#61288 (comment).
A big thank you for pushing this forward, it made us realize that we have some more steps ahead before being able to deprecate.
But I definitely want to reconsider on 8.x!

MatTheCat reacted with thumbs up emoji

@MatTheCatMatTheCat deleted the deprecate_validator_xml_loader branchSeptember 4, 2025 15:35
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

No reviews

Assignees

No one assigned

Projects

None yet

Milestone

7.4

Development

Successfully merging this pull request may close these issues.

6 participants

@MatTheCat@xabbuh@alexandre-daubois@stof@nicolas-grekas@carsonbot

[8]ページ先頭

©2009-2025 Movatter.jp