From f9122341d17ea2e300487ccffe84a79c3e07c9d2 Mon Sep 17 00:00:00 2001 From: Julie Lenaerts Date: Tue, 9 Jul 2024 13:30:58 +0200 Subject: [PATCH] Fix phpstan error in match() function --- .../Security/Authorization/AsyncUploadVoter.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/Bundle/ChillDocStoreBundle/Security/Authorization/AsyncUploadVoter.php b/src/Bundle/ChillDocStoreBundle/Security/Authorization/AsyncUploadVoter.php index 25981db1e..708df0467 100644 --- a/src/Bundle/ChillDocStoreBundle/Security/Authorization/AsyncUploadVoter.php +++ b/src/Bundle/ChillDocStoreBundle/Security/Authorization/AsyncUploadVoter.php @@ -34,16 +34,16 @@ final class AsyncUploadVoter extends Voter protected function voteOnAttribute($attribute, $subject, TokenInterface $token): bool { /** @var SignedUrl $subject */ - if (!in_array($subject->method, ['POST', 'GET', 'HEAD'], true)) { + if (!in_array($subject->method, ['POST', 'GET', 'HEAD', 'PUT'], true)) { return false; } $storedObject = $this->storedObjectRepository->findOneBy(['filename' => $subject->object_name]); return match ($subject->method) { - 'GET' => $this->security->isGranted(StoredObjectRoleEnum::SEE->value, $storedObject), + 'GET', 'HEAD' => $this->security->isGranted(StoredObjectRoleEnum::SEE->value, $storedObject), 'PUT' => $this->security->isGranted(StoredObjectRoleEnum::EDIT->value, $storedObject), - 'POST', 'HEAD' => $this->security->isGranted('ROLE_USER') || $this->security->isGranted('ROLE_ADMIN') + 'POST' => $this->security->isGranted('ROLE_USER') || $this->security->isGranted('ROLE_ADMIN') }; } }