From 0f6b04b5ebe6df51015fb54b4c455bd7af5b093f Mon Sep 17 00:00:00 2001 From: Vincent Langlet Date: Sun, 18 Jun 2023 08:14:16 +0200 Subject: [PATCH] Add more throws tags (#2175) --- src/Index/Settings.php | 68 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 68 insertions(+) diff --git a/src/Index/Settings.php b/src/Index/Settings.php index 68d2e7e2f..d88d9d6a5 100644 --- a/src/Index/Settings.php +++ b/src/Index/Settings.php @@ -131,6 +131,10 @@ public function get(string $setting = '', bool $includeDefaults = false) * whichever string representation is used like 'true', '1', 'on', 'yes'. * * @param string $setting Setting name to return + * + * @throws ClientException + * @throws ConnectionException + * @throws ResponseException */ public function getBool(string $setting): bool { @@ -144,6 +148,10 @@ public function getBool(string $setting): bool * * @param int $replicas Number of replicas * + * @throws ClientException + * @throws ConnectionException + * @throws ResponseException + * * @return Response Response object */ public function setNumberOfReplicas(int $replicas): Response @@ -156,6 +164,10 @@ public function setNumberOfReplicas(int $replicas): Response * * If no number of replicas is set, the default number is returned * + * @throws ClientException + * @throws ConnectionException + * @throws ResponseException + * * @return int The number of replicas */ public function getNumberOfReplicas(): int @@ -168,6 +180,10 @@ public function getNumberOfReplicas(): int * * If no number of shards is set, the default number is returned * + * @throws ClientException + * @throws ConnectionException + * @throws ResponseException + * * @return int The number of shards */ public function getNumberOfShards(): int @@ -179,17 +195,31 @@ public function getNumberOfShards(): int * Sets the index to read only. * * @param bool $readOnly (default = true) + * + * @throws ClientException + * @throws ConnectionException + * @throws ResponseException */ public function setReadOnly(bool $readOnly = true): Response { return $this->set(['blocks.read_only' => $readOnly]); } + /** + * @throws ClientException + * @throws ConnectionException + * @throws ResponseException + */ public function getReadOnly(): bool { return $this->getBool('blocks.read_only'); } + /** + * @throws ClientException + * @throws ConnectionException + * @throws ResponseException + */ public function getBlocksRead(): bool { return $this->getBool('blocks.read'); @@ -197,12 +227,21 @@ public function getBlocksRead(): bool /** * @param bool $state OPTIONAL (default = true) + * + * @throws ClientException + * @throws ConnectionException + * @throws ResponseException */ public function setBlocksRead(bool $state = true): Response { return $this->set(['blocks.read' => $state]); } + /** + * @throws ClientException + * @throws ConnectionException + * @throws ResponseException + */ public function getBlocksWrite(): bool { return $this->getBool('blocks.write'); @@ -210,12 +249,21 @@ public function getBlocksWrite(): bool /** * @param bool $state OPTIONAL (default = true) + * + * @throws ClientException + * @throws ConnectionException + * @throws ResponseException */ public function setBlocksWrite(bool $state = true): Response { return $this->set(['blocks.write' => $state]); } + /** + * @throws ClientException + * @throws ConnectionException + * @throws ResponseException + */ public function getBlocksMetadata(): bool { // When blocks.metadata is enabled, reading the settings is not possible anymore. @@ -235,6 +283,10 @@ public function getBlocksMetadata(): bool * Set to true to disable index metadata reads and writes. * * @param bool $state OPTIONAL (default = true) + * + * @throws ClientException + * @throws ConnectionException + * @throws ResponseException */ public function setBlocksMetadata(bool $state = true): Response { @@ -249,6 +301,10 @@ public function setBlocksMetadata(bool $state = true): Response * * @param string $interval Duration of the refresh interval * + * @throws ClientException + * @throws ConnectionException + * @throws ResponseException + * * @return Response Response object */ public function setRefreshInterval(string $interval): Response @@ -261,6 +317,10 @@ public function setRefreshInterval(string $interval): Response * * If no interval is set, the default interval is returned * + * @throws ClientException + * @throws ConnectionException + * @throws ResponseException + * * @return string Refresh interval */ public function getRefreshInterval(): string @@ -276,6 +336,10 @@ public function getRefreshInterval(): string * @param string $key Merge policy key (for ex. expunge_deletes_allowed) * @param int|string $value * + * @throws ClientException + * @throws ConnectionException + * @throws ResponseException + * * @see https://www.elastic.co/guide/en/elasticsearch/reference/current/index-modules-merge.html */ public function setMergePolicy(string $key, $value): Response @@ -292,6 +356,10 @@ public function setMergePolicy(string $key, $value): Response * * @param string $key Merge policy key (for ex. expunge_deletes_allowed) * + * @throws ClientException + * @throws ConnectionException + * @throws ResponseException + * * @return int|string * * @see https://www.elastic.co/guide/en/elasticsearch/reference/current/index-modules-merge.html