DependencyInjection/ClientFactory.php
protected function setupUserDetection(Client $client, TokenStorageInterface $tokens, AuthorizationCheckerInterface $checker)
    {
        $client->registerCallback(new CustomUser(function () use ($tokens, $checker) {
            $token = $tokens->getToken();

            if (!$token || !$checker->isGranted('IS_AUTHENTICATED_REMEMBERED')) {
                return;
            }

            $user = $token->getUser();

            if ($user instanceof UserInterface) {
                return ['id' => $user->getUsername()];
            }

            return ['id' => (string) $user];
        }));
    }
protected function setupUserDetection(Client $client, TokenStorageInterface $tokens, AuthorizationCheckerInterface $checker)
    {
        $client->registerCallback(new CustomUser(function () use ($tokens, $checker) {
            $token = $tokens->getToken();

            if (!$token || !$checker->isGranted('IS_AUTHENTICATED_REMEMBERED')) {
                return;
            }

            $user = $token->getUser();

            if ($user instanceof UserInterface) {
                return ['id' => $user->getUsername()];
            }

            return ['id' => (string) $user];
        }));
    }
protected function setupUserDetection ( Client $ client , TokenStorageInterface $ tokens , AuthorizationCheckerInterface $ checker ) { $ client -> registerCallback ( new CustomUser ( function ( ) use ( $ tokens , $ checker ) { $ token = $ tokens -> getToken ( ) ; if ( ! $ token || ! $ checker -> isGranted ( 'IS_AUTHENTICATED_REMEMBERED' ) ) { return ; } $ user = $ token -> getUser ( ) ; if ( $ user instanceof UserInterface ) { return [ 'id' => $ user -> getUsername ( ) ] ; } return [ 'id' => ( string ) $ user ] ; } ) ) ; }
Setup user detection.

@param \Bugsnag\Client                                                                     $client
@param \Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorageInterface $tokens
@param \Symfony\Component\Security\Core\Authorization\AuthorizationCheckerInterface        $checker

@return void
Setup user detection .