Repository navigation
#398 - Transformers edge cases: trim, convert_value, multi_replace, conditions, hash, options validated with the configuration - #399
Merged
Conversation
…rt_value keep_missing, numeric keys of multi_replace and conditions, hash of an array, options validated with the configuration Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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
Fixes #398.
trim: acharlistcontaining multibyte characters (non-ASCII bytes) is applied withmb_trim()(symfony/polyfill-php84). Until now,trim()removed bytes, producing invalid UTF-8. A single-bytecharliststill usestrim(), rangesa..zincluded.convert_value: withkeep_missingandauto_cast, the input itself is returned, as documented, not its value cast to string. The existing test that pinned the old behaviour is updated.multi_replace: the keys and the replacements are cast to string, so a numeric key (anintin PHP) no longer throws aTypeError. A replacement that is not a scalar (ornull) is rejected with the configuration.ConditionTrait): the property paths are cast to string, so numeric keys no longer throw aTypeError. The list form ofempty/not_empty(not_empty: ['[email]']), already described by the documentation, is normalized to the map form: anintkey with a string value is taken as the property path.hash: an array or a non-Stringableobject throws anUnexpectedValueException. Until now, every array was hashed as the stringArray, and an object threw a rawError. New test class.explode: the emptydelimiter.sprintf: theformat, by a trialvsprintf()with enough empty arguments (positional ones included) that catches the\ValueErrorof an invalid format.@codeCoverageIgnoreis removed fromconfigureOptions().instantiate: the existence of theclass. The existing test expected aReflectionExceptionwith the first value.The input policy of
slugifyanddate_parser(#202 of the audit) goes with their own tickets.Requirements
Breaking changes
None in the API. A configuration with an empty
explodedelimiter, an invalidsprintfformat, an unknowninstantiateclass or a non-scalarmulti_replacereplacement now fails when the options are resolved, instead of failing with the first value (or never, without data).convert_valuewithkeep_missingandauto_castreturns the input instead of its string cast, as documented.hashrejects arrays.🤖 Generated with Claude Code