From eceff0339b33cd9649f4236c15270937047b5791 Mon Sep 17 00:00:00 2001 From: Mateusz Charytoniuk <mateusz.charytoniuk@protonmail.com> Date: Thu, 28 Mar 2024 00:39:00 +0100 Subject: [PATCH] chore: convert manually thrown exception to reused assertion check --- composer.json | 2 +- composer.lock | 2 +- src/DatabaseConnection.php | 7 +------ 3 files changed, 3 insertions(+), 8 deletions(-) diff --git a/composer.json b/composer.json index 13770dcb..7a5d9ed0 100644 --- a/composer.json +++ b/composer.json @@ -22,7 +22,7 @@ "doctrine/dbal": "^4.0", "doctrine/migrations": "^3.6", "doctrine/orm": "^3.0", - "doctrine/sql-formatter": "^1.1", + "doctrine/sql-formatter": "^1.2", "dragonmantank/cron-expression": "^3.3", "ezyang/htmlpurifier": "^4.16", "grpc/grpc": "^1.57", diff --git a/composer.lock b/composer.lock index 98b82a1e..2de4e957 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "df9e472d91fa26ebe6b86782d4147960", + "content-hash": "6cc5c7a01d9bb04a890e15a3e326d795", "packages": [ { "name": "brick/math", diff --git a/src/DatabaseConnection.php b/src/DatabaseConnection.php index 1c50da2d..ef6fd2b0 100644 --- a/src/DatabaseConnection.php +++ b/src/DatabaseConnection.php @@ -8,7 +8,6 @@ use Doctrine\DBAL\Driver\Connection; use PDO; use PDOStatement; use Psr\Log\LoggerInterface; -use RuntimeException; use Swoole\Database\PDOProxy; use Swoole\Database\PDOStatementProxy; use Swoole\Event; @@ -147,11 +146,7 @@ readonly class DatabaseConnection implements Connection */ $quoted = $this->pdo->quote($value); - if (!is_string($quoted)) { - throw new RuntimeException('Unable to quote string: '.$value); - } - - return $quoted; + return $this->assertNotFalse($quoted); } public function rollBack(): void -- GitLab