From 6e638834558253566cd85c2ab0f22cc0669a66a7 Mon Sep 17 00:00:00 2001 From: Sebastiaan Stok Date: Mon, 1 Dec 2025 11:58:00 +0100 Subject: [PATCH] Fix constraints constructor - Re-arrange arguments in a more DX friendly order - Pass null to parent `$options` argument --- src/Validator/Constraints/PasswordRequirements.php | 12 ++++++------ src/Validator/Constraints/PasswordStrength.php | 2 +- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/Validator/Constraints/PasswordRequirements.php b/src/Validator/Constraints/PasswordRequirements.php index b4d839c..34e3f9f 100644 --- a/src/Validator/Constraints/PasswordRequirements.php +++ b/src/Validator/Constraints/PasswordRequirements.php @@ -19,19 +19,19 @@ class PasswordRequirements extends Constraint { public function __construct( - public string $tooShortMessage = 'Your password must be at least {{length}} characters long.', - public string $missingLettersMessage = 'Your password must include at least one letter.', - public string $requireCaseDiffMessage = 'Your password must include both upper and lower case letters.', - public string $missingNumbersMessage = 'Your password must include at least one number.', - public string $missingSpecialCharacterMessage = 'Your password must contain at least one special character.', public int $minLength = 6, public bool $requireLetters = true, public bool $requireCaseDiff = false, public bool $requireNumbers = false, public bool $requireSpecialCharacter = false, + public string $tooShortMessage = 'Your password must be at least {{length}} characters long.', + public string $missingLettersMessage = 'Your password must include at least one letter.', + public string $requireCaseDiffMessage = 'Your password must include both upper and lower case letters.', + public string $missingNumbersMessage = 'Your password must include at least one number.', + public string $missingSpecialCharacterMessage = 'Your password must contain at least one special character.', ?array $groups = null, mixed $payload = null, ) { - parent::__construct($groups, $payload); + parent::__construct(null, $groups, $payload); } } diff --git a/src/Validator/Constraints/PasswordStrength.php b/src/Validator/Constraints/PasswordStrength.php index e021577..de70056 100644 --- a/src/Validator/Constraints/PasswordStrength.php +++ b/src/Validator/Constraints/PasswordStrength.php @@ -27,6 +27,6 @@ public function __construct( ?array $groups = null, mixed $payload = null, ) { - parent::__construct($groups, $payload); + parent::__construct(null, $groups, $payload); } }