From df3d0cc0b50c81152618887f09bf783cbd8bb43e Mon Sep 17 00:00:00 2001 From: Pascal Birchler Date: Fri, 4 Jul 2025 00:06:03 +0200 Subject: [PATCH] PHPStan level 9 --- phpstan.neon.dist | 13 +++++++++++++ src/MaintenanceModeCommand.php | 2 +- 2 files changed, 14 insertions(+), 1 deletion(-) create mode 100644 phpstan.neon.dist diff --git a/phpstan.neon.dist b/phpstan.neon.dist new file mode 100644 index 0000000..209ff06 --- /dev/null +++ b/phpstan.neon.dist @@ -0,0 +1,13 @@ +parameters: + level: 9 + paths: + - src + - maintenance-mode-command.php + scanDirectories: + - vendor/wp-cli/wp-cli/php + scanFiles: + - vendor/php-stubs/wordpress-stubs/wordpress-stubs.php + treatPhpDocTypesAsCertain: false + ignoreErrors: + - identifier: missingType.parameter + - identifier: missingType.return diff --git a/src/MaintenanceModeCommand.php b/src/MaintenanceModeCommand.php index e00454a..58910a2 100644 --- a/src/MaintenanceModeCommand.php +++ b/src/MaintenanceModeCommand.php @@ -142,7 +142,7 @@ private function get_maintenance_mode_status() { // to check if the maintenance is available. $upgrading = 0; - $contents = $wp_filesystem->get_contents( $maintenance_file ); + $contents = (string) $wp_filesystem->get_contents( $maintenance_file ); $matches = []; if ( preg_match( '/upgrading\s*=\s*(\d+)\s*;/i', $contents, $matches ) ) { $upgrading = (int) $matches[1];