diff --git a/.phpstan.test.neon b/.phpstan.test.neon index bf1a786..f9ae000 100644 --- a/.phpstan.test.neon +++ b/.phpstan.test.neon @@ -1,5 +1,2 @@ -parameters: - checkMissingIterableValueType: false - includes: - vendor/phpstan/phpstan-phpunit/extension.neon diff --git a/src/Stream/ResourceStream.php b/src/Stream/ResourceStream.php index 7712c13..aa2c57b 100644 --- a/src/Stream/ResourceStream.php +++ b/src/Stream/ResourceStream.php @@ -115,6 +115,10 @@ public function rewind(): bool public function isWritable(): bool { $metaData = \stream_get_meta_data($this->resource); + if (!\array_key_exists('uri', $metaData)) { + throw new \UnexpectedValueException('Cannot determine whether resource is writable, meta data does not contain the `uri` key'); + } + return \is_writable($metaData['uri']) || $metaData['uri'] === 'php://memory'; } @@ -141,7 +145,7 @@ public function isReadable(): bool } /** - * @param int<0, max> $length + * @param int<1, max> $length * @return string */ public function read(int $length): string