Skip to content

Releases: wrk-flow/php-get-typed-value

v0.3.0

28 Jun 15:22
73d64f7
Compare
Choose a tag to compare

🚀 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

28 Jun 12:35
6b38e7f
Compare
Choose a tag to compare

⛑ 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

28 Jun 10:57
c32f857
Compare
Choose a tag to compare

🚀 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;

v0.1.0

27 Jun 16:47
9e0e1d7
Compare
Choose a tag to compare

🚀 Initial release