From 96ae72716941569d2776a5fd8d48cf56ad9b6002 Mon Sep 17 00:00:00 2001 From: Weston Ruter Date: Thu, 9 May 2024 13:32:15 -0700 Subject: [PATCH 1/2] Bump PHPStan level to 9 --- phpstan.neon.dist | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/phpstan.neon.dist b/phpstan.neon.dist index a8634779b2..144f418398 100644 --- a/phpstan.neon.dist +++ b/phpstan.neon.dist @@ -1,7 +1,7 @@ includes: - phar://phpstan.phar/conf/bleedingEdge.neon parameters: - level: 8 + level: 9 treatPhpDocTypesAsCertain: false paths: - load.php From 883387ed3f0c9361ff427c0bdd5a768c0b5665a4 Mon Sep 17 00:00:00 2001 From: Weston Ruter Date: Thu, 9 May 2024 13:56:06 -0700 Subject: [PATCH 2/2] Ignore/resolve errors in tests for level 9 --- phpstan.neon.dist | 9 +++++++++ tests/plugins/webp-uploads/helper-tests.php | 3 ++- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/phpstan.neon.dist b/phpstan.neon.dist index 144f418398..1684a2d8a6 100644 --- a/phpstan.neon.dist +++ b/phpstan.neon.dist @@ -61,3 +61,12 @@ parameters: - message: '/Cannot cast .+ to string/' path: tests/* + - + message: '/Cannot access offset .+ on mixed\./' + path: tests/* + - + message: '/Argument of an invalid type mixed supplied for foreach, only iterables are supported./' + path: tests/* + - + message: '/Property .+ does not accept mixed\./' + path: tests/* diff --git a/tests/plugins/webp-uploads/helper-tests.php b/tests/plugins/webp-uploads/helper-tests.php index aa3aa488f2..7cc657e926 100644 --- a/tests/plugins/webp-uploads/helper-tests.php +++ b/tests/plugins/webp-uploads/helper-tests.php @@ -509,7 +509,8 @@ public function test_webp_uploads_in_frontend_body_without_wp_query(): void { public function test_webp_uploads_in_frontend_body_with_feed(): void { $this->mock_empty_action( 'template_redirect' ); - $GLOBALS['wp_query']->is_feed = true; + global $wp_query; + $wp_query->is_feed = true; $this->assertFalse( webp_uploads_in_frontend_body() ); }