function PasswordStrength::__construct
Parameters
array<string,mixed>|null $options:
self::STRENGTH_*|null $minScore The minimum required strength of the password (defaults to {@see PasswordStrength::STRENGTH_MEDIUM}):
string[]|null $groups:
Overrides Constraint::__construct
File
-
vendor/
symfony/ validator/ Constraints/ PasswordStrength.php, line 46
Class
- PasswordStrength
- Validates that the given password has reached a minimum strength.
Namespace
Symfony\Component\Validator\ConstraintsCode
public function __construct(?array $options = null, ?int $minScore = null, ?array $groups = null, mixed $payload = null, ?string $message = null) {
$options['minScore'] ??= self::STRENGTH_MEDIUM;
parent::__construct($options, $groups, $payload);
$this->minScore = $minScore ?? $this->minScore;
$this->message = $message ?? $this->message;
if ($this->minScore < 1 || 4 < $this->minScore) {
throw new ConstraintDefinitionException(\sprintf('The parameter "minScore" of the "%s" constraint must be an integer between 1 and 4.', self::class));
}
}