File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -153,20 +153,18 @@ public static function normalizeDocument(Dom\XMLDocument $doc): Dom\XMLDocument
153153
154154 /**
155155 * @param \Dom\Element $elt
156- * @param string $prefix
156+ * @param string|null $prefix
157157 */
158- public static function lookupNamespaceURI (Dom \Element $ elt , string $ prefix ): ?string
158+ public static function lookupNamespaceURI (Dom \Element $ elt , ? string $ prefix ): ?string
159159 {
160160 /** @var \Dom\NamespaceInfo[] $namespaces */
161161 $ namespaces = $ elt ->ownerDocument ->documentElement ->getInScopeNamespaces ();
162162
163163 $ xmlnsAttributes = [];
164164 foreach ($ namespaces as $ ns ) {
165- $ xmlnsAttributes [$ ns ->prefix ] = $ ns ->namespaceURI ;
166- }
167-
168- if (array_key_exists ($ prefix , $ xmlnsAttributes )) {
169- return $ xmlnsAttributes [$ prefix ];
165+ if ($ ns ->prefix === $ prefix ) {
166+ return $ ns ->namespaceURI ;
167+ }
170168 }
171169
172170 return null ;
You can’t perform that action at this time.
0 commit comments