namespace Zend\Diactoros;
use InvalidArgumentException;
-use RuntimeException;
use Psr\Http\Message\StreamInterface;
+use RuntimeException;
+
+use function array_key_exists;
+use function fclose;
+use function feof;
+use function fopen;
+use function fread;
+use function fseek;
+use function fstat;
+use function ftell;
+use function fwrite;
+use function get_resource_type;
+use function is_int;
+use function is_resource;
+use function is_string;
+use function restore_error_handler;
+use function set_error_handler;
+use function stream_get_contents;
+use function stream_get_meta_data;
+use function strstr;
+
+use const E_WARNING;
+use const SEEK_SET;
/**
* Implementation of PSR HTTP streams
if (is_string($stream)) {
set_error_handler(function ($e) use (&$error) {
+ if ($e !== E_WARNING) {
+ return;
+ }
+
$error = $e;
- }, E_WARNING);
+ });
$resource = fopen($stream, $mode);
restore_error_handler();
}