protected static function filterComponent($component): ?string
    {
        if ($component instanceof UriComponentInterface) {
            return $component->getContent();
        }

        if (null === $component) {
            return $component;
        }

        if (!is_scalar($component) && !method_exists($component, '__toString')) {
            throw new TypeError(sprintf('Expected component to be stringable; received %s', gettype($component)));
        }

        $component = (string) $component;
        if (1 !== preg_match(self::REGEXP_INVALID_URI_CHARS, $component)) {
            return $component;
        }

        throw new SyntaxError(sprintf('Invalid component string: %s', $component));
    }
protected static function filterComponent($component): ?string
    {
        if ($component instanceof UriComponentInterface) {
            return $component->getContent();
        }

        if (null === $component) {
            return $component;
        }

        if (!is_scalar($component) && !method_exists($component, '__toString')) {
            throw new TypeError(sprintf('Expected component to be stringable; received %s', gettype($component)));
        }

        $component = (string) $component;
        if (1 !== preg_match(self::REGEXP_INVALID_URI_CHARS, $component)) {
            return $component;
        }

        throw new SyntaxError(sprintf('Invalid component string: %s', $component));
    }
protected static function filterComponent ( $ component ) : ? string { if ( $ component instanceof UriComponentInterface ) { return $ component -> getContent ( ) ; } if ( null === $ component ) { return $ component ; } if ( ! is_scalar ( $ component ) && ! method_exists ( $ component , '__toString' ) ) { throw new TypeError ( sprintf ( 'Expected component to be stringable; received %s' , gettype ( $ component ) ) ) ; } $ component = ( string ) $ component ; if ( 1 !== preg_match ( self :: REGEXP_INVALID_URI_CHARS , $ component ) ) { return $ component ; } throw new SyntaxError ( sprintf ( 'Invalid component string: %s' , $ component ) ) ; }
Filter the input component.

@throws SyntaxError If the component can not be converted to a string or null
Filter the input component .