mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-09-06 06:44:59 +00:00
DX: apply rector rules up to php8.0
This commit is contained in:
@@ -33,28 +33,8 @@ use UnexpectedValueException;
|
||||
*/
|
||||
class NotificationApiController
|
||||
{
|
||||
private EntityManagerInterface $entityManager;
|
||||
|
||||
private NotificationRepository $notificationRepository;
|
||||
|
||||
private PaginatorFactory $paginatorFactory;
|
||||
|
||||
private Security $security;
|
||||
|
||||
private SerializerInterface $serializer;
|
||||
|
||||
public function __construct(
|
||||
EntityManagerInterface $entityManager,
|
||||
NotificationRepository $notificationRepository,
|
||||
PaginatorFactory $paginatorFactory,
|
||||
Security $security,
|
||||
SerializerInterface $serializer
|
||||
) {
|
||||
$this->entityManager = $entityManager;
|
||||
$this->notificationRepository = $notificationRepository;
|
||||
$this->paginatorFactory = $paginatorFactory;
|
||||
$this->security = $security;
|
||||
$this->serializer = $serializer;
|
||||
public function __construct(private EntityManagerInterface $entityManager, private NotificationRepository $notificationRepository, private PaginatorFactory $paginatorFactory, private Security $security, private SerializerInterface $serializer)
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -116,20 +96,11 @@ class NotificationApiController
|
||||
throw new RuntimeException('not possible to mark as read by this user');
|
||||
}
|
||||
|
||||
switch ($target) {
|
||||
case 'read':
|
||||
$notification->markAsReadBy($user);
|
||||
|
||||
break;
|
||||
|
||||
case 'unread':
|
||||
$notification->markAsUnreadBy($user);
|
||||
|
||||
break;
|
||||
|
||||
default:
|
||||
throw new UnexpectedValueException("target not supported: {$target}");
|
||||
}
|
||||
match ($target) {
|
||||
'read' => $notification->markAsReadBy($user),
|
||||
'unread' => $notification->markAsUnreadBy($user),
|
||||
default => throw new UnexpectedValueException("target not supported: {$target}"),
|
||||
};
|
||||
|
||||
$this->entityManager->flush();
|
||||
|
||||
|
Reference in New Issue
Block a user