Skip to content

Commit 4b491ca

Browse files
authored
Merge pull request #383 from norkunas/deprecate
Deprecate using options array to configure Address validation constraint
2 parents 5f850f9 + d976fdf commit 4b491ca

File tree

3 files changed

+9
-0
lines changed

3 files changed

+9
-0
lines changed

composer.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
"php-http/curl-client": "^2.3",
2020
"php-http/discovery": "^1.14",
2121
"symfony/console": "^5.4 || ^6.4 || ^7.0",
22+
"symfony/deprecation-contracts": "2.5",
2223
"symfony/framework-bundle": "^5.4 || ^6.4 || ^7.0",
2324
"symfony/http-kernel": "^5.4 || ^6.4 || ^7.0",
2425
"symfony/options-resolver": "^5.4 || ^6.4 || ^7.0",

src/Validator/Constraint/Address.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,10 @@ class Address extends Constraint
5151
*/
5252
public function __construct(?array $options = null, ?string $message = null, ?array $groups = null, $payload = null)
5353
{
54+
if (\is_array($options)) {
55+
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);
56+
}
57+
5458
parent::__construct($options, $groups, $payload);
5559

5660
$this->message = $message ?? $this->message;

tests/baseline-ignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,3 +90,7 @@
9090
%Not enabling native lazy objects is deprecated and will be impossible in Doctrine ORM 4.0%
9191
%Not setting "doctrine.orm.enable_native_lazy_objects" to true is deprecated%
9292
%Disabling native lazy objects is deprecated and will be impossible in Doctrine ORM 4.0%
93+
%Passing an array of options to configure the "Bazinga\\GeocoderBundle\\Validator\\Constraint\\Address" constraint is deprecated, use named arguments instead%
94+
%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%
95+
%XML configuration format is deprecated, use YAML or PHP instead%
96+
%Support for evaluating options in the base Constraint class is deprecated. Initialize properties in the constructor of Bazinga\\GeocoderBundle\\Validator\\Constraint\\Address instead%

0 commit comments

Comments
 (0)