Repository navigation
Conversation
zsnakeee
force-pushed
the
uncountable-words
branch
from
December 3, 2026 01:51
5fbd47d to
179068d
Compare
Member
|
This is an automated, agent-powered review. Confirmed.
Thanks for your contribution, a human review will follow shortly. |
Author
|
Thanks for the review. I pushed 3a5ae51 for the model macro point:
Every job from |
plural and singular passed every word to the pluralizer crate, which
inflects many words that Laravel leaves alone: "money" became "monies",
"feedback" became "feedbacks" and "species" became "specie". The
doc comment already says uncountable words stay as they are.
The words now come from Laravel's Pluralizer ("recommended", "related")
and Doctrine's English inflector, which Laravel uses for the rest.
after the previous commit #[model] struct Feedback still got a feedbacks
table while foreign_id("feedback_id").constrained() pointed at feedback.
The plural and singular of a word, with the uncountable lists, now live
in a small laravel-rust-inflect crate that laravel-rust-core and the
model macros both use, so a model's table and the keys that point to it
agree.
pluralizer takes "lens" for a plural, so "lens".plural() stayed "lens"
and "lenses".singular() gave "lense". A Lens model got a lens table and
a lenses resource route a {lense} parameter. Laravel gives "lenses" and
"lens", so the shared inflector now has an irregular entry for it.
zsnakeee
force-pushed
the
uncountable-words
branch
from
December 3, 2026 22:58
7be4f45 to
d533572
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
pluralandsingularhand every word to thepluralizercrate, which inflects many words that Laravel leaves alone:The doc comment on
pluralalready says uncountable words stay as they are. The wrong forms also reachconstrained(), soforeign_id("feedback_id").constrained()references afeedbackstable, while Laravel PHP's referencesfeedback.Laravel PHP's
Pluralizerkeepsrecommendedandrelatedas they are and leaves the rest to Doctrine's English inflector (Rules/English/Uninflected.php).inflectnow checks the last word, ignoring case, against the same lists before it callspluralizer:recommendedandrelatedmediaafter another letter, such asmultimediapeople,media,trivia, and words ending inware, such assoftwaredata,radius,clothesand the other Doctrine singulars, and words ending inssThe model macro formed default table names with its own
pluralizercall, so fixing onlystrwould have given#[model] struct Feedbackafeedbackstable whileconstrained()pointed atfeedback. The word lists and the per-wordplural/singularnow live in a small internal crate,laravel-rust-inflect(inmacros/inflect, besidemacro-support, with no dependency butpluralizer).laravel-rust-coreandlaravel-rust-model-macrosboth call it, so a model's table,constrained()and resource route parameters agree.GRAPHintests/workspace_layout.rslists the new crate.The
sea bassandsocial mediapatterns span two words, so they're left out, becauseinflectonly looks at the last word.lens: the same check fixes one irregular word.pluralizertakeslensfor a plural, so"lens".plural()stayedlensand"lenses".singular()gavelense. ALensmodel got alenstable and alensesresource route a{lense}parameter. Laravel giveslensesandlens. I compared both inflectors over about 75,000 English words ending ins, using Doctrine run in PHP.lenswas the only common noun thatpluralizerleft unchanged where Laravel pluralizes it, so it's one entry in anIRREGULARtable, kept in the word's case.Breaking change: default tables and resource route parameters named after these words change, such as a
Feedbackmodel's table going fromfeedbackstofeedback, and{specie}becoming{species}. The lists follow Doctrine exactly, including nouns many applications count, such asfood,art,travel,talentandemoji. If you'd rather keep those countable, I can trim the shared list to the words that are uncountable in everyday English. It lives in one place now, so trimming is a one-line change per word.Tests: new cases in
str::inflect,laravel-rust-inflectand the model macro's table test (Feedback,UserFeedback,Species,ContactLens) cover the shared words, words in snake and studly names, the plural-only and singular-only words, and that both lists stay sorted for the binary search. 15 of them fail without the change.cargo fmt --checkandcargo clippy -p laravel-rust-core --all-targets --all-features -- -D warningspass. The workspace--libtests and thehttp,validationanddatabasesuites give the same results as on0.x. I also ran every job fromci.ymlon Linux with PostgreSQL, MySQL, MariaDB, Redis, ElasticMQ and MinIO: fmt, clippy, the minimal-features check, the unit and doc tests, and the core, testing_attribute, database, http and queue suites with--include-ignoredall pass.