Remove greater.invalid baseline and fix its issue - #13080
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. |
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. |
| $content_length = array( | ||
| 'type' => 'byte', | ||
| 'length' => $length, | ||
| ); |
There was a problem hiding this comment.
it seems like this function was written when get_col_length() could return a string, and then was moved in 1cccb02 and stuck around even though get_col_length() was changed in 2ce97b2 to never return a string. this dangled on unused.
to that end it seems like this should be safe to remove.
that being said, if we remove it we make the code fragile, because we remove a runtime-enforced type constraint with a source-time assumption about it. if get_col_length() changes again as it changed in the past, this could lead to a crash on property access of a non-array.
the original code would have been clearer as if ( is_string() ) than if ( ! is_array() ), but we could potentially remove this and leave the safety.
} elseif ( ! is_array( $content_length ) ) {
return;
}PHPStan might still complain, but avoiding crashes is more important than making the linter gods happy
Removes in total
1errors.Removes errors from the below phpstan baselines and fixes the issues that they were covering:
How ?
Removes dead else if statement.
Trac ticket: https://core.trac.wordpress.org/ticket/65817
Use of AI Tools
AI assistance: Yes
Tool(s): Claude Code
Model(s): Opus 5
Used for: Help with suggesting how to fix the phpstan output for the specific errors we are removing the baselines for. The actual result has been reviewed and are owned by me.
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.