mirror of
https://github.com/Part-DB/Part-DB-server.git
synced 2025-06-24 02:38:50 +02:00
Applied rector with PHP8.1 migration rules
This commit is contained in:
parent
dc6a67c2f0
commit
7ee01d9a05
303 changed files with 1228 additions and 3465 deletions
|
@ -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
|
||||
|
|
|
@ -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'
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -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)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue