Repository navigation
Commit b67aa85
committed
Code Quality: Resolve the empty.variable PHPStan errors.
In `WP_Query::parse_search()` the search clause can never be empty after its loop, since at least one search term is always populated before the loop is reached, and in `WP_Query::get_posts()` every queried post type appends a clause to `$status_type_clauses`, so the checks guarding both are removed. In `wp_unique_term_slug()` the loop over parent terms is now a `do`/`while`, because the parent is already known to be non-empty before the first iteration, and the separate check for the end of the ancestry duplicated the loop condition. Behavior is unchanged in all three cases. Removing these empties the baseline, so it is removed.
The term object passed to `wp_unique_term_slug()` is also documented with an object shape, which requires the `taxonomy` property that PHPStan otherwise reports as undefined on a plain `object`.
Developed in #16242.
Follow-up to r51276, r63019.
Props sunasty, westonruter, mukesh27.
See #66739.
git-svn-id: https://develop.svn.wordpress.org/trunk@65789 602fd350-edb4-49c9-b593-d223f7449a821 parent 0f1f20a commit b67aa85
3 files changed
Lines changed: 8 additions & 48 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1554 | 1554 | | |
1555 | 1555 | | |
1556 | 1556 | | |
1557 | | - | |
1558 | | - | |
1559 | | - | |
1560 | | - | |
1561 | | - | |
| 1557 | + | |
| 1558 | + | |
| 1559 | + | |
1562 | 1560 | | |
1563 | 1561 | | |
1564 | 1562 | | |
| |||
2784 | 2782 | | |
2785 | 2783 | | |
2786 | 2784 | | |
2787 | | - | |
2788 | | - | |
2789 | | - | |
| 2785 | + | |
2790 | 2786 | | |
2791 | 2787 | | |
2792 | 2788 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3271 | 3271 | | |
3272 | 3272 | | |
3273 | 3273 | | |
| 3274 | + | |
| 3275 | + | |
3274 | 3276 | | |
3275 | 3277 | | |
3276 | 3278 | | |
| |||
3290 | 3292 | | |
3291 | 3293 | | |
3292 | 3294 | | |
3293 | | - | |
| 3295 | + | |
3294 | 3296 | | |
3295 | 3297 | | |
3296 | 3298 | | |
| |||
3300 | 3302 | | |
3301 | 3303 | | |
3302 | 3304 | | |
3303 | | - | |
3304 | | - | |
3305 | | - | |
3306 | 3305 | | |
3307 | | - | |
| 3306 | + | |
3308 | 3307 | | |
3309 | 3308 | | |
3310 | 3309 | | |
| |||
This file was deleted.
0 commit comments