public static function throwFromLibXml()
    {
        $errors = libxml_get_errors();
        if (count($errors)) {
            libxml_clear_errors();
        }
        $lastException = null;
        /** @var \LibXMLError $error */
        foreach ($errors as $error) {
            $current = new self($error->message, 0, $lastException);
            $lastException = $current;
        }
        if (null !== $lastException) {
            throw $lastException;
        }
    }
public static function throwFromLibXml()
    {
        $errors = libxml_get_errors();
        if (count($errors)) {
            libxml_clear_errors();
        }
        $lastException = null;
        /** @var \LibXMLError $error */
        foreach ($errors as $error) {
            $current = new self($error->message, 0, $lastException);
            $lastException = $current;
        }
        if (null !== $lastException) {
            throw $lastException;
        }
    }
public static function throwFromLibXml ( ) { $ errors = libxml_get_errors ( ) ; if ( count ( $ errors ) ) { libxml_clear_errors ( ) ; } $ lastException = null ; /** @var \LibXMLError $error */ foreach ( $ errors as $ error ) { $ current = new self ( $ error -> message , 0 , $ lastException ) ; $ lastException = $ current ; } if ( null !== $ lastException ) { throw $ lastException ; } }
Checks for errors in libxml, if found clear the errors and chain all the error messages

@throws LibXmlException when found a libxml error
Checks for errors in libxml if found clear the errors and chain all the error messages