-
Notifications
You must be signed in to change notification settings - Fork 3.4k
Bump PHPStan rule level to 1 #11151
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Draft
westonruter
wants to merge
30
commits into
WordPress:trunk
Choose a base branch
from
westonruter:bump/phpstan-level-1
base: trunk
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Bump PHPStan rule level to 1 #11151
Changes from 15 commits
Commits
Show all changes
30 commits
Select commit
Hold shift + click to select a range
6d83596
Ignore errors in src/wp-includes/build which currently come the Guten…
westonruter 5dec036
Bump phpstan to 2.1.40
westonruter 593a10c
Bump PHPStan to level 1
westonruter 22de4b6
Ignore variable.undefined errors since too noisy
westonruter cb8db15
Regenerate baseline for level 1
westonruter d3dd8ec
Remove unused parameter for WP_Filesystem_Direct constructor
westonruter bf92684
Add theme constants to config to address constant.notFound errors
westonruter d39600a
Docs: Add `@return never` to `dead_db()`.
apermo 75797b7
fix(phpstan): Ignore return.never on dead_db()
apermo e55878c
Fix phpstan-return syntax
westonruter 46b656a
Remove now-unnecessary phpstan-ignore
westonruter 3c46095
docs: Refine phpdoc of dead_db()
apermo c52438a
Remove never from check_connection return
westonruter 87a2c04
Remove errors from baseline which were fixed by never returns
westonruter 95ddce2
Resolve isset.variable error since $_POST global is always set
westonruter 5e62661
Merge branch 'trunk' of https://github.com/WordPress/wordpress-develo…
westonruter 2d77448
Use allow-list for unknown globals
westonruter eeefc04
Convert single variable.undefined ignore rule into one per variable
westonruter cb7a8c3
Remove unused $class variable after r54215 (56bde67811f432764d2be6c5c…
westonruter a47a434
Fix wp_cache_switch_to_blog() issues
westonruter 680d165
Fix arguments.count issues in Twenty Seventeen where twentyseventeen_…
westonruter 53208cc
Merge branch 'trunk' of https://github.com/WordPress/wordpress-develo…
westonruter a088867
Remove $comment_id variable.undefined error after r61859 (ce40cd36)
westonruter 202c39c
Remove $shape from being a variable.undefined ignored error
westonruter de684c6
Revert "Fix arguments.count issues in Twenty Seventeen where twentyse…
westonruter db38dbf
Initialize $shape variable to suppress variable.undefined error
westonruter 385d8fe
Merge branch 'trunk' of https://github.com/WordPress/wordpress-develo…
westonruter c2a9bc9
Remove errors from baseline fixed in r62000
westonruter e003c66
Remove empty.variable from baseline which was fixed in r61995
westonruter 0b4ba77
Merge branch 'trunk' of https://github.com/WordPress/wordpress-develo…
westonruter File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,3 +1,107 @@ | ||
| <?php declare(strict_types = 1); | ||
|
|
||
| return []; | ||
| $ignoreErrors = []; | ||
| $ignoreErrors[] = [ | ||
| 'message' => '#^Variable \\$class in empty\\(\\) always exists and is always falsy\\.$#', | ||
| 'identifier' => 'empty.variable', | ||
| 'count' => 1, | ||
| 'path' => __DIR__ . '/../../src/wp-admin/includes/class-wp-posts-list-table.php', | ||
| ]; | ||
| $ignoreErrors[] = [ | ||
| 'message' => '#^Variable \\$_POST in isset\\(\\) always exists and is not nullable\\.$#', | ||
| 'identifier' => 'isset.variable', | ||
| 'count' => 1, | ||
| 'path' => __DIR__ . '/../../src/wp-admin/includes/media.php', | ||
| ]; | ||
| $ignoreErrors[] = [ | ||
| 'message' => '#^Variable \\$parent_file in empty\\(\\) always exists and is not falsy\\.$#', | ||
| 'identifier' => 'empty.variable', | ||
| 'count' => 1, | ||
| 'path' => __DIR__ . '/../../src/wp-admin/themes.php', | ||
| ]; | ||
| $ignoreErrors[] = [ | ||
| 'message' => '#^Function twentyseventeen_edit_link invoked with 1 parameter, 0 required\\.$#', | ||
| 'identifier' => 'arguments.count', | ||
| 'count' => 1, | ||
| 'path' => __DIR__ . '/../../src/wp-content/themes/twentyseventeen/template-parts/page/content-front-page-panels.php', | ||
| ]; | ||
| $ignoreErrors[] = [ | ||
| 'message' => '#^Function twentyseventeen_edit_link invoked with 1 parameter, 0 required\\.$#', | ||
| 'identifier' => 'arguments.count', | ||
| 'count' => 1, | ||
| 'path' => __DIR__ . '/../../src/wp-content/themes/twentyseventeen/template-parts/page/content-front-page.php', | ||
| ]; | ||
| $ignoreErrors[] = [ | ||
| 'message' => '#^Function twentyseventeen_edit_link invoked with 1 parameter, 0 required\\.$#', | ||
| 'identifier' => 'arguments.count', | ||
| 'count' => 1, | ||
| 'path' => __DIR__ . '/../../src/wp-content/themes/twentyseventeen/template-parts/page/content-page.php', | ||
| ]; | ||
| $ignoreErrors[] = [ | ||
| 'message' => '#^Function wp_cache_switch_to_blog_fallback invoked with 1 parameter, 0 required\\.$#', | ||
| 'identifier' => 'arguments.count', | ||
| 'count' => 1, | ||
| 'path' => __DIR__ . '/../../src/wp-includes/cache-compat.php', | ||
| ]; | ||
| $ignoreErrors[] = [ | ||
| 'message' => '#^Variable \\$addl_path in empty\\(\\) always exists and is always falsy\\.$#', | ||
| 'identifier' => 'empty.variable', | ||
| 'count' => 1, | ||
| 'path' => __DIR__ . '/../../src/wp-includes/canonical.php', | ||
| ]; | ||
| $ignoreErrors[] = [ | ||
| 'message' => '#^Variable \\$namespace in isset\\(\\) always exists and is not nullable\\.$#', | ||
| 'identifier' => 'isset.variable', | ||
| 'count' => 1, | ||
| 'path' => __DIR__ . '/../../src/wp-includes/class-wp-block-parser.php', | ||
| ]; | ||
| $ignoreErrors[] = [ | ||
| 'message' => '#^Variable \\$block_type in empty\\(\\) always exists and is not falsy\\.$#', | ||
| 'identifier' => 'empty.variable', | ||
| 'count' => 1, | ||
| 'path' => __DIR__ . '/../../src/wp-includes/class-wp-block-supports.php', | ||
| ]; | ||
| $ignoreErrors[] = [ | ||
| 'message' => '#^Variable \\$loader in isset\\(\\) always exists and is not nullable\\.$#', | ||
| 'identifier' => 'isset.variable', | ||
| 'count' => 1, | ||
| 'path' => __DIR__ . '/../../src/wp-includes/class-wp-oembed.php', | ||
| ]; | ||
| $ignoreErrors[] = [ | ||
| 'message' => '#^Variable \\$search in empty\\(\\) always exists and is not falsy\\.$#', | ||
| 'identifier' => 'empty.variable', | ||
| 'count' => 1, | ||
| 'path' => __DIR__ . '/../../src/wp-includes/class-wp-query.php', | ||
| ]; | ||
| $ignoreErrors[] = [ | ||
| 'message' => '#^Variable \\$status_type_clauses in empty\\(\\) always exists and is not falsy\\.$#', | ||
| 'identifier' => 'empty.variable', | ||
| 'count' => 1, | ||
| 'path' => __DIR__ . '/../../src/wp-includes/class-wp-query.php', | ||
| ]; | ||
| $ignoreErrors[] = [ | ||
| 'message' => '#^Variable \\$deprecated in empty\\(\\) always exists and is always falsy\\.$#', | ||
| 'identifier' => 'empty.variable', | ||
| 'count' => 1, | ||
| 'path' => __DIR__ . '/../../src/wp-includes/pluggable.php', | ||
| ]; | ||
| $ignoreErrors[] = [ | ||
| 'message' => '#^Variable \\$schema in empty\\(\\) is never defined\\.$#', | ||
| 'identifier' => 'empty.variable', | ||
| 'count' => 1, | ||
| 'path' => __DIR__ . '/../../src/wp-includes/rest-api/endpoints/class-wp-rest-attachments-controller.php', | ||
| ]; | ||
| $ignoreErrors[] = [ | ||
| 'message' => '#^Variable \\$the_parent in empty\\(\\) always exists and is not falsy\\.$#', | ||
| 'identifier' => 'empty.variable', | ||
| 'count' => 1, | ||
| 'path' => __DIR__ . '/../../src/wp-includes/taxonomy.php', | ||
| ]; | ||
| $ignoreErrors[] = [ | ||
| 'message' => '#^Variable \\$s in isset\\(\\) is never defined\\.$#', | ||
| 'identifier' => 'isset.variable', | ||
| 'count' => 1, | ||
| 'path' => __DIR__ . '/../../src/wp-includes/template.php', | ||
| ]; | ||
|
|
||
| return ['parameters' => ['ignoreErrors' => $ignoreErrors]]; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.