From d976fdf838652c2eeb07112ad338934061d00987 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tomas=20Nork=C5=ABnas?= Date: Mon, 22 Dec 2025 07:40:20 +0200 Subject: [PATCH] Deprecate using options array to configure Address validation constraint --- composer.json | 1 + src/Validator/Constraint/Address.php | 4 ++++ tests/baseline-ignore | 4 ++++ 3 files changed, 9 insertions(+) diff --git a/composer.json b/composer.json index d5727a81..a504fd83 100644 --- a/composer.json +++ b/composer.json @@ -19,6 +19,7 @@ "php-http/curl-client": "^2.3", "php-http/discovery": "^1.14", "symfony/console": "^5.4 || ^6.4 || ^7.0", + "symfony/deprecation-contracts": "2.5", "symfony/framework-bundle": "^5.4 || ^6.4 || ^7.0", "symfony/http-kernel": "^5.4 || ^6.4 || ^7.0", "symfony/options-resolver": "^5.4 || ^6.4 || ^7.0", diff --git a/src/Validator/Constraint/Address.php b/src/Validator/Constraint/Address.php index 29a04847..8951896e 100644 --- a/src/Validator/Constraint/Address.php +++ b/src/Validator/Constraint/Address.php @@ -51,6 +51,10 @@ class Address extends Constraint */ public function __construct(?array $options = null, ?string $message = null, ?array $groups = null, $payload = null) { + if (\is_array($options)) { + trigger_deprecation('willdurand/geocoder-bundle', '5.24', 'Passing an array of options to configure the "%s" constraint is deprecated, use named arguments instead.', static::class); + } + parent::__construct($options, $groups, $payload); $this->message = $message ?? $this->message; diff --git a/tests/baseline-ignore b/tests/baseline-ignore index 8d329b80..e848d758 100644 --- a/tests/baseline-ignore +++ b/tests/baseline-ignore @@ -90,3 +90,7 @@ %Not enabling native lazy objects is deprecated and will be impossible in Doctrine ORM 4.0% %Not setting "doctrine.orm.enable_native_lazy_objects" to true is deprecated% %Disabling native lazy objects is deprecated and will be impossible in Doctrine ORM 4.0% +%Passing an array of options to configure the "Bazinga\\GeocoderBundle\\Validator\\Constraint\\Address" constraint is deprecated, use named arguments instead% +%The "Symfony\\Bundle\\FrameworkBundle\\Console\\Application::add\(\)" method is deprecated and will be removed in Symfony 8.0, use "Symfony\\Bundle\\FrameworkBundle\\Console\\Application::addCommand\(\)" instead% +%XML configuration format is deprecated, use YAML or PHP instead% +%Support for evaluating options in the base Constraint class is deprecated. Initialize properties in the constructor of Bazinga\\GeocoderBundle\\Validator\\Constraint\\Address instead%