public function validate(ExecutionContextInterface $context) { if ($this->password != $this->repeatPassword) { $context->buildViolation('The specified passwords are not identical!')->atPath('password')->addViolation(); return false; } if (!PasswordBuilder::isPasswordStrongEnough($this->password)) { $context->buildViolation('The password must contain lowercase, uppercase letters and numbers.')->atPath('password')->addViolation(); return false; } }