private function findUserByUsernameOrThrowException($username)
    {
        $user = $this->userManager->findUserByUsername($username);

        if (!$user) {
            throw new InvalidArgumentException(sprintf('User identified by "%s" username does not exist.', $username));
        }

        return $user;
    }
private function findUserByUsernameOrThrowException($username)
    {
        $user = $this->userManager->findUserByUsername($username);

        if (!$user) {
            throw new InvalidArgumentException(sprintf('User identified by "%s" username does not exist.', $username));
        }

        return $user;
    }
private function findUserByUsernameOrThrowException ( $ username ) { $ user = $ this -> userManager -> findUserByUsername ( $ username ) ; if ( ! $ user ) { throw new InvalidArgumentException ( sprintf ( 'User identified by "%s" username does not exist.' , $ username ) ) ; } return $ user ; }
Finds a user by his username and throws an exception if we can't find it.

@param string $username

@throws InvalidArgumentException When user does not exist

@return UserInterface
Finds a user by his username and throws an exception if we can t find it .