Skip to content

Commit

Permalink
refactor: remove Safe\PcreException throws
Browse files Browse the repository at this point in the history
  • Loading branch information
simPod committed Jan 16, 2024
1 parent 00d04f4 commit 6e0a450
Show file tree
Hide file tree
Showing 12 changed files with 4 additions and 32 deletions.
6 changes: 0 additions & 6 deletions src/Client/ClickHouseClient.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
namespace SimPod\ClickHouseClient\Client;

use Psr\Http\Client\ClientExceptionInterface;
use Safe\Exceptions\PcreException;
use SimPod\ClickHouseClient\Exception\CannotInsert;
use SimPod\ClickHouseClient\Exception\ServerError;
use SimPod\ClickHouseClient\Exception\UnsupportedValue;
Expand All @@ -18,7 +17,6 @@ interface ClickHouseClient
* @param array<string, float|int|string> $settings
*
* @throws ClientExceptionInterface
* @throws PcreException
* @throws ServerError
*/
public function executeQuery(string $query, array $settings = []): void;
Expand All @@ -28,7 +26,6 @@ public function executeQuery(string $query, array $settings = []): void;
* @param array<string, float|int|string> $settings
*
* @throws ClientExceptionInterface
* @throws PcreException
* @throws ServerError
* @throws UnsupportedValue
*/
Expand All @@ -41,7 +38,6 @@ public function executeQueryWithParams(string $query, array $params, array $sett
* @return O
*
* @throws ClientExceptionInterface
* @throws PcreException
* @throws ServerError
*
* @template O of Output
Expand All @@ -56,7 +52,6 @@ public function select(string $query, Format $outputFormat, array $settings = []
* @return O
*
* @throws ClientExceptionInterface
* @throws PcreException
* @throws ServerError
* @throws UnsupportedValue
*
Expand All @@ -71,7 +66,6 @@ public function selectWithParams(string $query, array $params, Format $outputFor
*
* @throws CannotInsert
* @throws ClientExceptionInterface
* @throws PcreException
* @throws ServerError
*/
public function insert(string $table, array $values, array|null $columns = null, array $settings = []): void;
Expand Down
2 changes: 0 additions & 2 deletions src/Snippet/CurrentDatabase.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
namespace SimPod\ClickHouseClient\Snippet;

use Psr\Http\Client\ClientExceptionInterface;
use Safe\Exceptions\PcreException;
use SimPod\ClickHouseClient\Client\ClickHouseClient;
use SimPod\ClickHouseClient\Exception\ServerError;
use SimPod\ClickHouseClient\Format\JsonEachRow;
Expand All @@ -14,7 +13,6 @@ final class CurrentDatabase
{
/**
* @throws ClientExceptionInterface
* @throws PcreException
* @throws ServerError
*/
public static function run(ClickHouseClient $clickHouseClient): string
Expand Down
2 changes: 0 additions & 2 deletions src/Snippet/DatabaseSize.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
namespace SimPod\ClickHouseClient\Snippet;

use Psr\Http\Client\ClientExceptionInterface;
use Safe\Exceptions\PcreException;
use SimPod\ClickHouseClient\Client\ClickHouseClient;
use SimPod\ClickHouseClient\Exception\ServerError;
use SimPod\ClickHouseClient\Exception\UnsupportedValue;
Expand All @@ -16,7 +15,6 @@ final class DatabaseSize
{
/**
* @throws ClientExceptionInterface
* @throws PcreException
* @throws ServerError
* @throws UnsupportedValue
*/
Expand Down
2 changes: 0 additions & 2 deletions src/Snippet/Parts.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
namespace SimPod\ClickHouseClient\Snippet;

use Psr\Http\Client\ClientExceptionInterface;
use Safe\Exceptions\PcreException;
use SimPod\ClickHouseClient\Client\ClickHouseClient;
use SimPod\ClickHouseClient\Exception\ServerError;
use SimPod\ClickHouseClient\Exception\UnsupportedValue;
Expand All @@ -19,7 +18,6 @@ final class Parts
* @return array<array<string, mixed>>
*
* @throws ClientExceptionInterface
* @throws PcreException
* @throws ServerError
* @throws UnsupportedValue
*/
Expand Down
2 changes: 0 additions & 2 deletions src/Snippet/ShowCreateTable.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
namespace SimPod\ClickHouseClient\Snippet;

use Psr\Http\Client\ClientExceptionInterface;
use Safe\Exceptions\PcreException;
use SimPod\ClickHouseClient\Client\ClickHouseClient;
use SimPod\ClickHouseClient\Exception\ServerError;
use SimPod\ClickHouseClient\Format\JsonEachRow;
Expand All @@ -14,7 +13,6 @@ final class ShowCreateTable
{
/**
* @throws ClientExceptionInterface
* @throws PcreException
* @throws ServerError
*/
public static function run(ClickHouseClient $clickHouseClient, string $tableName): string
Expand Down
2 changes: 0 additions & 2 deletions src/Snippet/ShowDatabases.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
namespace SimPod\ClickHouseClient\Snippet;

use Psr\Http\Client\ClientExceptionInterface;
use Safe\Exceptions\PcreException;
use SimPod\ClickHouseClient\Client\ClickHouseClient;
use SimPod\ClickHouseClient\Exception\ServerError;
use SimPod\ClickHouseClient\Format\JsonEachRow;
Expand All @@ -18,7 +17,6 @@ final class ShowDatabases
* @return list<string>
*
* @throws ClientExceptionInterface
* @throws PcreException
* @throws ServerError
*/
public static function run(ClickHouseClient $clickHouseClient): array
Expand Down
2 changes: 0 additions & 2 deletions src/Snippet/TableSizes.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
namespace SimPod\ClickHouseClient\Snippet;

use Psr\Http\Client\ClientExceptionInterface;
use Safe\Exceptions\PcreException;
use SimPod\ClickHouseClient\Client\ClickHouseClient;
use SimPod\ClickHouseClient\Exception\ServerError;
use SimPod\ClickHouseClient\Exception\UnsupportedValue;
Expand All @@ -19,7 +18,6 @@ final class TableSizes
* @return array<Entry>
*
* @throws ClientExceptionInterface
* @throws PcreException
* @throws ServerError
* @throws UnsupportedValue
*/
Expand Down
2 changes: 0 additions & 2 deletions src/Snippet/Version.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
namespace SimPod\ClickHouseClient\Snippet;

use Psr\Http\Client\ClientExceptionInterface;
use Safe\Exceptions\PcreException;
use SimPod\ClickHouseClient\Client\ClickHouseClient;
use SimPod\ClickHouseClient\Exception\ServerError;
use SimPod\ClickHouseClient\Format\JsonEachRow;
Expand All @@ -14,7 +13,6 @@ final class Version
{
/**
* @throws ClientExceptionInterface
* @throws PcreException
* @throws ServerError
*/
public static function run(ClickHouseClient $clickHouseClient): string
Expand Down
4 changes: 1 addition & 3 deletions src/Sql/SqlFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,11 @@

namespace SimPod\ClickHouseClient\Sql;

use Safe\Exceptions\PcreException;
use SimPod\ClickHouseClient\Exception\UnsupportedValue;

use function assert;
use function is_string;
use function Safe\preg_replace;
use function preg_replace;
use function sprintf;
use function str_replace;

Expand All @@ -23,7 +22,6 @@ public function __construct(private ValueFormatter $valueFormatter)
/**
* @param array<string, mixed> $parameters
*
* @throws PcreException
* @throws UnsupportedValue
*/
public function createWithParameters(string $query, array $parameters): string
Expand Down
8 changes: 2 additions & 6 deletions src/Sql/ValueFormatter.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
use BackedEnum;
use DateTimeImmutable;
use DateTimeZone;
use Safe\Exceptions\PcreException;
use SimPod\ClickHouseClient\Exception\UnsupportedValue;

use function array_key_first;
Expand All @@ -20,7 +19,7 @@
use function is_object;
use function is_string;
use function method_exists;
use function Safe\preg_match;
use function preg_match;
use function sprintf;

/** @internal */
Expand All @@ -30,10 +29,7 @@ public function __construct(private DateTimeZone|null $dateTimeZone = null)
{
}

/**
* @throws PcreException
* @throws UnsupportedValue
*/
/** @throws UnsupportedValue */
public function format(mixed $value, string|null $paramName = null, string|null $sql = null): string
{
if (is_string($value)) {
Expand Down
2 changes: 1 addition & 1 deletion tests/Snippet/ShowCreateTableTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
use SimPod\ClickHouseClient\Tests\TestCaseBase;
use SimPod\ClickHouseClient\Tests\WithClient;

use function Safe\preg_replace;
use function preg_replace;
use function str_replace;

#[CoversClass(ShowCreateTable::class)]
Expand Down
2 changes: 0 additions & 2 deletions tests/WithClient.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
use PHPUnit\Framework\Attributes\After;
use PHPUnit\Framework\Attributes\Before;
use Psr\Http\Client\ClientExceptionInterface;
use Safe\Exceptions\PcreException;
use SimPod\ClickHouseClient\Client\ClickHouseAsyncClient;
use SimPod\ClickHouseClient\Client\ClickHouseClient;
use SimPod\ClickHouseClient\Client\Http\RequestFactory;
Expand Down Expand Up @@ -52,7 +51,6 @@ public function tearDownDataBase(): void
/**
* @throws ClientExceptionInterface
* @throws InvalidArgumentException
* @throws PcreException
* @throws ServerError
*/
private function restartClickHouseClient(): void
Expand Down

0 comments on commit 6e0a450

Please sign in to comment.