From c8a9f3c9c6d40b3e3aa0e84c4952cab205674b26 Mon Sep 17 00:00:00 2001 From: Ignace Nyamagana Butera Date: Sat, 12 Oct 2019 21:38:42 +0200 Subject: [PATCH] Update parameter name for Stream class --- phpstan.tests.neon | 2 +- src/Stream.php | 14 +++++++------- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/phpstan.tests.neon b/phpstan.tests.neon index 457d830e..5686e31a 100644 --- a/phpstan.tests.neon +++ b/phpstan.tests.neon @@ -7,7 +7,7 @@ parameters: - '#Call to function is_iterable\(\) will always evaluate to false.#' - '#Parameter \#1 \$stream of static method League\\Csv\\AbstractCsv::createFromStream\(\) expects resource, string given.#' - '#Parameter \#2 \$special_chars of class League\\Csv\\EscapeFormula constructor expects array, array given.#' - - '#Parameter \#1 \$resource of class League\\Csv\\Stream constructor expects resource, string given.#' + - '#Parameter \#1 \$stream of class League\\Csv\\Stream constructor expects resource, string given.#' - '#Parameter \#1 \$records of method League\\Csv\\CharsetConverter::convert\(\) expects array|Traversable, string given.#' - '#Parameter \#2 \$delimiters of function League\\Csv\\delimiter_detect expects array, array given.#' - '#Parameter \#1 \$document of static method League\\Csv\\Polyfill\\EmptyEscapeParser::parse\(\) expects League\\Csv\\Stream\|SplFileObject, array given.#' diff --git a/src/Stream.php b/src/Stream.php index ce210496..76a22354 100644 --- a/src/Stream.php +++ b/src/Stream.php @@ -121,20 +121,20 @@ class Stream implements SeekableIterator /** * New instance. * - * @param resource $resource stream type resource + * @param resource $stream stream type resource */ - public function __construct($resource) + public function __construct($stream) { - if (!is_resource($resource)) { - throw new TypeError(sprintf('Argument passed must be a stream resource, %s given', gettype($resource))); + if (!is_resource($stream)) { + throw new TypeError(sprintf('Argument passed must be a stream resource, %s given', gettype($stream))); } - if ('stream' !== ($type = get_resource_type($resource))) { + if ('stream' !== ($type = get_resource_type($stream))) { throw new TypeError(sprintf('Argument passed must be a stream resource, %s resource given', $type)); } - $this->is_seekable = stream_get_meta_data($resource)['seekable']; - $this->stream = $resource; + $this->is_seekable = stream_get_meta_data($stream)['seekable']; + $this->stream = $stream; } /**