You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Transformers: a common policy for null, array and object inputs #405
The transformers have no common policy for the inputs they do not expect: null, an array, an object. Some return null for null (trim, convert_value), others the input itself (date_parser with a falsy value), others an empty string (multi_replace, hash of null), others throw: an explicit UnexpectedValueException (hash, slugify and date_parser since #398, #400 and #402, convert_value without auto_cast) or a raw TypeError / Error from a PHP function with strict types.
Define one policy for v6.0, for instance:
null gives null for every transformer that does not handle it explicitly (ignore_missing-like behaviour), or always throws;
a scalar or a \Stringable is cast to string by the string transformers;
an array or another object throws an UnexpectedValueException naming the transformer and the type, never a raw TypeError;
then apply it to every transformer, document it in each reference page (Accepted inputs) and in UPGRADE.md, and test it (a shared data provider over the transformers).
Found during the audit v3 (audit-v3-angles.md#202).
Activity