Rector changes and immplementations of required methods

This commit is contained in:
2025-05-22 17:47:07 +02:00
parent 053b92b77c
commit 17db59d221
1138 changed files with 2656 additions and 2616 deletions

View File

@@ -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;
}

View File

@@ -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';
}

View File

@@ -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;
}

View File

@@ -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;
}

View File

@@ -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');

View File

@@ -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);

View File

@@ -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);

View File

@@ -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');