Use regex to make the newer PHP syntax work in the older PHP Parser we're using.#248
Closed
Use regex to make the newer PHP syntax work in the older PHP Parser we're using.#248
Conversation
…erstand. This also requires a patch against phpdocumentor/reflection.
Member
|
FYI I started work on rewriting the parser (using an AI coding agent) in #247 but it needs more work. Edit: Actually it's in a good place! Tests are all passing but it needs review. |
Member
Author
|
@johnbillion Oh! I didn't realise that was in a good state, I thought it was a long way off.. I'll run a full export of the codebase using this PR, and then with that PR, and see what the diffs between the generated data is! |
Member
Author
|
closing in favour of #247 as this allowed things to not-fatal, but didn't seem to generate a full exported doc. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
See #246, #228.
Since I have no hope of personally being able to upgrade the parser any time soon, I took a different approach of making the existing parser work with current-day WordPress.
This requires "downgrading" PHP syntax used in Core to a syntax that the parser recognises.
I've attempted to not edit the source files on disk, such that the source importer gets the correct source.
I've attempted to keep the syntax that it's converted to mostly the same meaning as the existing code, this ensures that any fancyness in resolving that the parser includes still works.
There may have been libraries to transpile WordPress into PHP5 syntax, but I didn't want to use this as it would alter the line numbers of code, causing the source extractor to fail to find the correct code.
This has been tested within the included wp-env environment only.
Unfortunately I didn't take note of examples of the code that each regex is affecting, so you might just have to take my word for it..
I'll try running this on WordPress.org tomorrow to update developer.w.org