From 98491a55363a93e3fa8ad0b4f4990da7c4fd02ba Mon Sep 17 00:00:00 2001 From: dev-craftec <89782875+dev-craftec@users.noreply.github.com> Date: Fri, 23 May 2025 10:50:56 +0200 Subject: [PATCH 1/2] Update AbstractScalarParam.php Fixes "Passing an array of options to configure the \"FOS\\RestBundle\\Validator\\Constraints\\Regex\" constraint is deprecated, use named arguments instead." --- Controller/Annotations/AbstractScalarParam.php | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/Controller/Annotations/AbstractScalarParam.php b/Controller/Annotations/AbstractScalarParam.php index 5243f48c1..cf8968724 100644 --- a/Controller/Annotations/AbstractScalarParam.php +++ b/Controller/Annotations/AbstractScalarParam.php @@ -41,19 +41,19 @@ public function getConstraints() if ($this->requirements instanceof Constraint) { $constraints[] = $this->requirements; } elseif (is_scalar($this->requirements)) { - $constraints[] = new Regex([ - 'pattern' => '#^(?:'.$this->requirements.')$#xsu', - 'message' => sprintf( + $constraints[] = new Regex( + pattern: '#^(?:'.$this->requirements.')$#xsu', + message: sprintf( 'Parameter \'%s\' value, does not match requirements \'%s\'', $this->getName(), $this->requirements ), - ]); + ); } elseif (is_array($this->requirements) && isset($this->requirements['rule']) && $this->requirements['error_message']) { - $constraints[] = new Regex([ - 'pattern' => '#^(?:'.$this->requirements['rule'].')$#xsu', - 'message' => $this->requirements['error_message'], - ]); + $constraints[] = new Regex( + pattern: '#^(?:'.$this->requirements['rule'].')$#xsu', + message: $this->requirements['error_message'], + ); } elseif (is_array($this->requirements)) { foreach ($this->requirements as $index => $requirement) { if ($requirement instanceof Constraint) { From aa585772413218154084b9cb4a8e36c02f29201c Mon Sep 17 00:00:00 2001 From: dev-craftec <89782875+dev-craftec@users.noreply.github.com> Date: Fri, 23 May 2025 10:57:00 +0200 Subject: [PATCH 2/2] Update AbstractScalarParam.php Support php <8.0 --- Controller/Annotations/AbstractScalarParam.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Controller/Annotations/AbstractScalarParam.php b/Controller/Annotations/AbstractScalarParam.php index cf8968724..92b512ff1 100644 --- a/Controller/Annotations/AbstractScalarParam.php +++ b/Controller/Annotations/AbstractScalarParam.php @@ -42,8 +42,8 @@ public function getConstraints() $constraints[] = $this->requirements; } elseif (is_scalar($this->requirements)) { $constraints[] = new Regex( - pattern: '#^(?:'.$this->requirements.')$#xsu', - message: sprintf( + '#^(?:'.$this->requirements.')$#xsu', + sprintf( 'Parameter \'%s\' value, does not match requirements \'%s\'', $this->getName(), $this->requirements @@ -51,8 +51,8 @@ public function getConstraints() ); } elseif (is_array($this->requirements) && isset($this->requirements['rule']) && $this->requirements['error_message']) { $constraints[] = new Regex( - pattern: '#^(?:'.$this->requirements['rule'].')$#xsu', - message: $this->requirements['error_message'], + '#^(?:'.$this->requirements['rule'].')$#xsu', + $this->requirements['error_message'], ); } elseif (is_array($this->requirements)) { foreach ($this->requirements as $index => $requirement) {