From 8830033ebf7ddacf83d32dc44046390a5dcecdee Mon Sep 17 00:00:00 2001 From: Sebastian Bergmann Date: Mon, 18 Nov 2024 15:24:16 +0100 Subject: [PATCH] Increase PHPStan rule level to 10 --- phpstan.neon | 2 +- src/Version.php | 6 ++++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/phpstan.neon b/phpstan.neon index 3e639cd..9228327 100644 --- a/phpstan.neon +++ b/phpstan.neon @@ -1,4 +1,4 @@ parameters: - level: 9 + level: 10 paths: - src diff --git a/src/Version.php b/src/Version.php index 86cbcbb..eb93934 100644 --- a/src/Version.php +++ b/src/Version.php @@ -10,9 +10,11 @@ namespace SebastianBergmann; use const DIRECTORY_SEPARATOR; +use function assert; use function end; use function explode; use function fclose; +use function is_array; use function is_dir; use function is_resource; use function proc_close; @@ -97,6 +99,10 @@ private function getGitInformation(string $path): false|string return false; } + assert(is_array($pipes)); + assert(isset($pipes[1]) && is_resource($pipes[1])); + assert(isset($pipes[2]) && is_resource($pipes[2])); + $result = trim((string) stream_get_contents($pipes[1])); fclose($pipes[1]);