From 2bbcac16c1313e45afe975d4c496fdc2e3bdcb12 Mon Sep 17 00:00:00 2001 From: Misha Hawthorn Date: Sun, 15 Dec 2024 14:31:07 -0600 Subject: [PATCH] Update PHPDoc typing for PHPStan 2, adjust CI PHP versions --- .github/workflows/ci.yml | 2 +- src/Process.php | 17 ++++++++++++++--- 2 files changed, 15 insertions(+), 4 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 26c8b7b..0c6b212 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -9,7 +9,7 @@ jobs: strategy: matrix: - php-version: [ 8.0, 8.1, 8.2, 8.3 ] + php-version: [ 8.1, 8.2, 8.3, 8.4 ] steps: - name: Checkout Repository diff --git a/src/Process.php b/src/Process.php index bdf29fd..5acdc23 100644 --- a/src/Process.php +++ b/src/Process.php @@ -6,8 +6,19 @@ class Process { + /** + * @var ?resource $stdin + */ private mixed $stdin; + + /** + * @var ?resource $stdout + */ private mixed $stdout; + + /** + * @var ?resource $stderr + */ private mixed $stderr; private mixed $handle; @@ -125,13 +136,13 @@ public function closeStdin(): void } /** - * @param resource $stream + * @param resource|null $stream */ private function closeStream(&$stream): void { - if ($stream !== NULL) { + if (is_resource($stream) && get_resource_type($stream) === 'stream') { fclose($stream); - $stream = NULL; + $stream = null; } } } \ No newline at end of file