Skip to content

Fix docs build: php-parser 4.x, vendored dependency#251

Open
sirreal wants to merge 23 commits intoWordPress:masterfrom
sirreal:fix/update-through-to-phparser-4x-depend-on-github
Open

Fix docs build: php-parser 4.x, vendored dependency#251
sirreal wants to merge 23 commits intoWordPress:masterfrom
sirreal:fix/update-through-to-phparser-4x-depend-on-github

Conversation

@sirreal
Copy link
Member

@sirreal sirreal commented Feb 13, 2026

Update packages and make necessary changes to process current all syntax currently in https://github.com/WordPress/wordpress-develop trunk.

This includes the 3.x phpdocumenter/Reflection package in the repository with the necessary fixes to allow nikic/php-parser to be upgraded.

That work is taken from dmsnell/Reflection@50f8afb

Alternative to #247

This builds on the work started with @dmsnell.

@sirreal
Copy link
Member Author

sirreal commented Feb 13, 2026

Here's the WP_HTML_Processor, updated local export on left, current on right:

Screenshot 2026-02-13 at 17 15 54

Copy link
Member

@dmsnell dmsnell left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

did you consider a git submodule for the vendoring? it makes me a bit nervous that we have no history or lineage from he Reflector source showing what has changed, and we have no way to easily update it should another 3.x update come about (not that we would expect one).

public function getType()
{
if ( $this->node->type instanceof \PhpParser\Node\NullableType ) {
return "?{$this->node->type->type}";
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this change, for example, seems lost in the vendoring even though it’s a fix on top of the old code. noting here for future reference — I know you are aware of this.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, I'd be happy to clean up history so that the vendoring is its own commit and changes are separate commits.

@sirreal
Copy link
Member Author

sirreal commented Feb 13, 2026

did you consider a git submodule for the vendoring?

Not really. I just wanted to get this working without needing to work with a tight feedback loop and not need to work through multiple repositories.

We could preserve some history, at least with a trail of the pristine state (referencing the exact version that was used initially) and keep our changes separate.


This seems sufficient and simple for the time being. I expect:

  • Little to no activity on the 3.x branch from the upstream project
  • The next changes to this repo may be moving to 4.x or other more current versions of phpdocumentor dependencies.

@sirreal
Copy link
Member Author

sirreal commented Feb 13, 2026

I have the full phpunit suite passing locally and hooks were broken in the generated docs but they do seem to be working now.

I believe things are working as expected. There are almost certainly more things to fix or improve, but at least this is capable of generating up-to-date docs.

@sirreal sirreal marked this pull request as ready for review February 13, 2026 17:46
@sirreal sirreal changed the title Fix/update through to phparser 4x depend on GitHub Fix docs build: php-parser 4.x, vendored dependency Feb 13, 2026
@dmsnell
Copy link
Member

dmsnell commented Feb 13, 2026

Not to lose this: I believe that currently, due to changes in nikic/php-parser all global identifiers now receive a leading global namespace prefix, \, which did not before. so, for example, trim() is \trim()

this doesn’t seem to be a real problem, though we may try and finesse this after it’s working again to remove that if we prefer.

@sirreal
Copy link
Member Author

sirreal commented Feb 13, 2026

This is the only issue I've seen and it only seems to affect this hook:

This is my local build of script_module_data_{$module_id} filter.

Screenshot 2026-02-13 at 19 08 28

I'm not sure why the source isn't present because the line number seems to be correct.

dmsnell added a commit to dmsnell/phpdoc-parser that referenced this pull request Feb 18, 2026
Co-authored-by: Jon Surrell <jonsurrell@git.wordpress.org>
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.

2 participants

Comments