From a7091c705032eab36d121197ee2989495becd487 Mon Sep 17 00:00:00 2001 From: Filip Halaxa Date: Sat, 18 Nov 2023 17:27:39 +0100 Subject: [PATCH] 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 @@ class FileChunks implements \IteratorAggregate /** * @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 @@ final class Items implements \IteratorAggregate, PositionAware /** * @return \Generator + * @throws Exception\PathNotFoundException */ #[\ReturnTypeWillChange] public function getIterator() @@ -124,6 +125,9 @@ final class Items implements \IteratorAggregate, PositionAware return $this->parser->getIterator(); } + /** + * @throws Exception\JsonMachineException + */ public function getPosition() { return $this->parser->getPosition(); @@ -134,11 +138,17 @@ final class Items implements \IteratorAggregate, PositionAware 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 @@ class Parser implements \IteratorAggregate, PositionAware return array_values($this->jsonPointers); } + /** + * @throws JsonMachineException + */ public function getCurrentJsonPointer(): string { if ($this->currentPath === null) { @@ -330,6 +333,9 @@ class Parser implements \IteratorAggregate, PositionAware 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) {