diff --git a/composer.json b/composer.json index 9365d3e..689ea28 100644 --- a/composer.json +++ b/composer.json @@ -27,7 +27,7 @@ }, "require-dev": { "ext-pdo": "*", - "facile-it/facile-coding-standard": "^0.5.2", + "facile-it/facile-coding-standard": "^1.2.0", "infection/infection": "^0.27.10", "phpdocumentor/reflection-docblock": ">=4.0.1", "phpspec/prophecy-phpunit": "^2.0", diff --git a/src/ConnectionInterface.php b/src/ConnectionInterface.php index fb94d1b..a2b5422 100644 --- a/src/ConnectionInterface.php +++ b/src/ConnectionInterface.php @@ -6,6 +6,4 @@ use Doctrine\DBAL\Driver\Connection as DriverConnection; -interface ConnectionInterface extends DriverConnection -{ -} +interface ConnectionInterface extends DriverConnection {} diff --git a/src/ConnectionTrait.php b/src/ConnectionTrait.php index fa6568a..a0acd57 100644 --- a/src/ConnectionTrait.php +++ b/src/ConnectionTrait.php @@ -117,9 +117,6 @@ public function resetAttemptCount(): void $this->currentAttempts = 0; } - /** - * @param string $connectionName - */ public function connect(?string $connectionName = null): DriverConnection { $this->hasBeenClosedWithAnOpenTransaction = false; @@ -147,13 +144,13 @@ public function prepare(string $sql): DBALStatement } /** - * @param list|array $params + * @param list|array $params * * @psalm-param WrapperParameterTypeArray $types */ public function executeQuery(string $sql, array $params = [], $types = [], ?QueryCacheProfile $qcp = null): Result { - return $this->doWithRetry(fn (): Result => parent::executeQuery($sql, $params, $types, $qcp), $sql); + return $this->doWithRetry(fn(): Result => parent::executeQuery($sql, $params, $types, $qcp), $sql); } /** @@ -167,7 +164,7 @@ public function executeQuery(string $sql, array $params = [], $types = [], ?Quer */ public function executeStatement(string $sql, array $params = [], array $types = []): int|string { - return $this->doWithRetry(fn () => parent::executeStatement($sql, $params, $types), $sql); + return $this->doWithRetry(fn() => parent::executeStatement($sql, $params, $types), $sql); } public function beginTransaction(): void diff --git a/src/Statement.php b/src/Statement.php index 0788f0b..388b5f0 100644 --- a/src/Statement.php +++ b/src/Statement.php @@ -66,12 +66,12 @@ public function bindValue(string|int $param, mixed $value, string|ParameterType| public function executeQuery(): Result { - return $this->executeWithRetry(fn (): Result => parent::executeQuery()); + return $this->executeWithRetry(fn(): Result => parent::executeQuery()); } public function executeStatement(): int|string { - return $this->executeWithRetry(fn (): int|string => parent::executeStatement()); + return $this->executeWithRetry(fn(): int|string => parent::executeStatement()); } /** diff --git a/tests/Functional/AbstractFunctionalTestCase.php b/tests/Functional/AbstractFunctionalTestCase.php index 46c6546..22971d5 100644 --- a/tests/Functional/AbstractFunctionalTestCase.php +++ b/tests/Functional/AbstractFunctionalTestCase.php @@ -61,11 +61,11 @@ protected function createTestTable(DBALConnection $connection): void { $connection->executeStatement( <<<'TABLE_WRAP' -CREATE TABLE IF NOT EXISTS test ( - id INT UNSIGNED AUTO_INCREMENT PRIMARY KEY, - updatedAt TIMESTAMP DEFAULT CURRENT_TIMESTAMP() ON UPDATE CURRENT_TIMESTAMP() -); -TABLE_WRAP + CREATE TABLE IF NOT EXISTS test ( + id INT UNSIGNED AUTO_INCREMENT PRIMARY KEY, + updatedAt TIMESTAMP DEFAULT CURRENT_TIMESTAMP() ON UPDATE CURRENT_TIMESTAMP() + ); + TABLE_WRAP ); $connection->executeStatement('DELETE FROM `test`;'); @@ -98,7 +98,7 @@ protected function getConnectionParams(): array 'user' => getenv('MYSQL_USER') !== false ? getenv('MYSQL_USER') : ($GLOBALS['db_user'] ?? 'root'), 'password' => getenv('MYSQL_PASS') !== false ? getenv('MYSQL_PASS') : ($GLOBALS['db_pass'] ?? ''), 'host' => getenv('MYSQL_HOST') !== false ? getenv('MYSQL_HOST') : ($GLOBALS['db_host'] ?? 'localhost'), - 'port' => (int) (getenv('MYSQL_PORT') !== false ? getenv('MYSQL_PORT') : ($GLOBALS['db_port'] ?? 3306)), + 'port' => (int) (getenv('MYSQL_PORT') !== false ? getenv('MYSQL_PORT') : ($GLOBALS['db_port'] ?? 3_306)), ]; if ($values['driver'] !== 'pdo_mysql') { @@ -114,7 +114,7 @@ protected function getConnectionParams(): array } /** - * Disconnect other sessions + * Disconnect other sessions. */ protected function forceDisconnect(DBALConnection $connection): void {