mirror of
https://github.com/Part-DB/Part-DB-server.git
synced 2025-06-28 04:30:08 +02:00
Fixed some more phpstan issues
This commit is contained in:
parent
2f46fbfc7a
commit
e8771ea118
77 changed files with 192 additions and 109 deletions
|
@ -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()) {
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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;
|
||||
|
||||
|
|
|
@ -44,7 +44,7 @@ class UserVoter extends ExtendedVoter
|
|||
$this->resolver->listOperationsForPermission('self'),
|
||||
['info']
|
||||
),
|
||||
false
|
||||
true
|
||||
);
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue