Skip to content

Commit aa747b7

Browse files
committed
[skip ci] Do not generate identical IDs
1 parent 6c415f7 commit aa747b7

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

build/gen_stub.php

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1807,11 +1807,14 @@ private function getExampleSection(DOMDocument $doc): DOMElement {
18071807
$refSec = $this->generateRefSect1($doc, 'examples');
18081808

18091809
$example = $doc->createElement('example');
1810-
$example->setAttribute('xml:id', 'func-or-method-name.example.basic');
1810+
$fnName = $this->name->__toString();
1811+
$fnNameForId = strtolower($fnName);
1812+
$fnNameForId = str_replace(['_', '\\', '::'], ['-', '-', '.'], $fnNameForId);
1813+
$example->setAttribute('xml:id', $fnNameForId . '.example.basic');
18111814

18121815
$title = $doc->createElement('title');
18131816
$fn = $doc->createElement($this->isMethod() ? 'methodname' : 'function');
1814-
$fn->append($this->name->__toString());
1817+
$fn->append($fnName);
18151818
$title->append($fn, ' example');
18161819

18171820
$example->append("\n ", $title);

0 commit comments

Comments
 (0)