-
Notifications
You must be signed in to change notification settings - Fork 11.2k
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
[12.x] Add Number::spelloutOrdinal() and format validation message to ordinal #53379
Conversation
…::numberToIndexOrPositionWord by using the Number helper
return match ($value) { | ||
1, 2, 3, 4, 5, 6, 7, 8, 9, 10 => Number::spelloutOrdinal($value, 'en'), | ||
default => 'other', | ||
}; |
There was a problem hiding this comment.
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:
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', | |
}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
or this:
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'; |
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! |
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 … |
Number::ordinal(1) // 1st
Number::spelloutOrdinal() // first