Repository navigation
Keep surname particles together across nicknames - #18
Merged
Merged
Conversation
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.
Summary
van (Bob) der Berginventing first nameVanand reducing the surname toder Berg. Surname particles now stay together across mapped nickname parts, matching the existing nickname-aware surname scan.Della (Bob) Smith), and propagate the complete surname to joint-name partners.Caller and scope audit
LastnameMapper::map()→mapParts()→mapAsPrefixIfPossible()→isApplicablePrefix()is the only path to the changed decision. Grepped all callers and constructors:SegmentParserFactory::newDefaultPipeline()covers normal Western parsing andParser::getFirstSegmentParser(), including empty comma tails, credential-only comma tails, and the unknown-credential-tail probe. All now use the corrected decision.Parser::getSurnameSegmentParser()uses surname-only mapping for explicit comma names (also used by surname-first routing). Its already-correct behavior remains covered.Parser::resyncConfigurableMappers()rebuilds promoted default mappers throughnewLastnameMapper(); covered with custom nickname delimiters.LastnameMapperuse shares the fix; a direct regression verifies nickname object identity. Independent review also checked mapper flags and sparse arrays. No failing caller of this decision remains excluded.Removing the spurious given name also restores existing comma-tail rules:
van (Bob) der Berg, XYZkeepsXyzas a given name instead of guessing an unknown credential;van (Bob) der Berg, Jrfollows the existing sole-generational-suffix promotion.Existing out-of-scope limitation:
setSurnameFirst(true)->parse('van (Bob) der Berg John')takes only the first token as surname (firstnameDer, middlenameBerg John, lastnameVan). The nickname-freevan der Berg Johnhas the same pre-existing limitation intakeSurnameFirst(), before this mapper decision. Use the explicit comma form for a multi-token surname.Verification
git diff --checkpassed.312f0f1d5b38a7dded52b65126390492c8fee594and verified its complete tree, contents, and modes match the final tested local index:27370ce8795ab5057c9411e43488b5a73b0a53d9.Local runtime is PHP 8.4 only; CI is responsible for PHP 8.3/8.5 and dependency audit. No dependency, workflow, or public API changes.