Repository navigation
gen_stub: arg --replace-predefined-constants on entries with several constants - #25531
jordikroon wants to merge 1 commit into
Conversation
|
I've already attempted to fix this problem the other way around a long while ago: php/doc-en#5434 Actually, Gina recommended this approach to fix the markup: php/doc-en#5516 (comment) So instead of doing a workaround in the stubs, I'd prefer to fix the markup so that even those constant documentations can be generated that have aliases. |
118705e to
8f8ef8e
Compare
|
@kocsismate I was more focused towards fixing the error. It slipped my mind that we discussed this before. So this is a good moment to fix it. |
| $manualConstantElement = $manualTermElement->getElementsByTagName("constant")->item(0); | ||
| $manualConstantElements = $manualTermElement->getElementsByTagName("constant"); | ||
| $manualConstantElement = $manualConstantElements->item(0); | ||
| if (!$manualConstantElement instanceof DOMElement) { |
There was a problem hiding this comment.
The gen_stub --verify-manual now reports some constants as missing which are in in fact documented. As far as I can see, they appear in a row as a 2nd item. E.g.:
Warning: Missing predefined constant for Dom\INDEX_SIZE_ERR
| $element->appendChild($constantElement); | ||
| foreach ($manualConstantElements as $i => $manualConstantElement) { | ||
| $constantElement = $doc->createElement("constant"); | ||
| $constantElement->textContent = $manualConstantElement->textContent; |
There was a problem hiding this comment.
what about using cloneNode() here instead of the manual element reconstruction (which was even more incomplete before)?
Companion to php/doc-en#6123, which documents a constant together with its aliases in a single term, as proposed in php/doc-en#5516 (comment):
build/gen_stub.php --replace-predefined-constantsassumed one constant per<term>/<entry>, so it could not regenerate this markup. It now handles several:To test: