private function formatUserInfo(?string $user, ?string $password): ?string
    {
        if (null === $user) {
            return $user;
        }

        static $user_pattern = '/(?:[^%'.self::REGEXP_CHARS_UNRESERVED.self::REGEXP_CHARS_SUBDELIM.']++|%(?![A-Fa-f0-9]{2}))/';
        $user = preg_replace_callback($user_pattern, [Uri::class, 'urlEncodeMatch'], $user);
        if (null === $password) {
            return $user;
        }

        static $password_pattern = '/(?:[^%:'.self::REGEXP_CHARS_UNRESERVED.self::REGEXP_CHARS_SUBDELIM.']++|%(?![A-Fa-f0-9]{2}))/';

        return $user.':'.preg_replace_callback($password_pattern, [Uri::class, 'urlEncodeMatch'], $password);
    }
private function formatUserInfo(?string $user, ?string $password): ?string
    {
        if (null === $user) {
            return $user;
        }

        static $user_pattern = '/(?:[^%'.self::REGEXP_CHARS_UNRESERVED.self::REGEXP_CHARS_SUBDELIM.']++|%(?![A-Fa-f0-9]{2}))/';
        $user = preg_replace_callback($user_pattern, [Uri::class, 'urlEncodeMatch'], $user);
        if (null === $password) {
            return $user;
        }

        static $password_pattern = '/(?:[^%:'.self::REGEXP_CHARS_UNRESERVED.self::REGEXP_CHARS_SUBDELIM.']++|%(?![A-Fa-f0-9]{2}))/';

        return $user.':'.preg_replace_callback($password_pattern, [Uri::class, 'urlEncodeMatch'], $password);
    }
private function formatUserInfo ( ? string $ user , ? string $ password ) : ? string { if ( null === $ user ) { return $ user ; } static $ user_pattern = '/(?:[^%' . self :: REGEXP_CHARS_UNRESERVED . self :: REGEXP_CHARS_SUBDELIM . ']++|%(?![A-Fa-f0-9]{2}))/' ; $ user = preg_replace_callback ( $ user_pattern , [ Uri :: class , 'urlEncodeMatch' ] , $ user ) ; if ( null === $ password ) { return $ user ; } static $ password_pattern = '/(?:[^%:' . self :: REGEXP_CHARS_UNRESERVED . self :: REGEXP_CHARS_SUBDELIM . ']++|%(?![A-Fa-f0-9]{2}))/' ; return $ user . ':' . preg_replace_callback ( $ password_pattern , [ Uri :: class , 'urlEncodeMatch' ] , $ password ) ; }
Set the UserInfo component.

@param ?string $user
@param ?string $password
Set the UserInfo component .