Commit 2009bded233 for php
commit 2009bded233ba85ec09bd3ffe76c838c724646b7
Author: Jordi Kroon <jkroon@onyourmarks.agency>
Date: Sat Nov 21 22:52:44 2026 +0100
gen_stub: do not add xi:fallback to generated xi:include elements (#25533)
While there, fix inherited member includes for namespaced parent classes.
diff --git a/build/gen_stub.php b/build/gen_stub.php
index 61662ec025b..763b82bc230 100755
--- a/build/gen_stub.php
+++ b/build/gen_stub.php
@@ -3981,8 +3981,7 @@ public function getClassSynopsisElement(DOMDocument $doc, array $classMap, array
$classSynopsis->appendChild(new DOMText("\n$classSynopsisIndentation "));
$includeElement = $this->createIncludeElement(
$doc,
- "xmlns(db=http://docbook.org/ns/docbook) xpointer(id('$classReference')/db:refentry/db:refsect1[@role='description']/descendant::db:constructorsynopsis[@role='$escapedName'])",
- $classSynopsisIndentationLevel + 1
+ "xmlns(db=http://docbook.org/ns/docbook) xpointer(id('$classReference')/db:refentry/db:refsect1[@role='description']/descendant::db:constructorsynopsis[@role='$escapedName'])"
);
$classSynopsis->appendChild($includeElement);
}
@@ -3991,8 +3990,7 @@ public function getClassSynopsisElement(DOMDocument $doc, array $classMap, array
$classSynopsis->appendChild(new DOMText("\n$classSynopsisIndentation "));
$includeElement = $this->createIncludeElement(
$doc,
- "xmlns(db=http://docbook.org/ns/docbook) xpointer(id('$classReference')/db:refentry/db:refsect1[@role='description']/descendant::db:methodsynopsis[@role='$escapedName'])",
- $classSynopsisIndentationLevel + 1
+ "xmlns(db=http://docbook.org/ns/docbook) xpointer(id('$classReference')/db:refentry/db:refsect1[@role='description']/descendant::db:methodsynopsis[@role='$escapedName'])"
);
$classSynopsis->appendChild($includeElement);
}
@@ -4001,8 +3999,7 @@ public function getClassSynopsisElement(DOMDocument $doc, array $classMap, array
$classSynopsis->appendChild(new DOMText("\n$classSynopsisIndentation "));
$includeElement = $this->createIncludeElement(
$doc,
- "xmlns(db=http://docbook.org/ns/docbook) xpointer(id('$classReference')/db:refentry/db:refsect1[@role='description']/descendant::db:destructorsynopsis[@role='$escapedName'])",
- $classSynopsisIndentationLevel + 1
+ "xmlns(db=http://docbook.org/ns/docbook) xpointer(id('$classReference')/db:refentry/db:refsect1[@role='description']/descendant::db:destructorsynopsis[@role='$escapedName'])"
);
$classSynopsis->appendChild($includeElement);
}
@@ -4025,8 +4022,7 @@ public function getClassSynopsisElement(DOMDocument $doc, array $classMap, array
$classSynopsis->appendChild(new DOMText("\n$classSynopsisIndentation "));
$includeElement = $this->createIncludeElement(
$doc,
- "xmlns(db=http://docbook.org/ns/docbook) xpointer(id('$parentReference')/db:refentry/db:refsect1[@role='description']/descendant::db:{$parentMethodsynopsisType}[@role='$escapedParentName'])",
- $classSynopsisIndentationLevel + 1
+ "xmlns(db=http://docbook.org/ns/docbook) xpointer(id('$parentReference')/db:refentry/db:refsect1[@role='description']/descendant::db:{$parentMethodsynopsisType}[@role='$escapedParentName'])"
);
$classSynopsis->appendChild($includeElement);
@@ -4252,18 +4248,12 @@ public function getClassName(): string {
return $this->name->getLast();
}
- private function createIncludeElement(DOMDocument $doc, string $query, int $indentationLevel): DOMElement
+ private function createIncludeElement(DOMDocument $doc, string $query): DOMElement
{
- $indentation = str_repeat(" ", $indentationLevel);
-
$includeElement = $doc->createElement("xi:include");
$attr = $doc->createAttribute("xpointer");
$attr->value = $query;
$includeElement->appendChild($attr);
- $fallbackElement = $doc->createElement("xi:fallback");
- $includeElement->appendChild(new DOMText("\n$indentation "));
- $includeElement->appendChild($fallbackElement);
- $includeElement->appendChild(new DOMText("\n$indentation"));
return $includeElement;
}
@@ -4294,11 +4284,11 @@ private function appendInheritedMemberSectionToClassSynopsis(DOMDocument $doc, D
foreach ($parents as $parent) {
$classSynopsis->appendChild(new DOMText("\n$indentation"));
$parentReference = self::getClassSynopsisReference($parent);
+ $parentSynopsis = count($parent->getParts()) > 1 ?"db:packagesynopsis/db:classsynopsis" : "db:classsynopsis";
$includeElement = $this->createIncludeElement(
$doc,
- "xmlns(db=http://docbook.org/ns/docbook) xpointer(id('$parentReference')/db:partintro/db:section/db:classsynopsis/db:fieldsynopsis[preceding-sibling::db:classsynopsisinfo[1][@role='comment' and text()='$label']]))",
- $indentationLevel
+ "xmlns(db=http://docbook.org/ns/docbook) xpointer(id('$parentReference')/db:partintro/db:section/$parentSynopsis/db:fieldsynopsis[preceding-sibling::db:classsynopsisinfo[1][@role='comment' and text()='$label']]))"
);
$classSynopsis->appendChild($includeElement);
}