Fix phpstan issues

This commit is contained in:
2023-12-12 22:34:26 +01:00
parent af663cf27c
commit da997badd9
26 changed files with 275 additions and 261 deletions

View File

@@ -13,13 +13,17 @@ namespace Chill\MainBundle\Controller;
use Chill\MainBundle\CRUD\Controller\ApiController;
use Chill\MainBundle\Pagination\PaginatorInterface;
use Chill\MainBundle\Security\ChillSecurity;
use Doctrine\ORM\QueryBuilder;
use Symfony\Component\HttpFoundation\JsonResponse;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpKernel\Exception\AccessDeniedHttpException;
use Symfony\Component\Routing\Annotation\Route;
class UserApiController extends ApiController
{
public function __construct(private readonly ChillSecurity $security) {}
/**
* @Route(
* "/api/1.0/main/user-current-location.{_format}",
@@ -31,8 +35,12 @@ class UserApiController extends ApiController
*/
public function currentLocation(mixed $_format): JsonResponse
{
if (!$this->isGranted('ROLE_USER')) {
throw new AccessDeniedHttpException();
}
return $this->json(
$this->getUser()->getCurrentLocation(),
$this->security->getUser()->getCurrentLocation(),
JsonResponse::HTTP_OK,
[],
['groups' => ['read']]