From a322a07b759091a0e5a84f9b22be096cc7c0a70d Mon Sep 17 00:00:00 2001 From: Maxime Steinhausser Date: Mon, 13 Mar 2023 11:34:28 +0100 Subject: [PATCH] [Validator] Fix 1.x enum constraint with named arguments --- src/Bridge/Symfony/Validator/Constraint/Enum.php | 1 + tests/Unit/Bridge/Symfony/Validator/Constraint/EnumTest.php | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/src/Bridge/Symfony/Validator/Constraint/Enum.php b/src/Bridge/Symfony/Validator/Constraint/Enum.php index 90040ffb..ca924ba3 100644 --- a/src/Bridge/Symfony/Validator/Constraint/Enum.php +++ b/src/Bridge/Symfony/Validator/Constraint/Enum.php @@ -50,6 +50,7 @@ public function __construct( ) { parent::__construct( $class, // "class" is the default option here and supersedes "choices" from parent class. + null, $callback, $multiple, $strict, diff --git a/tests/Unit/Bridge/Symfony/Validator/Constraint/EnumTest.php b/tests/Unit/Bridge/Symfony/Validator/Constraint/EnumTest.php index 796075b5..bf002760 100644 --- a/tests/Unit/Bridge/Symfony/Validator/Constraint/EnumTest.php +++ b/tests/Unit/Bridge/Symfony/Validator/Constraint/EnumTest.php @@ -102,7 +102,7 @@ public function provide testNoChoicesSetsUserCallback data(): iterable use Elao\Enum\Bridge\Symfony\Validator\Constraint\Enum; use Elao\Enum\Tests\Fixtures\Enum\SimpleEnum; - return new Enum(class: SimpleEnum::class, callback: 'allowedValues'); + return new Enum(class: SimpleEnum::class, callback: 'allowedValues', message: 'foo'); PHP), !self::isSf52()]; } }