55namespace SimpleSAML \XML ;
66
77use DOMDocument ;
8- use LIBXML_COMPACT ;
9- use LIBXML_NONET ;
10- use LIBXML_NO_XXE ;
11- use LIBXML_NSCLEAN ;
128use SimpleSAML \Assert \Assert ;
13- use SimpleSAML \XML \Exception \IOException ;
14- use SimpleSAML \XML \Exception \RuntimeException ;
15- use SimpleSAML \XML \Exception \UnparseableXMLException ;
16- use XML_DOCUMENT_TYPE_NODE ;
9+ use SimpleSAML \XML \Exception \{IOException , RuntimeException , UnparseableXMLException };
1710
1811use function file_get_contents ;
1912use function func_num_args ;
@@ -31,7 +24,7 @@ final class DOMDocumentFactory
3124 * @var non-negative-int
3225 * TODO: Add LIBXML_NO_XXE to the defaults when PHP 8.4.0 + libxml 2.13.0 become generally available
3326 */
34- public const DEFAULT_OPTIONS = LIBXML_COMPACT | LIBXML_NONET | LIBXML_NSCLEAN ;
27+ public const DEFAULT_OPTIONS = \ LIBXML_COMPACT | \ LIBXML_NONET | \ LIBXML_NSCLEAN ;
3528
3629
3730 /**
@@ -58,7 +51,7 @@ public static function fromString(
5851
5952 // If LIBXML_NO_XXE is available and option not set
6053 if (func_num_args () === 1 && defined ('LIBXML_NO_XXE ' )) {
61- $ options |= LIBXML_NO_XXE ;
54+ $ options |= \ LIBXML_NO_XXE ;
6255 }
6356
6457 $ domDocument = self ::create ();
@@ -77,7 +70,7 @@ public static function fromString(
7770
7871 foreach ($ domDocument ->childNodes as $ child ) {
7972 Assert::false (
80- $ child ->nodeType === XML_DOCUMENT_TYPE_NODE ,
73+ $ child ->nodeType === \ XML_DOCUMENT_TYPE_NODE ,
8174 'Dangerous XML detected, DOCTYPE nodes are not allowed in the XML body ' ,
8275 RuntimeException::class,
8376 );
0 commit comments