mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-09-03 13:33:48 +00:00
apply more cs rules for php-cs
This commit is contained in:
@@ -15,7 +15,6 @@ use Chill\MainBundle\Entity\User;
|
||||
use Doctrine\ORM\EntityManagerInterface;
|
||||
use Symfony\Component\Validator\Constraint;
|
||||
use Symfony\Component\Validator\ConstraintValidator;
|
||||
use UnexpectedValueException;
|
||||
|
||||
class UserUniqueEmailAndUsername extends ConstraintValidator
|
||||
{
|
||||
@@ -32,16 +31,15 @@ class UserUniqueEmailAndUsername extends ConstraintValidator
|
||||
public function validate($value, Constraint $constraint)
|
||||
{
|
||||
if (!$value instanceof User) {
|
||||
throw new UnexpectedValueException('This validation should happens '
|
||||
. 'only on class ' . User::class);
|
||||
throw new \UnexpectedValueException('This validation should happens only on class '.User::class);
|
||||
}
|
||||
|
||||
if ($value->getId() !== null) {
|
||||
if (null !== $value->getId()) {
|
||||
$countUsersByUsername = $this->em->createQuery(
|
||||
sprintf(
|
||||
'SELECT COUNT(u) FROM %s u '
|
||||
. 'WHERE u.usernameCanonical = LOWER(UNACCENT(:username)) '
|
||||
. 'AND u != :user',
|
||||
.'WHERE u.usernameCanonical = LOWER(UNACCENT(:username)) '
|
||||
.'AND u != :user',
|
||||
User::class
|
||||
)
|
||||
)
|
||||
@@ -52,7 +50,7 @@ class UserUniqueEmailAndUsername extends ConstraintValidator
|
||||
$countUsersByUsername = $this->em->createQuery(
|
||||
sprintf(
|
||||
'SELECT COUNT(u) FROM %s u '
|
||||
. 'WHERE u.usernameCanonical = LOWER(UNACCENT(:username)) ',
|
||||
.'WHERE u.usernameCanonical = LOWER(UNACCENT(:username)) ',
|
||||
User::class
|
||||
)
|
||||
)
|
||||
@@ -70,12 +68,12 @@ class UserUniqueEmailAndUsername extends ConstraintValidator
|
||||
->addViolation();
|
||||
}
|
||||
|
||||
if ($value->getId() !== null) {
|
||||
if (null !== $value->getId()) {
|
||||
$countUsersByEmail = $this->em->createQuery(
|
||||
sprintf(
|
||||
'SELECT COUNT(u) FROM %s u '
|
||||
. 'WHERE u.emailCanonical = LOWER(UNACCENT(:email)) '
|
||||
. 'AND u != :user',
|
||||
.'WHERE u.emailCanonical = LOWER(UNACCENT(:email)) '
|
||||
.'AND u != :user',
|
||||
User::class
|
||||
)
|
||||
)
|
||||
@@ -86,7 +84,7 @@ class UserUniqueEmailAndUsername extends ConstraintValidator
|
||||
$countUsersByEmail = $this->em->createQuery(
|
||||
sprintf(
|
||||
'SELECT COUNT(u) FROM %s u '
|
||||
. 'WHERE u.emailCanonical = LOWER(UNACCENT(:email))',
|
||||
.'WHERE u.emailCanonical = LOWER(UNACCENT(:email))',
|
||||
User::class
|
||||
)
|
||||
)
|
||||
|
Reference in New Issue
Block a user