Repository navigation
Conversation
- preg_quote slug separators - Make replace() and removeRepeating() literal and safe on empty input
isAlpha, isAlphaNumeric and isNumeric now use \p{L}/\p{N} with /u. isNumeric('0') returns true. Whitespace handling is unchanged.
Case-insensitive comparison now uses mb_strtolower instead of strcasecmp. endsWith returns false when the needle is longer than the string.
Use mb_strpos so positions are character offsets, and return an empty array for an empty needle.
matches() threw nothing and returned false for an invalid regex. It now throws InvalidArgumentException using preg_last_error_msg().
Fix at, format, value, matches, toSentence, isAlphaNumeric and ensureBeginsWith headings, anchors and examples. Document make, encoding and setEncoding.
- use \p{L}/\p{N} with /u in replaceNonAlpha, replaceNonAlphanumeric and replaceNonNumeric
- toAlpha, toAlphanumeric and toNumeric inherit the change, keeping é etc.
- add tests and update docs
- use \p{Lu}/\p{Ll} with /u in camel, snake, studly and pascal case
- replace mb_ereg_* in toSnakeCase with preg and /u
- pass the encoding to mb_ucfirst/mb_lcfirst
- add tests and update docs
- filter only empty strings after trimming, so '0' is preserved - whitespace-only segments are now dropped as well - add tests and update docs
- cast both sides to string so Stringable and Utility inputs match - add tests, and fix the equals docs example
- state clean() is not an XSS defence - state minimise() is not safe for untrusted or complex JS - fix the clean and minimise doc examples
- cache length() per instance, reset by setEncoding - compute the contains haystack once, skipping mb_substr at offset 0 - add a test for length after an encoding change
- truncate to a character limit, multibyte-safe - append a configurable ending only when shortened - add tests and docs
- mask a character range with a repeated character - support negative index and optional length - add tests and docs
- extract a phrase with surrounding context, case-insensitive - add omission where the string was cut, multibyte-safe - add tests and docs
- limit the string to a number of words - append a configurable ending only when shortened - add tests and docs
- split the string into lines on any newline sequence - keep empty lines, return an empty array for an empty string - add tests and docs
- true when the string has cased letters and none are uppercase - multibyte-safe, empty and caseless strings are false - add tests and docs
- true when the string has cased letters and none are lowercase - multibyte-safe, empty and caseless strings are false - add tests and docs
- validate the 8-4-4-4-12 hexadecimal UUID format, case-insensitive - reject trailing newlines and surrounding whitespace - add tests and docs
- transliterate to ASCII with intl Transliterator when available - fall back to iconv for Latin accents without intl - add tests and docs
- order class elements in the new method tests - import Stringable in EqualsTest
Codecov Report✅ All modified and coverable lines are covered by tests.
🚀 New features to boost your workflow:
|
- cover matches() throwing on an invalid pattern - cover occurrences() with an empty needle - cover removeRepeating() with an empty value
- Move the intl lookup into a protected transliterator() method - Test the iconv fallback by simulating a platform without intl
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.
Security, Unicode and feature work from the utilities review.
replace()/removeRepeating()(no backreferences, empty needle is a no-op)isAlpha/isAlphaNumeric/isNumeric,toAlphaandreplaceNon*;isNumeric('0')is truebeginsWith/endsWith, character offsets inoccurrences,matches()throws on invalid patternsexplodekeeps'0',equals()compares string valuestruncate,mask,excerpt,words,lines,isUpper,isLower,isUuid,asciimb_substrcallsclean()/minimise(); Pint applied