Fixed some more phpstan issues

This commit is contained in:
Jan Böhmer 2023-06-18 00:00:58 +02:00
parent 2f46fbfc7a
commit e8771ea118
77 changed files with 192 additions and 109 deletions

View file

@ -52,7 +52,7 @@ class EnsureSAMLUserForSAMLLoginChecker implements EventSubscriberInterface
//If we are using SAML, we need to check that the user is a SAML user.
if ($token instanceof SamlToken) {
if ($user instanceof User && !$user->isSAMLUser()) {
if ($user instanceof User && !$user->isSamlUser()) {
throw new CustomUserMessageAccountStatusException($this->translator->trans('saml.error.cannot_login_local_user_per_saml', [], 'security'));
}
} elseif ($user instanceof User && $user->isSamlUser()) {

View file

@ -110,7 +110,7 @@ class AttachmentVoter extends ExtendedVoter
$param = 'parts';
}
else {
throw new RuntimeException('Encountered unknown Parameter type: ' . (is_object($subject) ? $subject::class : $subject));
throw new RuntimeException('Encountered unknown Parameter type: ' . $subject);
}
return $this->resolver->inherit($user, $param, $this->mapOperation($attribute)) ?? false;

View file

@ -63,7 +63,7 @@ class LogEntryVoter extends ExtendedVoter
//To view details of a element related log entry, the user needs to be able to view the history of this entity type
$targetClass = $subject->getTargetClass();
if (null !== $targetClass) {
return $this->security->isGranted('show_history', $targetClass) ?? false;
return $this->security->isGranted('show_history', $targetClass);
}
//In other cases, this behaves like the read permission

View file

@ -63,7 +63,7 @@ class PartLotVoter extends ExtendedVoter
throw new \RuntimeException('This voter can only handle PartLot objects!');
}
if (in_array($attribute, ['withdraw', 'add', 'move']))
if (in_array($attribute, ['withdraw', 'add', 'move'], true))
{
$base_permission = $this->resolver->inherit($user, 'parts_stock', $attribute) ?? false;

View file

@ -44,7 +44,7 @@ class UserVoter extends ExtendedVoter
$this->resolver->listOperationsForPermission('self'),
['info']
),
false
true
);
}