Skip to content

Document each global ext/dom constant on its own row#5434

Open
kocsismate wants to merge 1 commit intophp:masterfrom
kocsismate:dom-const-links
Open

Document each global ext/dom constant on its own row#5434
kocsismate wants to merge 1 commit intophp:masterfrom
kocsismate:dom-const-links

Conversation

@kocsismate
Copy link
Member

@kocsismate kocsismate commented Mar 21, 2026

Before these changes, the gen_stub.php --verify-manual command used to fail with an exception due to ext/DOM constants being wrongly formatted: the old and new constant counterparts were documented in the same row (e.g. DOM_VALIDATION_ERR / Dom\VALIDATION_ERR) which format cannot be recognized by gen_stub.php. Instead, let's document each constant on its own row.

Related to php/php-src#21484

@kocsismate kocsismate requested a review from Girgias March 21, 2026 13:44
@kocsismate kocsismate requested a review from ndossche as a code owner March 21, 2026 13:44
@kocsismate kocsismate closed this Mar 21, 2026
@kocsismate kocsismate reopened this Mar 21, 2026
@ndossche
Copy link
Member

I think from a DX point of view, the new one is worse. I believe they should be documented together for ease.

@Girgias
Copy link
Member

Girgias commented Mar 23, 2026

I agree with @ndossche here. If the tooling is struggling then it's a tooling issue. I am happy to modify the markup if it brings more consistency (e.g. replacing the table with a <variableentrylist>) or improves the DX while also facilitating tooling.

Converting the table to use the more typical format of a <variableentrylist> with multiple <term> tags that can hold the XML ID seems a better approach than duplicating rows.

@kocsismate
Copy link
Member Author

I think the table format is correct here, as it includes the value, while the list format usually doesn't as far as I know.

There's a precedent for a similar situation at https://www.php.net/manual/en/reserved.constants.php: ZEND_THREAD_SAFE and PHP_ZTS. Here, the manual also duplicates them, but notes that PHP_ZTS is an alias of ZEND_THREAD_SAFE.

So in my opinion, a similar approach could work fine in case of ext/dom constants: we could mark them as aliases, and document them in the same row. What do you think?

Although, I should mention that personally, I don't find the separe row based approach worse, the page even looks cleaner for me because it's easier to overview the constant names. I attach two screenshots for comparison.

original:
original

new:
new

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants