Repository navigation
Conversation
Fix regex grouping and missing end-of-string anchor in plural() rule for matrix, vertex, and index. Expand plural() and singular() to support other words ending in ix/ex taking ices (apex, appendix, codex, cortex, latex, murex, vortex) while preserving standard -es pluralization for words like complex, sex, duplex, and annex.
banghamid
force-pushed
the
fix/inflector-plural-matrix-regex
branch
from
November 19, 2026 02:09
aecc927 to
8da68f5
Compare
Contributor
Author
|
Updated! I've expanded both |
This branch has not been deployed
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.
Description
In
inflector_helper.php, the plural rule formatrix,vertex, andindexwas written as:Due to operator precedence, this was evaluated as
((matr|vert|ind)ix) | (ex$). Consequently:(matr|vert|ind)ixlacked an end-of-string anchor$, improperly matching occurrences before the end of strings (e.g.matrix_idbecamematrices_id).ex$matched the second branch where group\1was not captured (empty string), corrupting words likecomplexintocomplicesandsexintosicesinstead of falling through to the/(x|ch|ss|sh)$/rule.This PR wraps the alternative endings in a non-capturing group
(?:ix|ex)$, adds test cases forvertex,index,complex,sex, andmatrix_id, and adds a changelog entry indocs/changelogs/v4.7.7.md.Checklist: