Replace StringHelper with symfony/string - #252
Open
lyrixx wants to merge 1 commit into
Open
Conversation
StringHelper was a small mb_*-based wrapper (strlen/substr/strpos/strrpos) with a configurable encoding, used to keep string offsets correct on multi-byte commit messages, paths and branch names. symfony/string's CodePointString covers the exact same UTF-8-aware, code-point-based operations, so drop the custom class in favor of it. Breaking: StringHelper and its getEncoding()/setEncoding() are removed; the library now consistently targets UTF-8 (Log::getCommits() hardcodes --encoding=UTF-8, matching the previous default).
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
Gitonomy\Git\Util\StringHelper, a smallmb_*-based wrapper (strlen/substr/strpos/strrpos) with a configurable encoding.symfony/string'sCodePointStringinstead, which provides the exact same UTF-8-aware, code-point-based string operations (length(),slice(),indexOf(),indexOfLast()).symfony/polyfill-mbstringrequirement (symfony/stringalready depends on it transitively).Breaking change:
StringHelperand itsgetEncoding()/setEncoding()are removed. The library now consistently targets UTF-8;Log::getCommits()hardcodes--encoding=UTF-8, matching the previous default (no test or usage relied on a non-default encoding).Test plan
castor cs --dry-run— clean (after runningcastor csto apply the two formatting fixes triggered by the new syntax)castor phpstan— no errorscastor phpunit— 235 tests, 596 assertions, all passing