Skip to content

Commit 6844250

Browse files
committed
Remove comment, use append() method more
1 parent b2110d1 commit 6844250

File tree

1 file changed

+60
-51
lines changed

1 file changed

+60
-51
lines changed

build/gen_stub.php

Lines changed: 60 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -1554,7 +1554,7 @@ public function getMethodSynopsisDocument(array $funcMap, array $aliasMap): ?str
15541554
$descriptionRefSec->appendChild($undocumentedEntity);
15551555
$descriptionRefSec->appendChild(new DOMText("\n "));
15561556
$returnDescriptionPara = $doc->createElement('para');
1557-
$returnDescriptionPara->appendChild(new DOMText("\n Description\n "));
1557+
$returnDescriptionPara->appendChild(new DOMText("\n Description.\n "));
15581558
$descriptionRefSec->appendChild($returnDescriptionPara);
15591559

15601560
$descriptionRefSec->appendChild(new DOMText("\n "));
@@ -1573,14 +1573,14 @@ public function getMethodSynopsisDocument(array $funcMap, array $aliasMap): ?str
15731573
/* Creation of <refsect1 role="errors"> */
15741574
$errorsRefSec = $this->generateRefSect1($doc, 'errors');
15751575
$errorsDescriptionParaConstantTag = $doc->createElement('constant');
1576-
$errorsDescriptionParaConstantTag->append("E_*");
1576+
$errorsDescriptionParaConstantTag->append('E_*');
15771577
$errorsDescriptionParaExceptionTag = $doc->createElement('exceptionname');
1578-
$errorsDescriptionParaExceptionTag->append("Exception");
1578+
$errorsDescriptionParaExceptionTag->append('Exception');
15791579
$errorsDescriptionPara = $doc->createElement('para');
15801580
$errorsDescriptionPara->append(
15811581
"\n When does this function issue ",
15821582
$errorsDescriptionParaConstantTag,
1583-
" level errors, and/or throw ",
1583+
" level errors,\n and/or throw ",
15841584
$errorsDescriptionParaExceptionTag,
15851585
"s.\n "
15861586
);
@@ -1625,7 +1625,7 @@ public function getMethodSynopsisDocument(array $funcMap, array $aliasMap): ?str
16251625
$seeAlsoMemberLink = $doc->createElement('member');
16261626
$seeAlsoMemberLinkTag = $doc->createElement('link');
16271627
$seeAlsoMemberLinkTag->setAttribute('linkend', 'some.id.chunk.to.link');
1628-
$seeAlsoMemberLinkTag->appendChild(new DOMText("something appendix"));
1628+
$seeAlsoMemberLinkTag->appendChild(new DOMText('something appendix'));
16291629
$seeAlsoMemberLink->appendChild($seeAlsoMemberLinkTag);
16301630

