catch ValueError thrown on PHP 8
This commit is contained in:
parent
791761277d
commit
fb0d7beaaf
@ -78,7 +78,11 @@ class TimezoneValidator extends ConstraintValidator
|
|||||||
private static function getPhpTimezones(int $zone, string $countryCode = null): array
|
private static function getPhpTimezones(int $zone, string $countryCode = null): array
|
||||||
{
|
{
|
||||||
if (null !== $countryCode) {
|
if (null !== $countryCode) {
|
||||||
return @\DateTimeZone::listIdentifiers($zone, $countryCode) ?: [];
|
try {
|
||||||
|
return @\DateTimeZone::listIdentifiers($zone, $countryCode) ?: [];
|
||||||
|
} catch (\ValueError $e) {
|
||||||
|
return [];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return \DateTimeZone::listIdentifiers($zone);
|
return \DateTimeZone::listIdentifiers($zone);
|
||||||
|
Reference in New Issue
Block a user