From a7091c705032eab36d121197ee2989495becd487 Mon Sep 17 00:00:00 2001 From: Filip Halaxa Date: Sat, 18 Nov 2023 17:27:39 +0100 Subject: [PATCH 1/2] Added missing @throws annotations --- src/FileChunks.php | 1 + src/Items.php | 10 ++++++++++ src/ItemsOptions.php | 3 +++ src/Parser.php | 6 ++++++ src/StreamChunks.php | 3 ++- 5 files changed, 22 insertions(+), 1 deletion(-) diff --git a/src/FileChunks.php b/src/FileChunks.php index 26d170f..f3c7fee 100644 --- a/src/FileChunks.php +++ b/src/FileChunks.php @@ -24,6 +24,7 @@ public function __construct($fileName, $chunkSize = 1024 * 8) /** * @return \Generator + * @throws Exception\InvalidArgumentException */ #[\ReturnTypeWillChange] public function getIterator() diff --git a/src/Items.php b/src/Items.php index 1dfb958..6787a5f 100644 --- a/src/Items.php +++ b/src/Items.php @@ -117,6 +117,7 @@ public static function fromIterable($iterable, array $options = []) /** * @return \Generator + * @throws Exception\PathNotFoundException */ #[\ReturnTypeWillChange] public function getIterator() @@ -124,6 +125,9 @@ public function getIterator() return $this->parser->getIterator(); } + /** + * @throws Exception\JsonMachineException + */ public function getPosition() { return $this->parser->getPosition(); @@ -134,11 +138,17 @@ public function getJsonPointers(): array return $this->parser->getJsonPointers(); } + /** + * @throws Exception\JsonMachineException + */ public function getCurrentJsonPointer(): string { return $this->parser->getCurrentJsonPointer(); } + /** + * @throws Exception\JsonMachineException + */ public function getMatchedJsonPointer(): string { return $this->parser->getMatchedJsonPointer(); diff --git a/src/ItemsOptions.php b/src/ItemsOptions.php index 0e528b9..e0b9d68 100644 --- a/src/ItemsOptions.php +++ b/src/ItemsOptions.php @@ -12,6 +12,9 @@ class ItemsOptions extends \ArrayObject { private $options = []; + /** + * @throws InvalidArgumentException + */ public function __construct(array $options = []) { $this->validateOptions($options); diff --git a/src/Parser.php b/src/Parser.php index 8a18265..c4a6b55 100644 --- a/src/Parser.php +++ b/src/Parser.php @@ -321,6 +321,9 @@ public function getJsonPointers(): array return array_values($this->jsonPointers); } + /** + * @throws JsonMachineException + */ public function getCurrentJsonPointer(): string { if ($this->currentPath === null) { @@ -330,6 +333,9 @@ public function getCurrentJsonPointer(): string return self::pathToJsonPointer($this->currentPath); } + /** + * @throws JsonMachineException + */ public function getMatchedJsonPointer(): string { if ($this->matchedJsonPointer === null) { diff --git a/src/StreamChunks.php b/src/StreamChunks.php index d6c6e72..2733433 100644 --- a/src/StreamChunks.php +++ b/src/StreamChunks.php @@ -16,7 +16,8 @@ class StreamChunks implements \IteratorAggregate /** * @param resource $stream - * @param int $chunkSize + * @param int $chunkSize + * @throws InvalidArgumentException */ public function __construct($stream, $chunkSize = 1024 * 8) { From 8a6178d0adbdd12dc1bd673acf75cefb262bb8d3 Mon Sep 17 00:00:00 2001 From: Filip Halaxa Date: Sat, 18 Nov 2023 19:36:19 +0100 Subject: [PATCH 2/2] make cs-fix --- src/FileChunks.php | 1 + src/Items.php | 1 + src/StreamChunks.php | 3 ++- 3 files changed, 4 insertions(+), 1 deletion(-) diff --git a/src/FileChunks.php b/src/FileChunks.php index f3c7fee..3085a1a 100644 --- a/src/FileChunks.php +++ b/src/FileChunks.php @@ -24,6 +24,7 @@ public function __construct($fileName, $chunkSize = 1024 * 8) /** * @return \Generator + * * @throws Exception\InvalidArgumentException */ #[\ReturnTypeWillChange] diff --git a/src/Items.php b/src/Items.php index 6787a5f..03568b0 100644 --- a/src/Items.php +++ b/src/Items.php @@ -117,6 +117,7 @@ public static function fromIterable($iterable, array $options = []) /** * @return \Generator + * * @throws Exception\PathNotFoundException */ #[\ReturnTypeWillChange] diff --git a/src/StreamChunks.php b/src/StreamChunks.php index 2733433..da8502e 100644 --- a/src/StreamChunks.php +++ b/src/StreamChunks.php @@ -16,7 +16,8 @@ class StreamChunks implements \IteratorAggregate /** * @param resource $stream - * @param int $chunkSize + * @param int $chunkSize + * * @throws InvalidArgumentException */ public function __construct($stream, $chunkSize = 1024 * 8)