Repository navigation
Commit 4be1db5
committed
Code Quality: Annotate
PHPStan infers `WP_HTML_Processor::next_token()` as pure, so the result of `is_tag_closer()` before the matching-closer loop in the block bindings processor's `replace_rich_text()` method survives across the loop, even though each `next_token()` call advances the parser to a different token. The `||` in the check after the loop is then reported as always true, the negation within it as always true, and the code that follows as unreachable. Adding `@phpstan-impure`, as was done for `WP_HTML_Tag_Processor::next_tag()` in r61934 and for `WP_HTML_Tag_Processor::parse_next_tag()` in r63301, resolves all three baselined errors.
This empties the `booleanOr.alwaysTrue` baseline, so the file is removed along with its `includes` entry in `phpstan.neon.dist`.
Developed in WordPress#14037.
Follow-up to r61934, r63023, r63301.
Props huzaifaalmesbah, rejaulalomkhan, tstokes8040.
See #65817.
git-svn-id: https://develop.svn.wordpress.org/trunk@64335 602fd350-edb4-49c9-b593-d223f7449a82WP_HTML_Processor::next_token() as "impure".1 parent 4b66251 commit 4be1db5
5 files changed
Lines changed: 2 additions & 36 deletions
File tree
- src/wp-includes/html-api
- tests/phpstan/baselines
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
32 | 32 | | |
33 | 33 | | |
34 | 34 | | |
35 | | - | |
36 | 35 | | |
37 | 36 | | |
38 | 37 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
779 | 779 | | |
780 | 780 | | |
781 | 781 | | |
| 782 | + | |
| 783 | + | |
782 | 784 | | |
783 | 785 | | |
784 | 786 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
43 | 43 | | |
44 | 44 | | |
45 | 45 | | |
46 | | - | |
47 | | - | |
48 | | - | |
49 | | - | |
50 | | - | |
51 | 46 | | |
52 | 47 | | |
53 | 48 | | |
| |||
This file was deleted.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
48 | 48 | | |
49 | 49 | | |
50 | 50 | | |
51 | | - | |
52 | | - | |
53 | | - | |
54 | | - | |
55 | | - | |
56 | 51 | | |
57 | 52 | | |
58 | 53 | | |
| |||
0 commit comments