fix: type mismatches and handle nullable values

This commit is contained in:
fromme committed 2026-08-27 10:16:03 +02:00
1 parent c33c1b6bf0
commit e7f3233dbc
9 files changed
+67 -47

No files matched your search

@@ -0,0 +1,20 @@
<?php
namespace App\Controller\Traits;
use App\Entity\User;
use Symfony\Component\Security\Core\Exception\AuthenticationException;
trait AuthenticatedUserTrait
{
public function getAuthenticatedUser(): User
{
$user = $this->getUser();
if (null === $user) {
throw new AuthenticationException();
}
return $user;
}
}