From b2ceae725cbf79cf30833f28a80d4d354c3f4836 Mon Sep 17 00:00:00 2001 From: velkuns Date: Thu, 12 Feb 2026 15:23:13 +0100 Subject: [PATCH] GenericEntity: data now accept mixed rather than limited types --- CHANGELOG.md | 6 ++++++ composer.json | 12 ++++++------ src/Entity/GenericEntity.php | 14 +++++++------- 3 files changed, 19 insertions(+), 13 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index c5afc99..de2078b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,12 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html). +## [6.2.0] - 2026-02-12 +[6.2.0]: https://github.com/eureka-framework/component-validation/compare/6.1.0...6.2.0 +### Changed +- GenericEntity data now accept mixed rather than limited types + + ## [6.1.0] - 2026-01-05 [6.1.0]: https://github.com/eureka-framework/component-validation/compare/6.0.0...6.1.0 ### Added diff --git a/composer.json b/composer.json index 4d7b43a..8a896f5 100644 --- a/composer.json +++ b/composer.json @@ -36,12 +36,12 @@ }, "require-dev": { - "friendsofphp/php-cs-fixer": "^3.92.4", - "phpstan/phpstan": "^2.1.33", - "phpstan/phpstan-phpunit": "^2.0.11", - "phpstan/phpstan-strict-rules": "^2.0.7", - "phpunit/phpcov": "^11.0.3", - "phpunit/phpunit": "^12.5.4", + "friendsofphp/php-cs-fixer": "^3.94.0", + "phpstan/phpstan": "^2.1.39", + "phpstan/phpstan-phpunit": "^2.0.15", + "phpstan/phpstan-strict-rules": "^2.0.10", + "phpunit/phpcov": "^11.0.4", + "phpunit/phpunit": "^12.5.11", "shipmonk/composer-dependency-analyser": "^1.8.4" } } diff --git a/src/Entity/GenericEntity.php b/src/Entity/GenericEntity.php index 7a671ca..4830653 100644 --- a/src/Entity/GenericEntity.php +++ b/src/Entity/GenericEntity.php @@ -24,7 +24,7 @@ class GenericEntity /** @var string[] $errors */ private array $errors = []; - /** @var array $data */ + /** @var array $data */ protected array $data = []; /** @var array|int|float|bool|string|null>> $validatorConfig Validator config @@ -39,7 +39,7 @@ class GenericEntity * * @param ValidatorFactoryInterface $validatorFactory * @param array|int|float|bool|string|null>> $validatorConfig - * @param array $data + * @param array $data */ public function __construct(ValidatorFactoryInterface $validatorFactory, array $validatorConfig, array $data = []) { @@ -83,7 +83,7 @@ public function getErrors(): array } /** - * @param array $data + * @param array $data * @return $this */ public function setFromArray(array $data): self @@ -102,10 +102,10 @@ public function setFromArray(array $data): self /** * Magic method to have getters & setters for generic entity. * - * @param array $arguments + * @param array $arguments * @throws \LogicException */ - public function __call(string $name, array $arguments): self|int|float|bool|string|null + public function __call(string $name, array $arguments): mixed { $prefix3Chars = \substr($name, 0, 3); $prefix2Chars = \substr($name, 0, 2); @@ -118,7 +118,7 @@ public function __call(string $name, array $arguments): self|int|float|bool|stri }; } - protected function set(string $name, int|float|bool|string|null $value): self + protected function set(string $name, mixed $value): self { $name = self::toPascalCase($name); @@ -137,7 +137,7 @@ protected function set(string $name, int|float|bool|string|null $value): self return $this; } - protected function get(string $name): int|float|bool|string|null + protected function get(string $name): mixed { $name = self::toPascalCase($name);