Releases: wrk-flow/php-get-typed-value
v0.3.0
🚀 Add ability to transform value before (most transforms) and after validation (mostly your custom transformations).
Breaking change
By my opinion I've implemented default strategy based on my usage on all projects:
- string -> string is always trimmed and if it is empty then it will be transformed to null
- bool -> Converts most used representations of boolean in string or number ('yes','no',1,0,'1','0','true','false') and converts it to bool.
Also, if you are not using named arguments you need to update:
GetValue::__construct
- new argument $transformerStrategy. This will be mostly used for tweaking.
$getValidatedValueAction
was moved as last argument. Probably will not be used.$exceptionBuilder
- was moved before$getValidatedValueAction
public function __construct(
public readonly AbstractData $data,
public readonly TransformerStrategy $transformerStrategy = new DefaultTransformerStrategy(),
public readonly ExceptionBuilderContract $exceptionBuilder = new ExceptionBuilder(),
GetValidatedValueAction $getValidatedValueAction = null,
);
v0.2.1
⛑ Made getArrayGetter
match getArray
(returns always array instance) and add getNullableArrayGetter
to return null if data is missing or empty.
Breaking change
🛠 getArrayGetter
does not return null any more. Use getNullableArrayGetter
instead to get null if data is missing.
v0.2.0
🚀 Add ability to get validated value (use rules: []
in methods). Documentation.
⛑ int|string|float|bool|string
is now validated and throws \Wrkflow\GetValue\Exceptions\ValidationFailedException
.
Breaking change
🛠 If you are extending exception builder then you need to implement new method
/**
* @param class-string<RuleContract> $ruleClassName
*/
public function validationFailed(string $key, string $ruleClassName): Exception;