Skip to content

Comments

Restore ability to generate documentation JSON blob.#250

Open
dmsnell wants to merge 10 commits intoWordPress:masterfrom
dmsnell:fix/update-through-to-phparser-4x
Open

Restore ability to generate documentation JSON blob.#250
dmsnell wants to merge 10 commits intoWordPress:masterfrom
dmsnell:fix/update-through-to-phparser-4x

Conversation

@dmsnell
Copy link
Member

@dmsnell dmsnell commented Feb 12, 2026

This patch makes a few updates to unblock generating the documentation for WordPress, notably updating the underlying dependency nikic/php-parser from ^1.0 to ^3.0. Some updating is required here while some is required on the intermediate dependency on phpDocumentor/Reflection.

  • Depend on the fork dmsnell/Reflector which updates the PHP parser.
  • Changes from the PHPParser namespace/class aliases with underscores to the normal form. For example, from \PHPParser_Node to \PHPParser\Node.
  • Updates to AST changes in PHPParser: notably how names are represented and anonymous objects.

Because nikic/php-parser made a change in how it presents names, prefixing every global identifier with the namespace prefix, a cleanup pass has been added to remove it. This is optional and could be removed if the documentation wants to adopt the global namespace prefix (and there are reasons to consider that).

Changes to the phpDocumentor/Reflection dependency involve:

  • Conditionally relying on \Stringable for runs with PHP versions lacking that interface.
  • Update deprecations in certain type definitions.
  • Update naming
  • Support nullable types in the AST.

Overall there isn’t much work, and this will parse trunk with PHP 7.4. One patch was necessary in Core to unblock some syntax issues, though the syntax form would have been solvable some other way — it was easier to remove it than update the parser.

See also #251

@dmsnell dmsnell force-pushed the fix/update-through-to-phparser-4x branch 2 times, most recently from c108fbb to 0cd9903 Compare February 18, 2026 23:37
@dmsnell dmsnell changed the title Fix/update through to phparser 4x Restore ability to generate documentation JSON blob. Feb 19, 2026
@dmsnell dmsnell force-pushed the fix/update-through-to-phparser-4x branch from adbc85c to b2c0c68 Compare February 22, 2026 02:26
@dmsnell
Copy link
Member Author

dmsnell commented Feb 22, 2026

Rebuilt series of commits after previous head of adbc85c

While a previous commit “Add[ed] support for PHP Namespaces,” the
support seems mixed, or non-comprehensive. Certain names were receiving
a global namespace prefix, while others weren’t.

This commit undoes the tests asserting the particular names that were
receiving that global namespace because the global namespace prefix has
been removed in its entirety.

Newer versions of `nikic/PHPParser` provide robust support for
namespaces and produce fully-qualified names for objects, so this
support is not particularly needed going forward either.

See 42e4de3
@dmsnell dmsnell force-pushed the fix/update-through-to-phparser-4x branch from b2c0c68 to 34de87c Compare February 22, 2026 02:28
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.

1 participant