Skip to content

Conversation

@mdariftiens
Copy link
Contributor

Fix code for invalid locale for number class. if provided locale is not valid throws exception.

Existing behaviour: If locale is invalid, falback en is used.
Updated behaviour: if locale is invalid throws an exception as Locale is invalid.

Note: A test is also added.

$availableLocales = ResourceBundle::getLocales('');

if ( ! in_array($locale, $availableLocales, true)){
throw new \Exception("Locale is invalid");
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should be InvalidArgumentException

@mdariftiens mdariftiens requested a review from crynobone October 28, 2024 09:57
@taylorotwell
Copy link
Member

I think it's ok.

@mdariftiens mdariftiens deleted the fixLocale branch October 29, 2024 14:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants