diff --git a/composer.json b/composer.json index ab793fd..442dac6 100644 --- a/composer.json +++ b/composer.json @@ -13,10 +13,10 @@ "require": { "php": ">=8.1", "ddeboer/vatin": "^3.0", - "symfony/http-kernel": "^6.4 || ^7.0", - "symfony/dependency-injection": "^6.4 || ^7.0", - "symfony/config": "^6.4 || ^7.0", - "symfony/validator": "^6.4 || ^7.0" + "symfony/http-kernel": "^6.4 || ^7.0 || ^8.0", + "symfony/dependency-injection": "^6.4 || ^7.0 || ^8.0", + "symfony/config": "^6.4 || ^7.0 || ^8.0", + "symfony/validator": "^6.4 || ^7.0 || ^8.0" }, "require-dev": { "ext-soap": "*", @@ -27,8 +27,8 @@ "phpunit/phpunit": "^10.5", "rector/rector": "^2.0", "roave/security-advisories": "dev-latest", - "symfony/framework-bundle": "^6.4 || ^7.0", - "symfony/yaml": "^6.4 || ^7.0" + "symfony/framework-bundle": "^6.4 || ^7.0 || ^8.0", + "symfony/yaml": "^6.4 || ^7.0 || ^8.0" }, "autoload": { "psr-4": { diff --git a/src/Validator/Constraints/Vatin.php b/src/Validator/Constraints/Vatin.php index 8b038fc..0f31c08 100644 --- a/src/Validator/Constraints/Vatin.php +++ b/src/Validator/Constraints/Vatin.php @@ -19,20 +19,16 @@ class Vatin extends Constraint * {@inheritDoc} */ public function __construct( - ?array $options = null, + array $options = [], ?string $message = null, ?bool $checkExistence = null, ?array $groups = null, mixed $payload = null ) { - if ($message) { - $options['message'] = $message; - } - if ($checkExistence) { - $options['checkExistence'] = $checkExistence; - } + parent::__construct($options, $groups, $payload); - parent::__construct($options ?? [], $groups, $payload); + $this->message = $message ?? $this->message; + $this->checkExistence = $checkExistence ?? $this->checkExistence; } public function validatedBy(): string diff --git a/src/Validator/Constraints/VatinValidator.php b/src/Validator/Constraints/VatinValidator.php index 63bba7d..3a8f3e7 100644 --- a/src/Validator/Constraints/VatinValidator.php +++ b/src/Validator/Constraints/VatinValidator.php @@ -28,7 +28,7 @@ public function __construct( */ public function validate(mixed $value, Constraint $constraint): void { - if ('' === $value || !is_string($value) || !$constraint instanceof Vatin) { + if (null === $value || '' === $value || !is_string($value) || !$constraint instanceof Vatin) { return; } diff --git a/tests/Functional/AppKernel.php b/tests/Functional/AppKernel.php index cc1c89f..0878630 100644 --- a/tests/Functional/AppKernel.php +++ b/tests/Functional/AppKernel.php @@ -15,7 +15,7 @@ public function registerBundles(): iterable ]; } - public function registerContainerConfiguration(LoaderInterface $loader) + public function registerContainerConfiguration(LoaderInterface $loader): void { $loader->load(__DIR__ . '/config/config.yml'); }