mirror of
https://github.com/Sarjuuk/aowow.git
synced 2025-11-29 15:58:16 +08:00
Response/Params
* so we can't directly use BackedEnum::tryFrom as validator, because if the Enum is of <int> and the string is not what php considers numeric, we get a straight TypeError Exception instead of null for failing the tryFrom.
This commit is contained in:
@@ -645,6 +645,13 @@ abstract class BaseResponse
|
||||
return preg_replace('/ +/', ' ', trim($str));
|
||||
}
|
||||
|
||||
protected static function checkLocale(string $localeId) : ?Locale
|
||||
{
|
||||
if (Util::checkNumeric($localeId, NUM_CAST_INT))
|
||||
return Locale::tryFrom($localeId);
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
/********************/
|
||||
/* child implements */
|
||||
|
||||
Reference in New Issue
Block a user