From 74598861ce8e7e1c21a29deadc2d01f1d258eee8 Mon Sep 17 00:00:00 2001 From: Charles Sprayberry Date: Fri, 5 Apr 2024 09:19:37 -0400 Subject: [PATCH] Cleanup to use readonly properties --- src/PdoConnectionAdapter.php | 18 +++++------------- 1 file changed, 5 insertions(+), 13 deletions(-) diff --git a/src/PdoConnectionAdapter.php b/src/PdoConnectionAdapter.php index 50ce299..e7e8072 100644 --- a/src/PdoConnectionAdapter.php +++ b/src/PdoConnectionAdapter.php @@ -2,12 +2,9 @@ namespace Cspray\DatabaseTestCase; -use Cspray\DatabaseTestCase\DatabaseRepresentation\Row; -use Cspray\DatabaseTestCase\DatabaseRepresentation\Table; -use Cspray\DatabaseTestCase\Exception\UnableToGetTable; +use Closure; use Cspray\DatabaseTestCase\Exception\MissingRequiredExtension; use PDO; -use PDOException; if (! extension_loaded('pdo')) { throw new MissingRequiredExtension('You must enable ext-pdo to use the ' . PdoConnectionAdapter::class); @@ -17,15 +14,10 @@ final class PdoConnectionAdapter extends AbstractConnectionAdapter { private ?PDO $connection = null; - /** @var callable */ - private $pdoSupplier; - - private readonly PdoDriver $pdoDriver; - - private function __construct(callable $pdoSupplier, PdoDriver $pdoDriver) { - $this->pdoSupplier = $pdoSupplier; - $this->pdoDriver = $pdoDriver; - } + private function __construct( + private readonly Closure $pdoSupplier, + private readonly PdoDriver $pdoDriver + ) {} public static function fromConnectionConfig(ConnectionAdapterConfig $adapterConfig, PdoDriver $pdoDriver) : self { return self::fromExistingConnection(new PDO($pdoDriver->dsn($adapterConfig)), $pdoDriver);