public function withUserInfo($user, $pass = null): self
    {
        $user = $this->validateComponent($user);
        $pass = $this->validateComponent($pass);
        if (null === $user || '' === $user) {
            $pass = null;
        }

        if ($user === $this->user && $pass === $this->pass) {
            return $this;
        }

        $clone = clone $this;
        $clone->user = $user;
        $clone->pass = $pass;

        return $clone;
    }
public function withUserInfo($user, $pass = null): self
    {
        $user = $this->validateComponent($user);
        $pass = $this->validateComponent($pass);
        if (null === $user || '' === $user) {
            $pass = null;
        }

        if ($user === $this->user && $pass === $this->pass) {
            return $this;
        }

        $clone = clone $this;
        $clone->user = $user;
        $clone->pass = $pass;

        return $clone;
    }
public function withUserInfo ( $ user , $ pass = null ) : self { $ user = $ this -> validateComponent ( $ user ) ; $ pass = $ this -> validateComponent ( $ pass ) ; if ( null === $ user || '' === $ user ) { $ pass = null ; } if ( $ user === $ this -> user && $ pass === $ this -> pass ) { return $ this ; } $ clone = clone $ this ; $ clone -> user = $ user ; $ clone -> pass = $ pass ; return $ clone ; }
Return an instance with the specified user.

This method MUST retain the state of the current instance, and return
an instance that contains the specified user.

An empty user is equivalent to removing the user information.
@param null|mixed $pass
Return an instance with the specified user .