16311631
$seeAlsoList = $doc->createElement('simplelist');
@@ -1702,23 +1702,28 @@ private function getParameterSection(DOMDocument $doc): DOMElement {
17021702
$parameterTerm = $doc->createElement('term');
17031703
$parameterTerm->appendChild($parameter);
17041704

1705-
$parameterEntry = $doc->createElement('varlistentry');
1706-
$parameterEntry->appendChild(new DOMText("\n "));
1707-
$parameterEntry->appendChild($parameterTerm);
1708-
$parameterEntry->appendChild(new DOMText("\n "));
1709-
17101705
$listItemPara = $doc->createElement('para');
1711-
$listItemPara->appendChild(new DOMText("\n "));
1712-
$listItemPara->appendChild(new DOMText("Description."));
1713-
$listItemPara->appendChild(new DOMText("\n "));
1706+
$listItemPara->append(
1707+
"\n ",
1708+
"Description.",
1709+
"\n ",
1710+
);
17141711

17151712
$parameterEntryListItem = $doc->createElement('listitem');
1716-
$parameterEntryListItem->appendChild(new DOMText("\n "));
1717-
$parameterEntryListItem->appendChild($listItemPara);
1718-
$parameterEntryListItem->appendChild(new DOMText("\n "));
1713+
$parameterEntryListItem->append(
1714+
"\n ",
1715+
$listItemPara,
1716+
"\n ",
1717+
);
17191718

1720-
$parameterEntry->appendChild($parameterEntryListItem);
1721-
$parameterEntry->appendChild(new DOMText("\n "));
1719+
$parameterEntry = $doc->createElement('varlistentry');
1720+
$parameterEntry->append(
1721+
"\n ",
1722+
$parameterTerm,
1723+
"\n ",
1724+
$parameterEntryListItem,
1725+
"\n ",
1726+
);
17221727

17231728
$parametersList->appendChild(new DOMText("\n "));
17241729
$parametersList->appendChild($parameterEntry);
@@ -1738,18 +1743,11 @@ private function getReturnValueSection(DOMDocument $doc): DOMElement {
17381743

17391744
$returnType = $this->return->getMethodSynopsisType();
17401745
if ($returnType === null) {
1741-
$returnDescriptionPara->appendChild(new DOMText("Description"));
1746+
$returnDescriptionPara->appendChild(new DOMText("Description."));
17421747
} else if (count($returnType->types) === 1) {
17431748
$type = $returnType->types[0];
17441749
$name = $type->name;
1745-
/*
1746-
$descriptionNode = match ($name) {
1747-
'void' => $doc->createEntityReference('return.void'),
1748-
'true' => $doc->createEntityReference('return.true.always'),
1749-
'bool' => $doc->createEntityReference('return.success'),
1750-
default => new DOMText("Description"),
1751-
};
1752-
*/
1750+
17531751
switch ($name) {
17541752
case 'void':
17551753
$descriptionNode = $doc->createEntityReference('return.void');
@@ -1761,12 +1759,12 @@ private function getReturnValueSection(DOMDocument $doc): DOMElement {
17611759
$descriptionNode = $doc->createEntityReference('return.success');
17621760
break;
17631761
default:
1764-
$descriptionNode = new DOMText("Description");
1762+
$descriptionNode = new DOMText("Description.");
17651763
break;
17661764
}
17671765
$returnDescriptionPara->appendChild($descriptionNode);
17681766
} else {
1769-
$returnDescriptionPara->appendChild(new DOMText("Description"));
1767+
$returnDescriptionPara->appendChild(new DOMText("Description."));
17701768
}
17711769
$returnDescriptionPara->appendChild(new DOMText("\n "));
17721770
$returnRefSec->appendChild($returnDescriptionPara);
@@ -1792,15 +1790,16 @@ private function generateDocbookInformalTable(
17921790
$headerEntry = $doc->createElement('entry');
17931791
$headerEntry->appendChild($header);
17941792

1795-
$headerRow->appendChild(new DOMText("\n$strIndent "));
1796-
$headerRow->appendChild($headerEntry);
1793+
$headerRow->append("\n$strIndent ", $headerEntry);
17971794
}
1798-
$headerRow->appendChild(new DOMText("\n$strIndent "));
1795+
$headerRow->append("\n$strIndent ");
17991796

18001797
$thead = $doc->createElement('thead');
1801-
$thead->appendChild(new DOMText("\n$strIndent "));
1802-
$thead->appendChild($headerRow);
1803-
$thead->appendChild(new DOMText("\n$strIndent "));
1798+
$thead->append(
1799+
"\n$strIndent ",
1800+
$headerRow,
1801+
"\n$strIndent ",
1802+
);
18041803

18051804
$tbody = $doc->createElement('tbody');
18061805
foreach ($rows as $row) {
@@ -1814,23 +1813,29 @@ private function generateDocbookInformalTable(
18141813
}
18151814
$bodyRow->appendChild(new DOMText("\n$strIndent "));
18161815

1817-
$tbody->appendChild(new DOMText("\n$strIndent "));
1818-
$tbody->appendChild($bodyRow);
1819-
$tbody->appendChild(new DOMText("\n$strIndent "));
1816+
$tbody->append(
1817+
"\n$strIndent ",
1818+
$bodyRow,
1819+
"\n$strIndent ",
1820+
);
18201821
}
18211822

18221823
$tgroup = $doc->createElement('tgroup');
18231824
$tgroup->setAttribute('cols', (string) $columns);
1824-
$tgroup->appendChild(new DOMText("\n$strIndent "));
1825-
$tgroup->appendChild($thead);
1826-
$tgroup->appendChild(new DOMText("\n$strIndent "));
1827-
$tgroup->appendChild($tbody);
1828-
$tgroup->appendChild(new DOMText("\n$strIndent "));
1825+
$tgroup->append(
1826+
"\n$strIndent ",
1827+
$thead,
1828+
"\n$strIndent ",
1829+
$tbody,
1830+
"\n$strIndent ",
1831+
);
18291832

18301833
$table = $doc->createElement('informaltable');
1831-
$table->appendChild(new DOMText("\n$strIndent "));
1832-
$table->appendChild($tgroup);
1833-
$table->appendChild(new DOMText("\n$strIndent"));
1834+
$table->append(
1835+
"\n$strIndent ",
1836+
$tgroup,
1837+
"\n$strIndent",
1838+
);
18341839

18351840
return $table;
18361841
}
@@ -1906,12 +1911,16 @@ private function getExampleSection(DOMDocument $doc, string $id): DOMElement {
19061911
$screen->appendChild($output);
19071912
$screen->append("\n ");
19081913

1909-
$example->append("\n ", $screen);
1910-
$example->append("\n ");
1911-
1912-
$refSec->append($example);
1914+
$example->append(
1915+
"\n ",
1916+
$screen,
1917+
"\n ",
1918+
);
19131919

1914-
$refSec->appendChild(new DOMText("\n "));
1920+
$refSec->append(
1921+
$example,
1922+
"\n ",
1923+
);
19151924
return $refSec;
19161925
}
19171926

0 commit comments

Comments
 (0)