Repository navigation
Conversation
|
The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. 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. Props Bot commandsYou can trigger Props Bot actions by commenting on this PR:
|
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. |
There was a problem hiding this comment.
🟢 Approval recommended
No active review issues remain for the PHPStan warning cleanup and baseline removal.
No open issues 🎉
What changed in this PR
Resolves the three remaining PHPStan empty.variable warnings in WordPress core and removes the corresponding baseline.
Changes:
- Removes redundant checks around search SQL and post-status clauses in
WP_Query. - Converts parent-term traversal in
wp_unique_term_slug()to ado...whileloop, eliminating duplicate termination checks. - Deletes the obsolete
empty.variablebaseline.
| File | Description |
|---|---|
tests/phpstan/baselines/empty.variable.neon |
Removes suppressions for the three resolved warnings. |
src/wp-includes/taxonomy.php |
Simplifies the parent-term loop used to generate unique slugs. |
src/wp-includes/class-wp-query.php |
Removes redundant guards around populated SQL clauses. |
Review effort: Balanced
Resolves the three remaining
empty.variablePHPStan errors and removestests/phpstan/baselines/empty.variable.neon:WP_Query::parse_search():$query_vars['search_terms']is always populated with at least one term before the loop, so$searchis always non-empty after the loop; removed the redundantif ( ! empty( $search ) )check.WP_Query::get_posts(): insideif ( ! empty( $queried_post_types ) ), every iteration appends to$status_type_clauses, so the trailingif ( ! empty( $status_type_clauses ) )check is always true and can be removed.wp_unique_term_slug():$the_parentis already verified non-empty before entering the loop and checked at the end of each iteration; converted to ado ... while ( ! empty( $the_parent ) )loop and removed the duplicateif ( empty( $parent_term->parent ) ) { break; }.Verified locally with
composer phpstan:default,composer phpstan:strict,composer lint:errors, andcomposer compat.Trac ticket: https://core.trac.wordpress.org/ticket/66739
Use of AI Tools
AI assistance: Yes
Tool(s): Antigravity
Used for: Identifying the remaining baseline occurrences and checking PHPStan/PHPCS output; all changes were reviewed and verified before submitting.
This Pull Request is for code review only. Please keep all other discussion in the Trac ticket. Do not merge this Pull Request. See GitHub Pull Requests for Code Review in the Core Handbook for more details.