Symfony 8.1 introduces several improvements to the Validator component. A new built-in `Xml` constraint validates well-formed XML and optionally checks conformance against an XSD schema. Comparison and Range validators become clock-aware, allowing deterministic date-based validation in tests via MockClock. A new opt-in `enablePropertyMetadataExistenceCheck()` method causes `validateProperty()` and `validatePropertyValue()` to throw exceptions for missing or mistyped property names instead of silently returning zero violations. Finally, constraint validators are refactored to be reentrant by passing execution context explicitly via a new `validateInContext()` method, deprecating the old stateful `initialize()`/`validate()` pattern.
Table of contents
New Xml ConstraintClock-aware Comparison and Range ValidatorsStrict Check for Property Metadata ExistenceReentrant Constraint Validators20.7K Impressions