Repository navigation
Code Quality: Annotate WP_HTML_Processor::next_token() as impure for PHPStan - #14183
rejaulalomkhan wants to merge 2 commits into
Conversation
|
The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the Core Committers: Use this line as a base for the props when committing in SVN: To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook. |
…PHPStan. WP_HTML_Processor::next_token() advances the internal parser state, mutates element queues, and changes current depth and bookmarks as side effects. PHPStan inferred the method as pure, which caused loops in WP_Block::replace_rich_text() to be analyzed as constant and led to a false positive booleanOr.alwaysTrue error. Annotating next_token() with @phpstan-impure accurately reflects its side-effecting behavior and allows the booleanOr.alwaysTrue baseline to be retired. Follow-up to [63301], [63357]. See #65817.
3644f9a to
f6ed4ba
Compare
Test using WordPress PlaygroundThe changes in this pull request can previewed and tested using a WordPress Playground instance. WordPress Playground is an experimental project that creates a full WordPress instance entirely within the browser. Some things to be aware of
For more details about these limitations and more, check out the Limitations page in the WordPress Playground documentation. |
|
Thanks for the PR, @rejaulalomkhan! This is the same The PHPStan job is failing here because the annotation also resolves two other ignored errors in Would you mind closing this in favour of #14037? Happy to have your review there. AI Review: Opus 5.5 |
Description
WP_HTML_Processor::next_token()advances the internal parser state, mutates element queues, and changes current depth and bookmarks as side effects. PHPStan inferred the method as pure, which caused loops inWP_Block::replace_rich_text()to be analyzed as constant and led to a false positivebooleanOr.alwaysTrueerror.Annotating
next_token()with@phpstan-impureaccurately reflects its side-effecting behavior and allows thebooleanOr.alwaysTruebaseline to be retired.Follow-up to [63301], [63357].
Trac ticket: https://core.trac.wordpress.org/ticket/65817
This Pull Request is for code review only. Please keep all other discussion in the Trac ticket. Do not merge this Pull Request outside of WordPress Core Trac.