Applied rector with PHP8.1 migration rules

This commit is contained in:
Jan Böhmer 2023-06-11 14:15:46 +02:00
parent dc6a67c2f0
commit 7ee01d9a05
303 changed files with 1228 additions and 3465 deletions

View file

@ -49,11 +49,8 @@ use Symfony\Component\Validator\Exception\UnexpectedValueException;
class ValidRangeValidator extends ConstraintValidator
{
protected RangeParser $rangeParser;
public function __construct(RangeParser $rangeParser)
public function __construct(protected RangeParser $rangeParser)
{
$this->rangeParser = $rangeParser;
}
public function validate($value, Constraint $constraint): void

View file

@ -33,17 +33,11 @@ use Symfony\Component\Validator\ConstraintValidator;
class NoLockoutValidator extends ConstraintValidator
{
protected PermissionManager $resolver;
protected array $perm_structure;
protected \Symfony\Bundle\SecurityBundle\Security $security;
protected EntityManagerInterface $entityManager;
public function __construct(PermissionManager $resolver, \Symfony\Bundle\SecurityBundle\Security $security, EntityManagerInterface $entityManager)
public function __construct(protected PermissionManager $resolver, protected \Symfony\Bundle\SecurityBundle\Security $security, protected EntityManagerInterface $entityManager)
{
$this->resolver = $resolver;
$this->perm_structure = $resolver->getPermissionStructure();
$this->security = $security;
$this->entityManager = $entityManager;
}
/**
@ -64,12 +58,12 @@ class NoLockoutValidator extends ConstraintValidator
if ($perm_holder instanceof User || $perm_holder instanceof Group) {
$user = $this->security->getUser();
if (null === $user) {
if (!$user instanceof \Symfony\Component\Security\Core\User\UserInterface) {
$user = $this->entityManager->getRepository(User::class)->getAnonymousUser();
}
//Check if the change_permission permission has changed from allow to disallow
if (($user instanceof User) && false === ($this->resolver->inherit(
if (($user instanceof User) && !($this->resolver->inherit(
$user,
'users',
'edit_permissions'

View file

@ -32,11 +32,8 @@ use function is_string;
class ValidFileFilterValidator extends ConstraintValidator
{
protected FileTypeFilterTools $filterTools;
public function __construct(FileTypeFilterTools $filterTools)
public function __construct(protected FileTypeFilterTools $filterTools)
{
$this->filterTools = $filterTools;
}
/**

View file

@ -36,11 +36,8 @@ use function strlen;
class ValidGoogleAuthCodeValidator extends ConstraintValidator
{
protected GoogleAuthenticatorInterface $googleAuthenticator;
public function __construct(GoogleAuthenticatorInterface $googleAuthenticator)
public function __construct(protected GoogleAuthenticatorInterface $googleAuthenticator)
{
$this->googleAuthenticator = $googleAuthenticator;
}
public function validate($value, Constraint $constraint): void

View file

@ -32,11 +32,8 @@ use Symfony\Component\Validator\ConstraintValidator;
class ValidPartLotValidator extends ConstraintValidator
{
protected EntityManagerInterface $em;
public function __construct(EntityManagerInterface $em)
public function __construct(protected EntityManagerInterface $em)
{
$this->em = $em;
}
/**
@ -56,7 +53,7 @@ class ValidPartLotValidator extends ConstraintValidator
}
//We can only validate the values if we know the storelocation
if ($value->getStorageLocation()) {
if ($value->getStorageLocation() instanceof \App\Entity\Parts\Storelocation) {
$repo = $this->em->getRepository(Storelocation::class);
//We can only determine associated parts, if the part have an ID
//When the storage location is new (no ID), we can just assume there are no other parts

View file

@ -30,12 +30,10 @@ use Symfony\Component\Validator\ConstraintValidator;
class ValidPermissionValidator extends ConstraintValidator
{
protected PermissionManager $resolver;
protected array $perm_structure;
public function __construct(PermissionManager $resolver)
public function __construct(protected PermissionManager $resolver)
{
$this->resolver = $resolver;
}
/**

View file

@ -26,11 +26,8 @@ use Symfony\Component\Validator\Exception\UnexpectedTypeException;
class ValidThemeValidator extends ConstraintValidator
{
private array $available_themes;
public function __construct(array $available_themes)
public function __construct(private readonly array $available_themes)
{
$this->available_themes = $available_themes;
}
public function validate($value, Constraint $constraint)