Fix phpstan error in match() function

This commit is contained in:
Julie Lenaerts 2024-07-09 13:30:58 +02:00
parent 7dd5f542a6
commit f9122341d1

View File

@ -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')
};
}
}