You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Error: Class "Locale" not found
/app/vendor/symfony/validator/Test/ConstraintValidatorTestCase.php:85
How to reproduce
Create a test class that extends ConstraintValidatorTestCase and includes the test method. In this scenario, ensure that neither the intl extension nor the polyfill package is installed.
Possible Solution
We won't need to override the Default locale if the \Locale class doesn't exist or we need adding warning/error, that say require an explicit dependency of Locale to improve DX.
Additional Context
No response
The text was updated successfully, but these errors were encountered:
Symfony version(s) affected
7.0.7 or lower
Description
The symfony/validator package offers the ConstraintValidatorTestCase class to simplify testing of custom constraints. It includes a default locale override using the Locale class provided by the intl extension:
https://github.com/symfony/validator/blob/0edd0a59dfb8766d49cba51aa31af8287e05ccba/Test/ConstraintValidatorTestCase.php#L85-L86
And restores the locale back to its default state:
https://github.com/symfony/validator/blob/0edd0a59dfb8766d49cba51aa31af8287e05ccba/Test/ConstraintValidatorTestCase.php#L98
However, the symfony/validator package does not explicitly require the intl extension or the symfony/polyfill-intl-icu package. This leads to an error if the ConstraintValidatorTestCase class is used without the extension or polyfill being installed:
How to reproduce
Create a test class that extends ConstraintValidatorTestCase and includes the test method. In this scenario, ensure that neither the intl extension nor the polyfill package is installed.
Possible Solution
We won't need to override the Default locale if the \Locale class doesn't exist or we need adding warning/error, that say require an explicit dependency of Locale to improve DX.
Additional Context
No response
The text was updated successfully, but these errors were encountered: