Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[12.x] Add Number::spelloutOrdinal() and format validation message to ordinal #53379

Closed

Conversation

shaedrich
Copy link
Contributor

  • Number::ordinal(1) // 1st
  • 🆕 Number::spelloutOrdinal() // first

@shaedrich shaedrich changed the title [12.x] Format validation message to ordinal [12.x] Add Number::spelloutOrdinal() and format validation message to ordinal Nov 2, 2024
Comment on lines +430 to +433
return match ($value) {
1, 2, 3, 4, 5, 6, 7, 8, 9, 10 => Number::spelloutOrdinal($value, 'en'),
default => 'other',
};
Copy link
Contributor Author

Choose a reason for hiding this comment

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

of course, this could also be this:

Suggested change
return match ($value) {
1, 2, 3, 4, 5, 6, 7, 8, 9, 10 => Number::spelloutOrdinal($value, 'en'),
default => 'other',
};
return match (true) {
$value >= 1 && $value <= 10 => Number::spelloutOrdinal($value, 'en'),
default => 'other',
};

Copy link
Contributor Author

Choose a reason for hiding this comment

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

or this:

Suggested change
return match ($value) {
1, 2, 3, 4, 5, 6, 7, 8, 9, 10 => Number::spelloutOrdinal($value, 'en'),
default => 'other',
};
if ($value >= 1 && $value <= 10) {
return Number::spelloutOrdinal($value, 'en');
}
return 'other';

@taylorotwell
Copy link
Member

Thanks for your pull request to Laravel!

Unfortunately, I'm going to delay merging this code for now. To preserve our ability to adequately maintain the framework, we need to be very careful regarding the amount of code we include.

If applicable, please consider releasing your code as a package so that the community can still take advantage of your contributions!

@shaedrich
Copy link
Contributor Author

Delaying merging code for the upcoming version that won't come before the end of the year. Doesn't look like anyone's in a hurry …

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.

2 participants