<?php declare(strict_types=1);namespace App\Authentication\EventListener;use Lexik\Bundle\JWTAuthenticationBundle\Event\JWTNotFoundEvent;use Symfony\Component\HttpFoundation\JsonResponse;class JWTNotFoundListener{ public function onJWTNotFound(JWTNotFoundEvent $event): void { $data = [ 'code' => 'error.authentication.required', ]; $response = new JsonResponse($data, 401); $event->setResponse($response); }}