Skip to content

Commit 02c2cfa

Browse files
authored
Add support for non-parameter attribute rendering in stubs (#16926)
1 parent 90b66ed commit 02c2cfa

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

build/gen_stub.php

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2086,6 +2086,13 @@ public function getMethodSynopsisElement(array $funcMap, array $aliasMap, DOMDoc
20862086

20872087
$methodSynopsis->appendChild(new DOMText("\n "));
20882088

2089+
foreach ($this->attributes as $attribute) {
2090+
$modifier = $doc->createElement("modifier", "#[\\" . $attribute->class . "]");
2091+
$modifier->setAttribute("role", "attribute");
2092+
$methodSynopsis->appendChild($modifier);
2093+
$methodSynopsis->appendChild(new DOMText("\n "));
2094+
}
2095+
20892096
foreach ($this->getModifierNames() as $modifierString) {
20902097
$modifierElement = $doc->createElement('modifier', $modifierString);
20912098
$methodSynopsis->appendChild($modifierElement);
@@ -3870,6 +3877,13 @@ private static function createOoElement(
38703877
$ooElement->appendChild($doc->createElement('modifier', $modifierOverride));
38713878
$ooElement->appendChild(new DOMText("\n$indentation "));
38723879
} elseif ($withModifiers) {
3880+
foreach ($classInfo->attributes as $attribute) {
3881+
$modifier = $doc->createElement("modifier", "#[\\" . $attribute->class . "]");
3882+
$modifier->setAttribute("role", "attribute");
3883+
$ooElement->appendChild($modifier);
3884+
$ooElement->appendChild(new DOMText("\n$indentation "));
3885+
}
3886+
38733887
if ($classInfo->flags & Modifiers::FINAL) {
38743888
$ooElement->appendChild($doc->createElement('modifier', 'final'));
38753889
$ooElement->appendChild(new DOMText("\n$indentation "));

0 commit comments

Comments
 (0)