v0.8.4
๐ฎโโ๏ธ Pass full key in ArrayItem/ArrayItemGetterTransformer
BREAKING CHANGE: if you used $key (low chance) then now you will get full key including the looped item key
๐ฎโโ๏ธ Pass full key in ArrayItem/ArrayItemGetterTransformer
BREAKING CHANGE: if you used $key (low chance) then now you will get full key including the looped item key
๐ Laravel: GetValueFactory->command() wraps command arguments / options for type safe access. docs
๐ Laravel: You can extend GetValueFactoryCommand that wraps command arguments / options in GetValue $inputData property you can access within your command. docs
โ๏ธ Add support for accessing arrays by numeric index in XML ๐ Add support for accessing XML childrens using namespace prefix
๐ getFloat: Add support for float values using comma
Full Changelog: https://github.com/wrk-flow/php-get-typed-value/compare/v0.8.0โฆv0.8.1
โ In default strategy ensure that empty string values are converted to null in all value types.
๐ Improve validation exception text with value description: (null), (array with count X), (empty string), string value with maximum of 30 characters.
Breaking changes (small chance):
TransformerStrategy renamed to TransformerStrategyContractFull Changelog: https://github.com/wrk-flow/php-get-typed-value/compare/v0.7.1โฆv0.8.0
๐ Add ability to automatically build GetValue instance within FormRequest instance. Docs
Full Changelog: https://github.com/wrk-flow/php-get-typed-value/compare/v0.7.0โฆv0.7.1
๐ Add value to ValidationException message.
ExceptionBuilderContract has new function signature.
public function validationFailed(string $key, string $ruleClassName): Exceptionto
public function validationFailed(string $key, string $ruleClassName, ?string $value): ExceptionFull Changelog: https://github.com/wrk-flow/php-get-typed-value/compare/v0.6.4โฆv0.7.0
โ Fix enum rule with int enum but value in string (xml)
Full Changelog: https://github.com/wrk-flow/php-get-typed-value/compare/v0.6.3โฆv0.6.4
๐ Add GetValueFactory for dependency injection usages
Full Changelog: https://github.com/wrk-flow/php-get-typed-value/compare/v0.6.2โฆv0.6.3
๐ Add getRequiredObject variant
Full Changelog: https://github.com/wrk-flow/php-get-typed-value/compare/v0.6.1โฆv0.6.2
๐ Allow passing transformer object instead of closure usingGetValueTransformerContract. Docs ๐ช Get value with object transforming to desired type (using GetValueTransformerContract) with correct type hint. Docs
Full Changelog: https://github.com/wrk-flow/php-get-typed-value/compare/v0.6.0โฆv0.6.1
๐ Improved XML support
Full Changelog: https://github.com/wrk-flow/php-get-typed-value/compare/v0.5.1โฆv0.6.0
โ Allow usage of Array*Transformers in all get* methods
๐ Ignore null values while re-building an array (ArrayItemTransformer, ArrayItemGetterTransformer)
Full Changelog: https://github.com/wrk-flow/php-get-typed-value/compare/v0.5.0โฆv0.5.1
๐ Add safe dot annotation for accessing values from child arrays. Documentation ๐ Key contains parent key for exceptions that were thrown from GetValue instances that were created as child instances.
$keyGetValue: $key argument accepts string|array instead of string.Full Changelog: https://github.com/wrk-flow/php-get-typed-value/compare/v0.4.4โฆv0.5.0
โ Fix ArrayGetterTransformer closure type hints for PHPStan
Full Changelog: https://github.com/wrk-flow/php-get-typed-value/compare/v0.4.3โฆv0.4.4
๐ Add support for enums: get methods, EnumRule.
โฝ๏ธ Add ability to validate HEX colors using HexColorRule. Documentation.
Full Changelog: https://github.com/wrk-flow/php-get-typed-value/compare/v0.4.1โฆv0.4.2
๐ Add ArrayGetterTransformer to get array object wrapped in GetValue Documentation
Full Changelog: https://github.com/wrk-flow/php-get-typed-value/compare/v0.4.0โฆv0.4.1
๐ Add array item transformer that has wrapped array value in GetValue instance. Documentation
$transformer = new ArrayItemGetterTransformer( function (\Wrkflow\GetValue\GetValue $value, string $key): string { return [ self::KeyValue => $value->getRequiredString(self::KeyValue), ];});
$values = $getValue->getArray('key', [$transformer]);๐ $getValue->makeInstance will allow you to create new instance of GetValue with same strategy/builder/actions.
ClosureArrayItemsTransformer to ArrayItemTransformerClosureArrayTransformer to ArrayTransformertransform method has new parameter GetValue $getValue - update your transformers or transform calls.public function transform(mixed $value, string $key, GetValue $getValue): mixed๐ Array closures transformers Documentation
๐ Add ability to transform value before (most transforms) and after validation (mostly your custom transformations).
By my opinion Iโve implemented default strategy based on my usage on all projects:
Also, if you are not using named arguments you need to update:
GetValue::__construct$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, );โ Made getArrayGetter match getArray (returns always array instance) and add getNullableArrayGetter to return null if data is missing or empty.
๐ getArrayGetter does not return null any more. Use getNullableArrayGetter instead to get null if data is missing.
๐ 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.
๐ 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;๐ Initial release