From 91a08f81c6e4cd067e5acd7cd8e9f82a4adedc76 Mon Sep 17 00:00:00 2001 From: Simon Podlipsky Date: Mon, 13 May 2024 11:51:15 +0200 Subject: [PATCH] fix: add missing @throws (#261) --- src/Client/ClickHouseClient.php | 1 + src/Sql/ExpressionFactory.php | 5 ++++- src/Sql/ValueFormatter.php | 10 ++++++++-- 3 files changed, 13 insertions(+), 3 deletions(-) diff --git a/src/Client/ClickHouseClient.php b/src/Client/ClickHouseClient.php index ab0ceb6..7e8abcc 100644 --- a/src/Client/ClickHouseClient.php +++ b/src/Client/ClickHouseClient.php @@ -71,6 +71,7 @@ public function selectWithParams(string $query, array $params, Format $outputFor * @throws ClientExceptionInterface * @throws ServerError * @throws UnsupportedParamType + * @throws UnsupportedParamValue */ public function insert(string $table, array $values, array|null $columns = null, array $settings = []): void; diff --git a/src/Sql/ExpressionFactory.php b/src/Sql/ExpressionFactory.php index 6826451..93da095 100644 --- a/src/Sql/ExpressionFactory.php +++ b/src/Sql/ExpressionFactory.php @@ -4,15 +4,18 @@ namespace SimPod\ClickHouseClient\Sql; +use SimPod\ClickHouseClient\Exception\UnsupportedParamValue; + use function array_map; use function sprintf; -final class ExpressionFactory +final readonly class ExpressionFactory { public function __construct(private ValueFormatter $valueFormatter) { } + /** @throws UnsupportedParamValue */ public function templateAndValues(string $template, mixed ...$values): Expression { return Expression::new( diff --git a/src/Sql/ValueFormatter.php b/src/Sql/ValueFormatter.php index f4a2ff2..f2559e2 100644 --- a/src/Sql/ValueFormatter.php +++ b/src/Sql/ValueFormatter.php @@ -23,7 +23,7 @@ use function sprintf; /** @internal */ -final class ValueFormatter +final readonly class ValueFormatter { public function __construct(private DateTimeZone|null $dateTimeZone = null) { @@ -117,6 +117,8 @@ public function format(mixed $value, string|null $paramName = null, string|null * @param array $values * * @return array + * + * @throws UnsupportedParamValue */ public function mapFormat(array $values): array { @@ -132,7 +134,11 @@ function ($value): string { ); } - /** @param array $value */ + /** + * @param array $value + * + * @throws UnsupportedParamValue + */ private function formatArray(array $value): string { return sprintf(