mirror of
https://github.com/Part-DB/Part-DB-server.git
synced 2025-08-23 11:08:32 +02:00
Fixed PHPstan issues
This commit is contained in:
parent
6be55d1837
commit
f265b9d19d
5 changed files with 53 additions and 15 deletions
|
@ -411,6 +411,9 @@ class UserSettingsController extends AbstractController
|
|||
$this->denyAccessUnlessGranted('IS_AUTHENTICATED_FULLY');
|
||||
|
||||
$token = new ApiToken();
|
||||
if (!$this->getUser() instanceof User) {
|
||||
throw new RuntimeException('This controller only works only for Part-DB User objects!');
|
||||
}
|
||||
$token->setUser($this->getUser());
|
||||
|
||||
$secret = null;
|
||||
|
|
|
@ -36,9 +36,8 @@ use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity;
|
|||
class MeasurementUnitAttachment extends Attachment
|
||||
{
|
||||
final public const ALLOWED_ELEMENT_CLASS = MeasurementUnit::class;
|
||||
/**
|
||||
* @var Manufacturer|null the element this attachment is associated with
|
||||
*/
|
||||
|
||||
|
||||
#[ORM\ManyToOne(targetEntity: MeasurementUnit::class, inversedBy: 'attachments')]
|
||||
#[ORM\JoinColumn(name: 'element_id', nullable: false, onDelete: 'CASCADE')]
|
||||
protected ?AttachmentContainingDBElement $element = null;
|
||||
|
|
|
@ -118,12 +118,8 @@ class ApiTokenAuthenticator implements AuthenticatorInterface
|
|||
|
||||
public function onAuthenticationFailure(Request $request, AuthenticationException $exception): Response
|
||||
{
|
||||
if (null !== $this->translator) {
|
||||
$errorMessage = $this->translator->trans($exception->getMessageKey(), $exception->getMessageData(),
|
||||
'security');
|
||||
} else {
|
||||
$errorMessage = strtr($exception->getMessageKey(), $exception->getMessageData());
|
||||
}
|
||||
$errorMessage = $this->translator->trans($exception->getMessageKey(), $exception->getMessageData(),
|
||||
'security');
|
||||
|
||||
return new Response(
|
||||
null,
|
||||
|
@ -152,8 +148,9 @@ class ApiTokenAuthenticator implements AuthenticatorInterface
|
|||
|
||||
return sprintf('Bearer %s', implode(',', $values));
|
||||
}
|
||||
public function onAuthenticationSuccess(Request $request, TokenInterface $token, string $firewallName): ?Response
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
public function onAuthenticationSuccess(Request $request, TokenInterface $token, string $firewallName): ?Response
|
||||
{
|
||||
return null;
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue