Skip to content

Commit 6aa5e58

Browse files
committed
Backport methodsynopsis role attributes changes from master
Commits 93605f2 and d665142
1 parent 0fc60fa commit 6aa5e58

File tree

1 file changed

+8
-10
lines changed

1 file changed

+8
-10
lines changed

build/gen_stub.php

+8-10
Original file line numberDiff line numberDiff line change
@@ -1487,14 +1487,10 @@ public function getMethodSynopsisElement(array $funcMap, array $aliasMap, DOMDoc
14871487

14881488
$methodSynopsis = $doc->createElement($synopsisType);
14891489

1490-
$aliasedFunc = $this->aliasType === "alias" && isset($funcMap[$this->alias->__toString()]) ? $funcMap[$this->alias->__toString()] : null;
1491-
$aliasFunc = $aliasMap[$this->name->__toString()] ?? null;
1492-
1493-
if (($this->aliasType === "alias" && $aliasedFunc !== null && $aliasedFunc->isMethod() !== $this->isMethod()) ||
1494-
($aliasFunc !== null && $aliasFunc->isMethod() !== $this->isMethod())
1495-
) {
1490+
if ($this->isMethod()) {
1491+
assert($this->name instanceof MethodName);
14961492
$role = $doc->createAttribute("role");
1497-
$role->value = $this->isMethod() ? "oop" : "procedural";
1493+
$role->value = addslashes($this->name->className->__toString());
14981494
$methodSynopsis->appendChild($role);
14991495
}
15001496

@@ -2766,19 +2762,20 @@ public function getClassSynopsisElement(DOMDocument $doc, array $classMap, itera
27662762
$classSynopsis->appendChild($classSynopsisInfo);
27672763

27682764
$classReference = self::getClassSynopsisReference($this->name);
2765+
$escapedName = addslashes($this->name->__toString());
27692766

27702767
$classSynopsis->appendChild(new DOMText("\n "));
27712768
$includeElement = $this->createIncludeElement(
27722769
$doc,
2773-
"xmlns(db=http://docbook.org/ns/docbook) xpointer(id('$classReference')/db:refentry/db:refsect1[@role='description']/descendant::db:constructorsynopsis[not(@role='procedural')])"
2770+
"xmlns(db=http://docbook.org/ns/docbook) xpointer(id('$classReference')/db:refentry/db:refsect1[@role='description']/descendant::db:constructorsynopsis[@role='$escapedName'])"
27742771
);
27752772
$classSynopsis->appendChild($includeElement);
27762773

27772774
if ($this->hasMethods()) {
27782775
$classSynopsis->appendChild(new DOMText("\n "));
27792776
$includeElement = $this->createIncludeElement(
27802777
$doc,
2781-
"xmlns(db=http://docbook.org/ns/docbook) xpointer(id('$classReference')/db:refentry/db:refsect1[@role='description']/descendant::db:methodsynopsis[not(@role='procedural')])"
2778+
"xmlns(db=http://docbook.org/ns/docbook) xpointer(id('$classReference')/db:refentry/db:refsect1[@role='description']/descendant::db:methodsynopsis[@role='$escapedName'])"
27822779
);
27832780
$classSynopsis->appendChild($includeElement);
27842781
}
@@ -2787,7 +2784,7 @@ public function getClassSynopsisElement(DOMDocument $doc, array $classMap, itera
27872784
$classSynopsis->appendChild(new DOMText("\n "));
27882785
$includeElement = $this->createIncludeElement(
27892786
$doc,
2790-
"xmlns(db=http://docbook.org/ns/docbook) xpointer(id('$classReference')/db:refentry/db:refsect1[@role='description']/descendant::db:destructorsynopsis[not(@role='procedural')])"
2787+
"xmlns(db=http://docbook.org/ns/docbook) xpointer(id('$classReference')/db:refentry/db:refsect1[@role='description']/descendant::db:destructorsynopsis[@role='$escapedName'])"
27912788
);
27922789
$classSynopsis->appendChild($includeElement);
27932790
}
@@ -2801,6 +2798,7 @@ public function getClassSynopsisElement(DOMDocument $doc, array $classMap, itera
28012798
foreach ($parentsWithInheritedMethods as $parent) {
28022799
$classSynopsis->appendChild(new DOMText("\n "));
28032800
$parentReference = self::getClassSynopsisReference($parent);
2801+
$escapedParentName = addslashes($parent->__toString());
28042802
$includeElement = $this->createIncludeElement(
28052803
$doc,
28062804
"xmlns(db=http://docbook.org/ns/docbook) xpointer(id('$parentReference')/db:refentry/db:refsect1[@role='description']/descendant::db:methodsynopsis[@role='$escapedParentName'])"

0 commit comments

Comments
 (0)