From 2ee273c074aa3080c35736c4d081e867fb0df254 Mon Sep 17 00:00:00 2001 From: Joey Smith Date: Sun, 30 Nov 2025 20:53:22 -0600 Subject: [PATCH 1/3] Fix return type issue between SMv3 and SMv4 Signed-off-by: Joey Smith Signed-off-by: Joey Smith --- src/Container/AdapterAbstractServiceFactory.php | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/Container/AdapterAbstractServiceFactory.php b/src/Container/AdapterAbstractServiceFactory.php index 1922ae2c..7eb781b3 100644 --- a/src/Container/AdapterAbstractServiceFactory.php +++ b/src/Container/AdapterAbstractServiceFactory.php @@ -4,7 +4,6 @@ namespace PhpDb\Container; -use Laminas\ServiceManager\Factory\AbstractFactoryInterface; use PhpDb\Adapter\Adapter; use PhpDb\Adapter\AdapterInterface; use PhpDb\ResultSet\ResultSetInterface; @@ -17,7 +16,7 @@ * * Allows configuring several database instances (such as writer and reader). */ -class AdapterAbstractServiceFactory implements AbstractFactoryInterface +class AdapterAbstractServiceFactory { /** @var array */ protected $config; @@ -49,7 +48,6 @@ public function __invoke( $driverInstance = $driverFactory::createFromConfig($container, $requestedName); $platformFactory = ($container->get(PlatformInterfaceFactoryFactoryInterface::class))(); - //$config = $this->getConfig($container); return new Adapter( $driverInstance, $platformFactory::fromDriver($driverInstance), From 16d09790325c8011f563cf8872d9f58d1458969c Mon Sep 17 00:00:00 2001 From: Joey Smith Date: Sun, 30 Nov 2025 22:47:32 -0600 Subject: [PATCH 2/3] Fixes abstract factory, maybe Signed-off-by: Joey Smith Signed-off-by: Joey Smith --- src/Container/AdapterAbstractServiceFactory.php | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/src/Container/AdapterAbstractServiceFactory.php b/src/Container/AdapterAbstractServiceFactory.php index 7eb781b3..52e6ceb5 100644 --- a/src/Container/AdapterAbstractServiceFactory.php +++ b/src/Container/AdapterAbstractServiceFactory.php @@ -4,6 +4,7 @@ namespace PhpDb\Container; +use Laminas\ServiceManager\Factory\AbstractFactoryInterface; use PhpDb\Adapter\Adapter; use PhpDb\Adapter\AdapterInterface; use PhpDb\ResultSet\ResultSetInterface; @@ -16,7 +17,7 @@ * * Allows configuring several database instances (such as writer and reader). */ -class AdapterAbstractServiceFactory +class AdapterAbstractServiceFactory implements AbstractFactoryInterface { /** @var array */ protected $config; @@ -24,7 +25,7 @@ class AdapterAbstractServiceFactory /** * Can we create an adapter by the requested name? */ - public function canCreate(ContainerInterface $container, string $requestedName): bool + public function canCreate(ContainerInterface $container, $requestedName): bool { $config = $this->getConfig($container); if (empty($config)) { @@ -41,7 +42,7 @@ public function canCreate(ContainerInterface $container, string $requestedName): */ public function __invoke( ContainerInterface $container, - string $requestedName, + $requestedName, ?array $options = null ): AdapterInterface { $driverFactory = ($container->get(DriverInterfaceFactoryFactoryInterface::class))($container, $requestedName); @@ -57,10 +58,8 @@ public function __invoke( /** * Get db configuration, if any - * - * @return array */ - protected function getConfig(ContainerInterface $container) + protected function getConfig(ContainerInterface $container): array { if ($this->config !== null) { return $this->config; From 689a1e678509dfe323331d8b8730f3212ca88701 Mon Sep 17 00:00:00 2001 From: Joey Smith Date: Mon, 1 Dec 2025 21:58:21 -0600 Subject: [PATCH 3/3] Remove readonly constraint from AbstractPdo driver to allow concrete classes to provide defaults. Signed-off-by: Joey Smith Signed-off-by: Joey Smith --- src/Adapter/Driver/Pdo/AbstractPdo.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/Adapter/Driver/Pdo/AbstractPdo.php b/src/Adapter/Driver/Pdo/AbstractPdo.php index 0e2d93d7..9087757d 100644 --- a/src/Adapter/Driver/Pdo/AbstractPdo.php +++ b/src/Adapter/Driver/Pdo/AbstractPdo.php @@ -31,9 +31,9 @@ abstract class AbstractPdo implements PdoDriverInterface, ProfilerAwareInterface protected ?ProfilerInterface $profiler; public function __construct( - protected readonly AbstractPdoConnection|PDO $connection, - protected readonly StatementInterface&PdoDriverAwareInterface $statementPrototype, - protected readonly ResultInterface $resultPrototype, + protected AbstractPdoConnection|PDO $connection, + protected StatementInterface&PdoDriverAwareInterface $statementPrototype, + protected ResultInterface $resultPrototype, array $features = [], ) { if ($this->connection instanceof PdoDriverAwareInterface) {