From 5c5acab9d3d672075a07c00525085264ed61510f Mon Sep 17 00:00:00 2001 From: Vincent QUATREVIEUX Date: Thu, 25 Jun 2026 17:29:55 +0200 Subject: [PATCH 1/2] chore: Compatibility with SF 8 (#FRAM-228) --- composer.json | 12 ++++++------ src/Api/Validator/IpRestriction.php | 13 ++++++++++++- 2 files changed, 18 insertions(+), 7 deletions(-) diff --git a/composer.json b/composer.json index f0d2cbe..4ca6300 100755 --- a/composer.json +++ b/composer.json @@ -26,19 +26,19 @@ "ext-libxml": "*", "ext-simplexml": "*", "psr/log": "~1.0|~2.0|~3.0", - "symfony/http-foundation": "~5.4|~6.0|~7.0", - "symfony/event-dispatcher": "~5.4|~6.0|~7.0", - "symfony/http-kernel": "~5.4|~6.0|~7.0", - "symfony/validator": "~5.4|~6.0|~7.0", + "symfony/http-foundation": "~5.4|~6.0|~7.0|~8.0", + "symfony/event-dispatcher": "~5.4|~6.0|~7.0|~8.0", + "symfony/http-kernel": "~5.4|~6.0|~7.0|~8.0", + "symfony/validator": "~5.4|~6.0|~7.0|~8.0", "psr/simple-cache": "~1.0|~2.0|~3.0", "psr/container": "~1.0|~2.0", "econea/nusoap": "~0.9" }, "require-dev": { - "symfony/routing": "~5.4|~6.0|~7.0", + "symfony/routing": "~5.4|~6.0|~7.0|~8.0", "phpunit/phpunit": "~9.5", "php-di/php-di": "~7.1", - "symfony/framework-bundle": "~5.4|~6.0|~7.0", + "symfony/framework-bundle": "~5.4|~6.0|~7.0|~8.0", "guzzlehttp/guzzle": "~5.3|~7.0" } } diff --git a/src/Api/Validator/IpRestriction.php b/src/Api/Validator/IpRestriction.php index c2a7652..bdfdea3 100755 --- a/src/Api/Validator/IpRestriction.php +++ b/src/Api/Validator/IpRestriction.php @@ -14,7 +14,18 @@ class IpRestriction extends Constraint { public $message = 'This ip is not allowed.'; public $allowedIps = []; - + + public function __construct(array $allowedIps, ?array $groups = null, mixed $payload = null) + { + parent::__construct(null, $groups, $payload); + + if (array_key_exists('allowedIps', $allowedIps)) { + $this->allowedIps = $allowedIps['allowedIps']; + } else { + $this->allowedIps = $allowedIps; + } + } + /** * {@inheritdoc} */ From d862ac7603cab7cc535f7ae7642809b3ca59d860 Mon Sep 17 00:00:00 2001 From: Vincent QUATREVIEUX Date: Thu, 25 Jun 2026 17:38:36 +0200 Subject: [PATCH 2/2] fix: IpRestriction constructor on legacy symfony --- src/Api/Validator/IpRestriction.php | 22 +++++----------------- 1 file changed, 5 insertions(+), 17 deletions(-) diff --git a/src/Api/Validator/IpRestriction.php b/src/Api/Validator/IpRestriction.php index bdfdea3..ad09f1f 100755 --- a/src/Api/Validator/IpRestriction.php +++ b/src/Api/Validator/IpRestriction.php @@ -4,6 +4,8 @@ use Symfony\Component\Validator\Constraint; +use function array_key_exists; + /** * IpRestriction * @@ -15,30 +17,16 @@ class IpRestriction extends Constraint public $message = 'This ip is not allowed.'; public $allowedIps = []; - public function __construct(array $allowedIps, ?array $groups = null, mixed $payload = null) + public function __construct(array $allowedIps, ?string $message = null, ?array $groups = null, mixed $payload = null) { parent::__construct(null, $groups, $payload); if (array_key_exists('allowedIps', $allowedIps)) { $this->allowedIps = $allowedIps['allowedIps']; + $this->message = $allowedIps['message'] ?? $this->message; } else { $this->allowedIps = $allowedIps; + $this->message = $message ?? $this->message; } } - - /** - * {@inheritdoc} - */ - public function getDefaultOption(): string - { - return 'allowedIps'; - } - - /** - * {@inheritdoc} - */ - public function getRequiredOptions(): array - { - return ['allowedIps']; - } }