Skip to content

Commit 6da90d3

Browse files
committed
[skip ci] Fix refentry attribute order
Use a creative solution because libxml otherwise forces xmlns to be the first one
1 parent c5f4f9d commit 6da90d3

File tree

1 file changed

+10
-6
lines changed

1 file changed

+10
-6
lines changed

build/gen_stub.php

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1495,21 +1495,25 @@ public function getMethodSynopsisDocument(array $funcMap, array $aliasMap): ?str
14951495
$refentry = $doc->createElement('refentry');
14961496
$doc->appendChild($refentry);
14971497

1498-
$id = $doc->createAttribute("xml:id");
14991498
if ($this->isMethod()) {
15001499
assert($this->name instanceof MethodName);
15011500
/* Namespaces are seperated by '-', '_' must be converted to '-' too.
15021501
* Trim away the __ for magic methods */
1503-
$id->value = strtolower(
1502+
$id = strtolower(
15041503
str_replace('\\', '-', $this->name->className->__toString())
15051504
. '.'
15061505
. str_replace('_', '-', ltrim($this->name->methodName, '_'))
15071506
);
15081507
} else {
1509-
$id->value = 'function.' . strtolower(str_replace('_', '-', $this->name->__toString()));
1510-
}
1511-
$refentry->appendChild($id);
1512-
$refentry->setAttribute("xmlns", "http://docbook.org/ns/docbook");
1508+
$id = 'function.' . strtolower(str_replace('_', '-', $this->name->__toString()));
1509+
}
1510+
$refentry->setAttribute("xml:id", $id);
1511+
/* We create an attribute for xmlns, as libxml otherwise force it to be the first one */
1512+
//$refentry->setAttribute("xmlns", "http://docbook.org/ns/docbook");
1513+
$namespace = $doc->createAttribute('xmlns');
1514+
$namespace->value = "http://docbook.org/ns/docbook";
1515+
$refentry->setAttributeNode($namespace);
1516+
$refentry->setAttribute("xmlns:xlink", "http://www.w3.org/1999/xlink");
15131517
$refentry->appendChild(new DOMText("\n "));
15141518

15151519
/* Creation of <refnamediv> */

0 commit comments

Comments
 (0)