Repository navigation
Clarify surname-first boundaries and comma-tail behavior - #19
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
setSurnameFirst()documentation: empty and credential-only comma tails also use first-token surname order, despite the old claim that only comma-less input was affected.van Gogh, Vincent), plus short-input fallback examples.Scope and branch audit
Traced every caller of
takeSurnameFirst():parseInput()for space-separated input,parseSplitNameSegments()for empty comma tails, andparseSplitParts()when the tail has no given-name parts. Followed their early returns and the explicit-given-name path through the surname sub-parser. Existing tests cover the credential-only and single-token cases; new examples cover multi-token surnames, empty tails, explicit boundaries with credentials, and one token after a salutation. Grepped source/README for contradictory surname-first comments and corrected them.This documents current behavior rather than changing parsing:
setSurnameFirst(true)->parse('van Gogh Vincent')still returns lastnameVan, firstnameGogh, middlenameVincent. The same limitation remains with an empty or credential-only comma tail; an explicit given-name segment preservesvan Gogh. No parser path is represented as fixed.Verification
git diff --checkpassed.41911190225887b21ecf84737c1cf434c6117d4averified before publication: all 85 tracked file contents and modes match final tested treee6793759fdaca7309b3a1491638410432eeac29d.Local runtime is PHP 8.4 only. PHP 8.3/8.5 and dependency audit remain CI checks; no dependency or workflow changes.