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

Infection improvements #87

Merged
merged 4 commits into from
Sep 26, 2024
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 .github/workflows/continuous-integration.yml
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ jobs:
if: matrix.job == 'Tests'

- name: "Run mutation testing with Infection"
run: "vendor/bin/infection --ansi --show-mutations"
run: "vendor/bin/roave-infection-static-analysis-plugin --ansi --show-mutations"
if: matrix.job == 'infection'

- name: Upload code coverage
Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,6 @@ test: wait-php wait-mysql
@docker compose exec -T php ./vendor/bin/phpunit --colors=always

infection: wait-php wait-mysql
@docker compose exec -e XDEBUG_MODE=coverage -T php ./vendor/bin/infection --show-mutations --ansi
@docker compose exec -e XDEBUG_MODE=coverage -T php ./vendor/bin/roave-infection-static-analysis-plugin --show-mutations --ansi

.SILENT:
3 changes: 2 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,13 @@
"require-dev": {
"ext-pdo": "*",
"facile-it/facile-coding-standard": "^1.2.0",
"infection/infection": "^0.27.10",
"infection/infection": "^0.27.8",
"phpdocumentor/reflection-docblock": ">=4.0.1",
"phpspec/prophecy-phpunit": "^2.0",
"phpunit/phpunit": "^10.5",
"psalm/plugin-phpunit": "0.19.0",
"rector/rector": "^1.0",
"roave/infection-static-analysis-plugin": "^1.34",
"vimeo/psalm": "5.26.1"
},
"autoload": {
Expand Down
1 change: 1 addition & 0 deletions src/Connection.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

namespace Facile\DoctrineMySQLComeBack\Doctrine\DBAL;

/** @psalm-suppress PropertyNotSetInConstructor */
class Connection extends \Doctrine\DBAL\Connection
{
use ConnectionTrait;
Expand Down
5 changes: 5 additions & 0 deletions src/ConnectionTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,11 @@
Driver $driver,
?Configuration $config = null
) {
$this->commonConstructor($params, $driver, $config);
}

private function commonConstructor(array &$params, Driver $driver, ?Configuration $config): void
{
if (isset($params['driverOptions']['x_reconnect_attempts'])) {
$this->maxReconnectAttempts = $this->validateAttemptsOption($params['driverOptions']['x_reconnect_attempts']);
unset($params['driverOptions']['x_reconnect_attempts']);
Expand Down Expand Up @@ -112,7 +117,7 @@
/**
* @internal
*/
public function resetAttemptCount(): void

Check warning on line 120 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;
}
Expand Down
6 changes: 2 additions & 4 deletions src/Connections/PrimaryReadReplicaConnection.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,7 @@

class PrimaryReadReplicaConnection extends \Doctrine\DBAL\Connections\PrimaryReadReplicaConnection
{
use ConnectionTrait {
__construct as __traitConstruct;
}
use ConnectionTrait;

public function __construct(array $params, Driver $driver, ?Configuration $config = null)
{
Expand All @@ -19,6 +17,6 @@ public function __construct(array $params, Driver $driver, ?Configuration $confi
unset($params['primary']['driverOptions']['x_reconnect_attempts']);
}

self::__traitConstruct($params, $driver, $config);
$this->commonConstructor($params, $driver, $config);
}
}
Loading