Skip to content

Commit 1fb721b

Browse files
committed
chore: upgrade phpstan to v2.0
1 parent 25b1e9f commit 1fb721b

10 files changed

Lines changed: 4882 additions & 3928 deletions

File tree

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
"squizlabs/php_codesniffer": "3.10.3",
2121
"wp-coding-standards/wpcs": "~3.1.0",
2222
"phpcompatibility/phpcompatibility-wp": "~2.1.3",
23-
"phpstan/phpstan": "1.12.11",
23+
"phpstan/phpstan": "2.0.2",
2424
"yoast/phpunit-polyfills": "^1.1.0"
2525
},
2626
"config": {

phpstan.neon.dist

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ includes:
1919

2020
parameters:
2121
level: 6
22+
reportUnmatchedIgnoredErrors: true
2223

2324
ignoreErrors:
2425
# Inner functions aren't supported:

tests/phpstan/base.neon

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,6 @@ parameters:
6262
- ../../src/wp-includes/IXR
6363
- ../../src/wp-includes/PHPMailer
6464
- ../../src/wp-includes/pomo
65-
- ../../src/wp-includes/random_compat
6665
- ../../src/wp-includes/Requests
6766
- ../../src/wp-includes/SimplePie
6867
- ../../src/wp-includes/sodium_compat

tests/phpstan/baseline/level-0.php

Lines changed: 20 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -2,80 +2,86 @@
22

33
$ignoreErrors = [];
44
$ignoreErrors[] = [
5-
// identifier: variable.undefined
65
'message' => '#^Undefined variable\\: \\$transient$#',
6+
'identifier' => 'variable.undefined',
77
'count' => 2,
88
'path' => __DIR__ . '/../../../src/wp-admin/includes/class-wp-debug-data.php',
99
];
1010
$ignoreErrors[] = [
11-
// identifier: return.missing
1211
'message' => '#^Method WP_Filesystem_SSH2\\:\\:touch\\(\\) should return bool but return statement is missing\\.$#',
12+
'identifier' => 'return.missing',
1313
'count' => 1,
1414
'path' => __DIR__ . '/../../../src/wp-admin/includes/class-wp-filesystem-ssh2.php',
1515
];
1616
$ignoreErrors[] = [
17-
// identifier: return.missing
1817
'message' => '#^Function wp_get_nav_menu_to_edit\\(\\) should return string\\|WP_Error but return statement is missing\\.$#',
18+
'identifier' => 'return.missing',
1919
'count' => 1,
2020
'path' => __DIR__ . '/../../../src/wp-admin/includes/nav-menu.php',
2121
];
2222
$ignoreErrors[] = [
23-
// identifier: class.notFound
2423
'message' => '#^Instantiated class WP_Press_This_Plugin not found\\.$#',
24+
'identifier' => 'class.notFound',
25+
'count' => 1,
26+
'path' => __DIR__ . '/../../../src/wp-admin/press-this.php',
27+
];
28+
$ignoreErrors[] = [
29+
'message' => '#^Path in include\\(\\) "/press\\-this/class\\-wp\\-press\\-this\\-plugin\\.php" is not a file or it does not exist\\.$#',
30+
'identifier' => 'include.fileNotFound',
2531
'count' => 1,
2632
'path' => __DIR__ . '/../../../src/wp-admin/press-this.php',
2733
];
2834
$ignoreErrors[] = [
29-
// identifier: function.notFound
3035
'message' => '#^Function wp_get_duotone_filter_svg not found\\.$#',
36+
'identifier' => 'function.notFound',
3137
'count' => 1,
3238
'path' => __DIR__ . '/../../../src/wp-includes/class-wp-theme-json.php',
3339
];
3440
$ignoreErrors[] = [
35-
// identifier: return.missing
3641
'message' => '#^Method WP_Customize_Background_Image_Setting\\:\\:update\\(\\) should return bool but return statement is missing\\.$#',
42+
'identifier' => 'return.missing',
3743
'count' => 1,
3844
'path' => __DIR__ . '/../../../src/wp-includes/customize/class-wp-customize-background-image-setting.php',
3945
];
4046
$ignoreErrors[] = [
41-
// identifier: return.missing
4247
'message' => '#^Method WP_Customize_Filter_Setting\\:\\:update\\(\\) should return bool but return statement is missing\\.$#',
48+
'identifier' => 'return.missing',
4349
'count' => 1,
4450
'path' => __DIR__ . '/../../../src/wp-includes/customize/class-wp-customize-filter-setting.php',
4551
];
4652
$ignoreErrors[] = [
47-
// identifier: return.missing
4853
'message' => '#^Method WP_Customize_Header_Image_Setting\\:\\:update\\(\\) should return bool but return statement is missing\\.$#',
49-
'count' => 1,
54+
'identifier' => 'return.missing',
55+
'count' => 2,
5056
'path' => __DIR__ . '/../../../src/wp-includes/customize/class-wp-customize-header-image-setting.php',
5157
];
5258
$ignoreErrors[] = [
53-
// identifier: function.notFound
5459
'message' => '#^Function wp_update_https_detection_errors not found\\.$#',
60+
'identifier' => 'function.notFound',
5561
'count' => 1,
5662
'path' => __DIR__ . '/../../../src/wp-includes/https-detection.php',
5763
];
5864
$ignoreErrors[] = [
59-
// identifier: return.missing
6065
'message' => '#^Function _wp_filter_build_unique_id\\(\\) should return string but return statement is missing\\.$#',
66+
'identifier' => 'return.missing',
6167
'count' => 1,
6268
'path' => __DIR__ . '/../../../src/wp-includes/plugin.php',
6369
];
6470
$ignoreErrors[] = [
65-
// identifier: unset.offset
6671
'message' => '#^Cannot unset offset 0 on array\\<string, string\\>\\.$#',
72+
'identifier' => 'unset.offset',
6773
'count' => 1,
6874
'path' => __DIR__ . '/../../../src/wp-includes/rest-api.php',
6975
];
7076
$ignoreErrors[] = [
71-
// identifier: new.static
7277
'message' => '#^Unsafe usage of new static\\(\\)\\.$#',
78+
'identifier' => 'new.static',
7379
'count' => 1,
7480
'path' => __DIR__ . '/../../../src/wp-includes/style-engine/class-wp-style-engine-css-rules-store.php',
7581
];
7682
$ignoreErrors[] = [
77-
// identifier: variable.undefined
7883
'message' => '#^Undefined variable\\: \\$s$#',
84+
'identifier' => 'variable.undefined',
7985
'count' => 1,
8086
'path' => __DIR__ . '/../../../src/wp-includes/template.php',
8187
];

0 commit comments

Comments
 (0)