Bump PHPStan rule level to 1#11151
Conversation
Co-authored-by: Dovid Levine <david@axepress.dev>
|
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. |
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
e6bd045 to
bf92684
Compare
PHPStan cannot verify that wp_die() always terminates due to its conditional return type and treatPhpDocTypesAsCertain being disabled.
Co-authored-by: Christoph Daum <christoph.daum@coding-pioneers.com>
Co-authored-by: Weston Ruter <westonruter@gmail.com>
By increasing the PHPStan rule level to 1, the following issues will begin to be detected for new code introduced to core:
Here is the original tally of ignored errors in
tests/phpstan/baseline.phpcategorized by their PHPStan identifier:empty.variableempty()on variables that always exist, are always falsy, or are not falsyconstant.notFoundisset.variableisset()on variables that always exist, are not nullable, or are never definedvariable.undefinedarguments.countconstructor.unusedParameterAnd with the current fixes pushed to this branch, these are the remaining errors in the baseline:
empty.variableempty()on variables that always exist, are always falsy, or are not falsyisset.variableisset()on variables that always exist, are not nullable, or are never definedarguments.countThis cherry-picks some commits from #11009.
See also #11037 which bumps to level 4.
Trac ticket: https://core.trac.wordpress.org/ticket/64680
Use of AI Tools
n/a
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.