Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update facile-it/facile-coding-standard requirement from ^0.5.2 to ^1.2.0 #92

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
4 changes: 1 addition & 3 deletions src/ConnectionInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,4 @@

use Doctrine\DBAL\Driver\Connection as DriverConnection;

interface ConnectionInterface extends DriverConnection
{
}
interface ConnectionInterface extends DriverConnection {}
9 changes: 3 additions & 6 deletions src/ConnectionTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -112,14 +112,11 @@
/**
* @internal
*/
public function resetAttemptCount(): void

Check warning on line 115 in src/ConnectionTrait.php

View workflow job for this annotation

GitHub Actions / Infection (PHP 8.3 / MySQL 8.0)

Escaped Mutant for Mutator "PublicVisibility": --- Original +++ New @@ @@ /** * @internal */ - public function resetAttemptCount() : void + protected function resetAttemptCount() : void { $this->currentAttempts = 0; }
{
$this->currentAttempts = 0;
}

/**
* @param string $connectionName
*/
public function connect(?string $connectionName = null): DriverConnection
{
$this->hasBeenClosedWithAnOpenTransaction = false;
Expand Down Expand Up @@ -147,13 +144,13 @@
}

/**
* @param list<mixed>|array<string, mixed> $params
* @param list<mixed>|array<string, mixed> $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);
}

/**
Expand All @@ -167,7 +164,7 @@
*/
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
Expand Down
4 changes: 2 additions & 2 deletions src/Statement.php
Original file line number Diff line number Diff line change
Expand Up @@ -66,12 +66,12 @@

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());
}

/**
Expand All @@ -89,11 +89,11 @@
attempt:
$result = $callable(...$params);
} catch (Exception $e) {
if (! $this->retriableConnection->canTryAgain($e, $this->sql)) {

Check warning on line 92 in src/Statement.php

View workflow job for this annotation

GitHub Actions / Psalm

UndefinedMethod

src/Statement.php:92:47: UndefinedMethod: Method Doctrine\DBAL\Connection::canTryAgain does not exist (see https://psalm.dev/022)
throw $e;
}

$this->retriableConnection->increaseAttemptCount();

Check warning on line 96 in src/Statement.php

View workflow job for this annotation

GitHub Actions / Psalm

UndefinedMethod

src/Statement.php:96:41: UndefinedMethod: Method Doctrine\DBAL\Connection::increaseAttemptCount does not exist (see https://psalm.dev/022)

Check warning on line 96 in src/Statement.php

View workflow job for this annotation

GitHub Actions / Infection (PHP 8.3 / MySQL 8.0)

Escaped Mutant for Mutator "MethodCallRemoval": --- Original +++ New @@ @@ if (!$this->retriableConnection->canTryAgain($e, $this->sql)) { throw $e; } - $this->retriableConnection->increaseAttemptCount(); + $this->recreateStatement(); goto attempt; }
$this->recreateStatement();

goto attempt;
Expand Down
14 changes: 7 additions & 7 deletions tests/Functional/AbstractFunctionalTestCase.php
Original file line number Diff line number Diff line change
Expand Up @@ -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`;');
Expand Down Expand Up @@ -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') {
Expand All @@ -114,7 +114,7 @@ protected function getConnectionParams(): array
}

/**
* Disconnect other sessions
* Disconnect other sessions.
*/
protected function forceDisconnect(DBALConnection $connection): void
{
Expand Down
Loading