mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-10-05 12:59:44 +00:00
Rector changes and immplementations of required methods
This commit is contained in:
@@ -35,7 +35,7 @@ class PhonenumberConstraint extends Constraint
|
||||
$this->type = $type ?? 'any';
|
||||
}
|
||||
|
||||
public function validatedBy()
|
||||
public function validatedBy(): string
|
||||
{
|
||||
return \Chill\MainBundle\Validation\Validator\ValidPhonenumber::class;
|
||||
}
|
||||
|
@@ -23,12 +23,12 @@ class RoleScopeScopePresenceConstraint extends Constraint
|
||||
public $messagePresenceRequired = 'The role "%role%" require to be associated with '
|
||||
.'a scope.';
|
||||
|
||||
public function getTargets()
|
||||
public function getTargets(): string|array
|
||||
{
|
||||
return self::CLASS_CONSTRAINT;
|
||||
}
|
||||
|
||||
public function validatedBy()
|
||||
public function validatedBy(): string
|
||||
{
|
||||
return 'role_scope_scope_presence';
|
||||
}
|
||||
|
@@ -19,12 +19,12 @@ class UserGroupDoNotExclude extends Constraint
|
||||
public string $message = 'The groups {{ excluded_groups }} do exclude themselves. Please choose one between them';
|
||||
public string $code = 'e16c8226-0090-11ef-8560-f7239594db09';
|
||||
|
||||
public function getTargets()
|
||||
public function getTargets(): string|array
|
||||
{
|
||||
return [self::PROPERTY_CONSTRAINT];
|
||||
}
|
||||
|
||||
public function validatedBy()
|
||||
public function validatedBy(): string
|
||||
{
|
||||
return \Chill\MainBundle\Validation\Validator\UserGroupDoNotExclude::class;
|
||||
}
|
||||
|
@@ -20,12 +20,12 @@ class UserUniqueEmailAndUsernameConstraint extends Constraint
|
||||
|
||||
public $messageDuplicateUsername = 'A user with the same or a close username already exists';
|
||||
|
||||
public function getTargets()
|
||||
public function getTargets(): string|array
|
||||
{
|
||||
return [self::CLASS_CONSTRAINT];
|
||||
}
|
||||
|
||||
public function validatedBy()
|
||||
public function validatedBy(): string
|
||||
{
|
||||
return UserUniqueEmailAndUsername::class;
|
||||
}
|
||||
|
@@ -23,7 +23,7 @@ class RoleScopeScopePresence extends ConstraintValidator
|
||||
{
|
||||
public function __construct(private readonly RoleProvider $roleProvider, private readonly LoggerInterface $logger, private readonly TranslatorInterface $translator) {}
|
||||
|
||||
public function validate($value, Constraint $constraint)
|
||||
public function validate($value, Constraint $constraint): void
|
||||
{
|
||||
if (!$value instanceof RoleScope) {
|
||||
throw new \RuntimeException('The validated object is not an instance of roleScope');
|
||||
|
@@ -22,7 +22,7 @@ final class UserGroupDoNotExclude extends ConstraintValidator
|
||||
{
|
||||
public function __construct(private readonly TranslatableStringHelperInterface $translatableStringHelper) {}
|
||||
|
||||
public function validate($value, Constraint $constraint)
|
||||
public function validate($value, Constraint $constraint): void
|
||||
{
|
||||
if (!$constraint instanceof \Chill\MainBundle\Validation\Constraint\UserGroupDoNotExclude) {
|
||||
throw new UnexpectedTypeException($constraint, UserGroupDoNotExclude::class);
|
||||
|
@@ -28,7 +28,7 @@ class UserUniqueEmailAndUsername extends ConstraintValidator
|
||||
$this->em = $em;
|
||||
}
|
||||
|
||||
public function validate($value, Constraint $constraint)
|
||||
public function validate($value, Constraint $constraint): void
|
||||
{
|
||||
if (!$value instanceof User) {
|
||||
throw new \UnexpectedValueException('This validation should happens only on class '.User::class);
|
||||
|
@@ -24,7 +24,7 @@ final class ValidPhonenumber extends ConstraintValidator
|
||||
* @param string $value
|
||||
* @param \Chill\MainBundle\Validation\Constraint\PhonenumberConstraint $constraint
|
||||
*/
|
||||
public function validate($value, Constraint $constraint)
|
||||
public function validate($value, Constraint $constraint): void
|
||||
{
|
||||
if (false === $this->phonenumberHelper->isPhonenumberValidationConfigured()) {
|
||||
$this->logger->debug('[phonenumber] skipping validation due to not configured helper');
|
||||
|
Reference in New Issue
Block a user