public function getUser()
    {
        /** @var TokenInterface $token */
        $token = $this->application['security.token_storage']->getToken();
        if (null === $token) {
            return null;
        }

        $user = $token->getUser();
        if (!is_object($user)) {
            return null;
        }

        return $user;
    }
public function getUser()
    {
        /** @var TokenInterface $token */
        $token = $this->application['security.token_storage']->getToken();
        if (null === $token) {
            return null;
        }

        $user = $token->getUser();
        if (!is_object($user)) {
            return null;
        }

        return $user;
    }
public function getUser ( ) { /** @var TokenInterface $token */ $ token = $ this -> application [ 'security.token_storage' ] -> getToken ( ) ; if ( null === $ token ) { return null ; } $ user = $ token -> getUser ( ) ; if ( ! is_object ( $ user ) ) { return null ; } return $ user ; }
Gets a user from the Security Token Storage.

@return UserInterface|null
Gets a user from the Security Token Storage .