diff --git a/composer.json b/composer.json index e2f0bcf..92da69c 100644 --- a/composer.json +++ b/composer.json @@ -32,8 +32,8 @@ } }, "require": { - "php": "~8.2.0 || ~8.3.0 || ~8.4.0", - "php-db/phpdb": "^0.2.1" + "php": "~8.2.0 || ~8.3.0 || ~8.4.0 || ~8.5.0", + "php-db/phpdb": "^0.3.2" }, "require-dev": { "ext-mysqli": "*", diff --git a/composer.lock b/composer.lock index 6d3b10b..f93b74b 100644 --- a/composer.lock +++ b/composer.lock @@ -4,30 +4,30 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "a69e6b2f455434327af0f084381f5feb", + "content-hash": "3d68e25b79f19fd20226d1d4b0571a6b", "packages": [ { "name": "brick/varexporter", - "version": "0.5.0", + "version": "0.6.0", "source": { "type": "git", "url": "https://github.com/brick/varexporter.git", - "reference": "84b2a7a91f69aa5d079aec5a0a7256ebf2dceb6b" + "reference": "af98bfc2b702a312abbcaff37656dbe419cec5bc" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/brick/varexporter/zipball/84b2a7a91f69aa5d079aec5a0a7256ebf2dceb6b", - "reference": "84b2a7a91f69aa5d079aec5a0a7256ebf2dceb6b", + "url": "https://api.github.com/repos/brick/varexporter/zipball/af98bfc2b702a312abbcaff37656dbe419cec5bc", + "reference": "af98bfc2b702a312abbcaff37656dbe419cec5bc", "shasum": "" }, "require": { "nikic/php-parser": "^5.0", - "php": "^7.4 || ^8.0" + "php": "^8.1" }, "require-dev": { "php-coveralls/php-coveralls": "^2.2", - "phpunit/phpunit": "^9.3", - "psalm/phar": "5.21.1" + "phpunit/phpunit": "^10.5", + "vimeo/psalm": "6.8.4" }, "type": "library", "autoload": { @@ -45,7 +45,7 @@ ], "support": { "issues": "https://github.com/brick/varexporter/issues", - "source": "https://github.com/brick/varexporter/tree/0.5.0" + "source": "https://github.com/brick/varexporter/tree/0.6.0" }, "funding": [ { @@ -53,26 +53,26 @@ "type": "github" } ], - "time": "2024-05-10T17:15:19+00:00" + "time": "2025-02-20T17:42:39+00:00" }, { "name": "laminas/laminas-servicemanager", - "version": "4.4.0", + "version": "4.5.0", "source": { "type": "git", "url": "https://github.com/laminas/laminas-servicemanager.git", - "reference": "74da44d07e493b834347123242d0047976fb9932" + "reference": "a6996829c8ce55025cca1b57b1e8a8b165e3926c" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/laminas/laminas-servicemanager/zipball/74da44d07e493b834347123242d0047976fb9932", - "reference": "74da44d07e493b834347123242d0047976fb9932", + "url": "https://api.github.com/repos/laminas/laminas-servicemanager/zipball/a6996829c8ce55025cca1b57b1e8a8b165e3926c", + "reference": "a6996829c8ce55025cca1b57b1e8a8b165e3926c", "shasum": "" }, "require": { - "brick/varexporter": "^0.3.8 || ^0.4.0 || ^0.5.0", + "brick/varexporter": "^0.3.8 || ^0.4.0 || ^0.5.0 || ^0.6.0", "laminas/laminas-stdlib": "^3.19", - "php": "~8.1.0 || ~8.2.0 || ~8.3.0 || ~8.4.0", + "php": "~8.2.0 || ~8.3.0 || ~8.4.0 || ~8.5.0", "psr/container": "^1.1 || ^2.0" }, "conflict": { @@ -86,14 +86,14 @@ "composer/package-versions-deprecated": "^1.11.99.5", "friendsofphp/proxy-manager-lts": "^1.0.18", "laminas/laminas-cli": "^1.11", - "laminas/laminas-coding-standard": "~3.0.1", - "laminas/laminas-container-config-test": "^1.0", + "laminas/laminas-coding-standard": "~3.1.0", + "laminas/laminas-container-config-test": "^1.1", "mikey179/vfsstream": "^1.6.12", - "phpbench/phpbench": "^1.4.0", - "phpunit/phpunit": "^10.5.44", - "psalm/plugin-phpunit": "^0.19.2", - "symfony/console": "^6.4.17 || ^7.0", - "vimeo/psalm": "^6.2.0" + "phpbench/phpbench": "^1.4.1", + "phpunit/phpunit": "^10.5.58", + "psalm/plugin-phpunit": "^0.19.5", + "symfony/console": "^6.4.17 || ^7.3.4", + "vimeo/psalm": "^6.13.1" }, "suggest": { "friendsofphp/proxy-manager-lts": "To handle lazy initialization of services", @@ -130,7 +130,7 @@ "chat": "https://laminas.dev/chat", "forum": "https://discourse.laminas.dev", "issues": "https://github.com/laminas/laminas-servicemanager/issues", - "source": "https://github.com/laminas/laminas-servicemanager/tree/4.4.0" + "source": "https://github.com/laminas/laminas-servicemanager/tree/4.5.0" }, "funding": [ { @@ -138,7 +138,7 @@ "type": "community_bridge" } ], - "time": "2025-02-04T06:13:50+00:00" + "time": "2025-10-14T09:41:04+00:00" }, { "name": "laminas/laminas-stdlib", @@ -201,16 +201,16 @@ }, { "name": "nikic/php-parser", - "version": "v5.6.1", + "version": "v5.6.2", "source": { "type": "git", "url": "https://github.com/nikic/PHP-Parser.git", - "reference": "f103601b29efebd7ff4a1ca7b3eeea9e3336a2a2" + "reference": "3a454ca033b9e06b63282ce19562e892747449bb" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/nikic/PHP-Parser/zipball/f103601b29efebd7ff4a1ca7b3eeea9e3336a2a2", - "reference": "f103601b29efebd7ff4a1ca7b3eeea9e3336a2a2", + "url": "https://api.github.com/repos/nikic/PHP-Parser/zipball/3a454ca033b9e06b63282ce19562e892747449bb", + "reference": "3a454ca033b9e06b63282ce19562e892747449bb", "shasum": "" }, "require": { @@ -253,28 +253,28 @@ ], "support": { "issues": "https://github.com/nikic/PHP-Parser/issues", - "source": "https://github.com/nikic/PHP-Parser/tree/v5.6.1" + "source": "https://github.com/nikic/PHP-Parser/tree/v5.6.2" }, - "time": "2025-08-13T20:13:15+00:00" + "time": "2025-10-21T19:32:17+00:00" }, { "name": "php-db/phpdb", - "version": "0.2.1", + "version": "0.3.2", "source": { "type": "git", "url": "https://github.com/php-db/phpdb.git", - "reference": "d221b024cb3aea77992f41a962913918301dc92e" + "reference": "b3df2ff1f3d776f42f8d926b23535e4143a93996" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/php-db/phpdb/zipball/d221b024cb3aea77992f41a962913918301dc92e", - "reference": "d221b024cb3aea77992f41a962913918301dc92e", + "url": "https://api.github.com/repos/php-db/phpdb/zipball/b3df2ff1f3d776f42f8d926b23535e4143a93996", + "reference": "b3df2ff1f3d776f42f8d926b23535e4143a93996", "shasum": "" }, "require": { - "laminas/laminas-servicemanager": "^4.0.0", + "laminas/laminas-servicemanager": "^3.0.0 || ^4.0.0", "laminas/laminas-stdlib": "^3.20.0", - "php": "~8.2.0 || ~8.3.0 || ~8.4.0" + "php": "~8.2.0 || ~8.3.0 || ~8.4.0 || ~8.5.0" }, "conflict": { "laminas/laminas-db": "*", @@ -283,6 +283,7 @@ "require-dev": { "laminas/laminas-coding-standard": "^3.0.1", "laminas/laminas-eventmanager": "^3.14.0", + "laminas/laminas-hydrator": "^4.6.0", "phpstan/phpstan": "^2.1", "phpstan/phpstan-phpunit": "^2.0", "phpunit/phpunit": "^11.5.15", @@ -321,7 +322,7 @@ "issues": "https://github.com/php-db/phpdb/issues", "source": "https://github.com/php-db/phpdb" }, - "time": "2025-10-07T08:36:48+00:00" + "time": "2025-12-01T04:51:41+00:00" }, { "name": "psr/container", @@ -380,29 +381,29 @@ "packages-dev": [ { "name": "dealerdirect/phpcodesniffer-composer-installer", - "version": "v1.1.2", + "version": "v1.2.0", "source": { "type": "git", "url": "https://github.com/PHPCSStandards/composer-installer.git", - "reference": "e9cf5e4bbf7eeaf9ef5db34938942602838fc2b1" + "reference": "845eb62303d2ca9b289ef216356568ccc075ffd1" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/PHPCSStandards/composer-installer/zipball/e9cf5e4bbf7eeaf9ef5db34938942602838fc2b1", - "reference": "e9cf5e4bbf7eeaf9ef5db34938942602838fc2b1", + "url": "https://api.github.com/repos/PHPCSStandards/composer-installer/zipball/845eb62303d2ca9b289ef216356568ccc075ffd1", + "reference": "845eb62303d2ca9b289ef216356568ccc075ffd1", "shasum": "" }, "require": { "composer-plugin-api": "^2.2", "php": ">=5.4", - "squizlabs/php_codesniffer": "^2.0 || ^3.1.0 || ^4.0" + "squizlabs/php_codesniffer": "^3.1.0 || ^4.0" }, "require-dev": { "composer/composer": "^2.2", "ext-json": "*", "ext-zip": "*", "php-parallel-lint/php-parallel-lint": "^1.4.0", - "phpcompatibility/php-compatibility": "^9.0", + "phpcompatibility/php-compatibility": "^9.0 || ^10.0.0@dev", "yoast/phpunit-polyfills": "^1.0" }, "type": "composer-plugin", @@ -472,7 +473,7 @@ "type": "thanks_dev" } ], - "time": "2025-07-17T20:45:56+00:00" + "time": "2025-11-11T04:32:07+00:00" }, { "name": "laminas/laminas-coding-standard", @@ -754,11 +755,11 @@ }, { "name": "phpstan/phpstan", - "version": "2.1.31", + "version": "2.1.32", "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpstan/phpstan/zipball/ead89849d879fe203ce9292c6ef5e7e76f867b96", - "reference": "ead89849d879fe203ce9292c6ef5e7e76f867b96", + "url": "https://api.github.com/repos/phpstan/phpstan/zipball/e126cad1e30a99b137b8ed75a85a676450ebb227", + "reference": "e126cad1e30a99b137b8ed75a85a676450ebb227", "shasum": "" }, "require": { @@ -803,25 +804,25 @@ "type": "github" } ], - "time": "2025-10-10T14:14:11+00:00" + "time": "2025-11-11T15:18:17+00:00" }, { "name": "phpstan/phpstan-phpunit", - "version": "2.0.7", + "version": "2.0.8", "source": { "type": "git", "url": "https://github.com/phpstan/phpstan-phpunit.git", - "reference": "9a9b161baee88a5f5c58d816943cff354ff233dc" + "reference": "2fe9fbeceaf76dd1ebaa7bbbb25e2fb5e59db2fe" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpstan/phpstan-phpunit/zipball/9a9b161baee88a5f5c58d816943cff354ff233dc", - "reference": "9a9b161baee88a5f5c58d816943cff354ff233dc", + "url": "https://api.github.com/repos/phpstan/phpstan-phpunit/zipball/2fe9fbeceaf76dd1ebaa7bbbb25e2fb5e59db2fe", + "reference": "2fe9fbeceaf76dd1ebaa7bbbb25e2fb5e59db2fe", "shasum": "" }, "require": { "php": "^7.4 || ^8.0", - "phpstan/phpstan": "^2.1.18" + "phpstan/phpstan": "^2.1.32" }, "conflict": { "phpunit/phpunit": "<7.0" @@ -854,9 +855,9 @@ "description": "PHPUnit extensions and rules for PHPStan", "support": { "issues": "https://github.com/phpstan/phpstan-phpunit/issues", - "source": "https://github.com/phpstan/phpstan-phpunit/tree/2.0.7" + "source": "https://github.com/phpstan/phpstan-phpunit/tree/2.0.8" }, - "time": "2025-07-13T11:31:46+00:00" + "time": "2025-11-11T07:55:22+00:00" }, { "name": "phpunit/php-code-coverage", @@ -1195,16 +1196,16 @@ }, { "name": "phpunit/phpunit", - "version": "11.5.42", + "version": "11.5.44", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/phpunit.git", - "reference": "1c6cb5dfe412af3d0dfd414cfd110e3b9cfdbc3c" + "reference": "c346885c95423eda3f65d85a194aaa24873cda82" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/1c6cb5dfe412af3d0dfd414cfd110e3b9cfdbc3c", - "reference": "1c6cb5dfe412af3d0dfd414cfd110e3b9cfdbc3c", + "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/c346885c95423eda3f65d85a194aaa24873cda82", + "reference": "c346885c95423eda3f65d85a194aaa24873cda82", "shasum": "" }, "require": { @@ -1276,7 +1277,7 @@ "support": { "issues": "https://github.com/sebastianbergmann/phpunit/issues", "security": "https://github.com/sebastianbergmann/phpunit/security/policy", - "source": "https://github.com/sebastianbergmann/phpunit/tree/11.5.42" + "source": "https://github.com/sebastianbergmann/phpunit/tree/11.5.44" }, "funding": [ { @@ -1300,7 +1301,7 @@ "type": "tidelift" } ], - "time": "2025-09-28T12:09:13+00:00" + "time": "2025-11-13T07:17:35+00:00" }, { "name": "sebastian/cli-parser", @@ -2355,16 +2356,16 @@ }, { "name": "squizlabs/php_codesniffer", - "version": "3.13.4", + "version": "3.13.5", "source": { "type": "git", "url": "https://github.com/PHPCSStandards/PHP_CodeSniffer.git", - "reference": "ad545ea9c1b7d270ce0fc9cbfb884161cd706119" + "reference": "0ca86845ce43291e8f5692c7356fccf3bcf02bf4" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/PHPCSStandards/PHP_CodeSniffer/zipball/ad545ea9c1b7d270ce0fc9cbfb884161cd706119", - "reference": "ad545ea9c1b7d270ce0fc9cbfb884161cd706119", + "url": "https://api.github.com/repos/PHPCSStandards/PHP_CodeSniffer/zipball/0ca86845ce43291e8f5692c7356fccf3bcf02bf4", + "reference": "0ca86845ce43291e8f5692c7356fccf3bcf02bf4", "shasum": "" }, "require": { @@ -2381,11 +2382,6 @@ "bin/phpcs" ], "type": "library", - "extra": { - "branch-alias": { - "dev-master": "3.x-dev" - } - }, "notification-url": "https://packagist.org/downloads/", "license": [ "BSD-3-Clause" @@ -2435,7 +2431,7 @@ "type": "thanks_dev" } ], - "time": "2025-09-05T05:47:09+00:00" + "time": "2025-11-04T16:30:35+00:00" }, { "name": "staabm/side-effects-detector", @@ -2491,16 +2487,16 @@ }, { "name": "theseer/tokenizer", - "version": "1.2.3", + "version": "1.3.1", "source": { "type": "git", "url": "https://github.com/theseer/tokenizer.git", - "reference": "737eda637ed5e28c3413cb1ebe8bb52cbf1ca7a2" + "reference": "b7489ce515e168639d17feec34b8847c326b0b3c" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/theseer/tokenizer/zipball/737eda637ed5e28c3413cb1ebe8bb52cbf1ca7a2", - "reference": "737eda637ed5e28c3413cb1ebe8bb52cbf1ca7a2", + "url": "https://api.github.com/repos/theseer/tokenizer/zipball/b7489ce515e168639d17feec34b8847c326b0b3c", + "reference": "b7489ce515e168639d17feec34b8847c326b0b3c", "shasum": "" }, "require": { @@ -2529,7 +2525,7 @@ "description": "A small library for converting tokenized PHP source code into XML and potentially other formats", "support": { "issues": "https://github.com/theseer/tokenizer/issues", - "source": "https://github.com/theseer/tokenizer/tree/1.2.3" + "source": "https://github.com/theseer/tokenizer/tree/1.3.1" }, "funding": [ { @@ -2537,7 +2533,7 @@ "type": "github" } ], - "time": "2024-03-03T12:36:25+00:00" + "time": "2025-11-17T20:03:58+00:00" }, { "name": "webimpress/coding-standard", @@ -2601,7 +2597,7 @@ "prefer-stable": true, "prefer-lowest": false, "platform": { - "php": "~8.2.0 || ~8.3.0 || ~8.4.0" + "php": "~8.2.0 || ~8.3.0 || ~8.4.0 || ~8.5.0" }, "platform-dev": { "ext-mysqli": "*", @@ -2610,5 +2606,5 @@ "platform-overrides": { "php": "8.2.99" }, - "plugin-api-version": "2.6.0" + "plugin-api-version": "2.9.0" } diff --git a/phpstan-baseline.neon b/phpstan-baseline.neon index 86fc464..ea4169d 100644 --- a/phpstan-baseline.neon +++ b/phpstan-baseline.neon @@ -6,18 +6,6 @@ parameters: count: 1 path: src/Container/DriverInterfaceFactoryFactory.php - - - message: '#^Cannot call static method createFromConfig\(\) on callable\.$#' - identifier: staticMethod.nonObject - count: 1 - path: src/Container/MysqliDriverFactory.php - - - - message: '#^Cannot call static method createFromConfig\(\) on callable\.$#' - identifier: staticMethod.nonObject - count: 1 - path: src/Container/PdoDriverFactory.php - - message: '#^Method PhpDb\\Adapter\\Profiler\\ProfilerInterface\:\:profilerFinish\(\) invoked with 1 parameter, 0 required\.$#' identifier: arguments.count diff --git a/src/ConfigProvider.php b/src/ConfigProvider.php index d0a9c1d..9356f41 100644 --- a/src/ConfigProvider.php +++ b/src/ConfigProvider.php @@ -15,10 +15,8 @@ use PhpDb\Adapter\Platform\PlatformInterface; use PhpDb\Adapter\Profiler; use PhpDb\Container\AdapterAbstractServiceFactory; -use PhpDb\Container\AdapterManager; use PhpDb\Container\ConnectionInterfaceFactoryFactoryInterface; use PhpDb\Container\DriverInterfaceFactoryFactoryInterface; -use PhpDb\Container\MetadataFactory; use PhpDb\Container\PlatformInterfaceFactoryFactoryInterface; use PhpDb\Metadata\MetadataInterface; use PhpDb\ResultSet; @@ -28,8 +26,7 @@ final class ConfigProvider public function __invoke(): array { return [ - 'dependencies' => $this->getDependencies(), - AdapterManager::class => $this->getAdapterManagerConfig(), + 'dependencies' => $this->getDependencies(), ]; } @@ -40,23 +37,6 @@ public function getDependencies(): array AdapterAbstractServiceFactory::class, ], 'aliases' => [ - MetadataInterface::class => MysqlMetadata::class, - ], - 'factories' => [ - MysqlMetadata::class => MetadataFactory::class, - ], - 'delegators' => [ - AdapterManager::class => [ - Container\AdapterManagerDelegator::class, - ], - ], - ]; - } - - public function getAdapterManagerConfig(): array - { - return [ - 'aliases' => [ 'MySqli' => Driver\Mysqli\Mysqli::class, 'MySQLi' => Driver\Mysqli\Mysqli::class, 'Mysqli' => Driver\Mysqli\Mysqli::class, @@ -74,9 +54,10 @@ public function getAdapterManagerConfig(): array ResultSet\ResultSetInterface::class => ResultSet\ResultSet::class, ConnectionInterfaceFactoryFactoryInterface::class => Container\ConnectionInterfaceFactoryFactory::class, DriverInterfaceFactoryFactoryInterface::class => Container\DriverInterfaceFactoryFactory::class, + MetadataInterface::class => MysqlMetadata::class, PlatformInterfaceFactoryFactoryInterface::class => Container\PlatformInterfaceFactoryFactory::class, ], - 'factories' => [ + 'factories' => [ AdapterInterface::class => Container\AdapterFactory::class, Driver\Mysqli\Mysqli::class => Container\MysqliDriverFactory::class, Driver\Mysqli\Connection::class => Container\MysqliConnectionFactory::class, @@ -84,19 +65,20 @@ public function getAdapterManagerConfig(): array Driver\Mysqli\Statement::class => Container\MysqliStatementFactory::class, Driver\Pdo\Pdo::class => Container\PdoDriverFactory::class, Driver\Pdo\Connection::class => Container\PdoConnectionFactory::class, - Result::class => Container\PdoResultFactory::class, + MysqlMetadata::class => Container\MetadataInterfaceFactory::class, PdoStatement::class => Container\PdoStatementFactory::class, PlatformInterface::class => Container\PlatformInterfaceFactory::class, Profiler\Profiler::class => InvokableFactory::class, + Result::class => Container\PdoResultFactory::class, ResultSet\ResultSet::class => InvokableFactory::class, ], - 'invokables' => [ + 'invokables' => [ Container\ConnectionInterfaceFactoryFactory::class - => Container\ConnectionInterfaceFactoryFactory::class, + => Container\ConnectionInterfaceFactoryFactory::class, Container\DriverInterfaceFactoryFactory::class - => Container\DriverInterfaceFactoryFactory::class, + => Container\DriverInterfaceFactoryFactory::class, Container\PlatformInterfaceFactoryFactory::class - => Container\PlatformInterfaceFactoryFactory::class, + => Container\PlatformInterfaceFactoryFactory::class, ], ]; } diff --git a/src/Container/AdapterFactory.php b/src/Container/AdapterFactory.php index b6b9b16..7670dfc 100644 --- a/src/Container/AdapterFactory.php +++ b/src/Container/AdapterFactory.php @@ -12,7 +12,6 @@ use PhpDb\Adapter\Exception\RuntimeException; use PhpDb\Adapter\Platform\PlatformInterface; use PhpDb\Adapter\Profiler\ProfilerInterface; -use PhpDb\Container\AdapterManager; use PhpDb\ResultSet\ResultSetInterface; use Psr\Container\ContainerInterface; @@ -22,9 +21,6 @@ final class AdapterFactory { public function __invoke(ContainerInterface $container): AdapterInterface { - /** @var AdapterManager $adapterManager */ - $adapterManager = $container->get(AdapterManager::class); - /** @var array $config */ $config = $container->get('config'); @@ -38,7 +34,7 @@ public function __invoke(ContainerInterface $container): AdapterInterface /** @var string $driver */ $driver = $dbConfig['driver']; - if (! $adapterManager->has($driver)) { + if (! $container->has($driver)) { throw new ServiceNotFoundException(sprintf( 'Database driver "%s" is not registered in the adapter manager.', $driver @@ -46,9 +42,9 @@ public function __invoke(ContainerInterface $container): AdapterInterface } /** @var DriverInterface|PdoDriverInterface $driverInstance */ - $driverInstance = $adapterManager->get($driver); + $driverInstance = $container->get($driver); - if (! $adapterManager->has(PlatformInterface::class)) { + if (! $container->has(PlatformInterface::class)) { throw new ServiceNotFoundException(sprintf( 'Database platform "%s" is not registered in the adapter manager.', PlatformInterface::class @@ -56,9 +52,9 @@ public function __invoke(ContainerInterface $container): AdapterInterface } /** @var PlatformInterface $platformInstance */ - $platformInstance = $adapterManager->get(PlatformInterface::class); + $platformInstance = $container->get(PlatformInterface::class); - if (! $adapterManager->has(ResultSetInterface::class)) { + if (! $container->has(ResultSetInterface::class)) { throw new ServiceNotFoundException(sprintf( 'ResultSet "%s" is not registered in the adapter manager.', ResultSetInterface::class @@ -66,11 +62,11 @@ public function __invoke(ContainerInterface $container): AdapterInterface } /** @var ResultSetInterface $resultSetInstance */ - $resultSetInstance = $adapterManager->get(ResultSetInterface::class); + $resultSetInstance = $container->get(ResultSetInterface::class); /** @var ProfilerInterface|null $profilerInstanceOrNull */ - $profilerInstanceOrNull = $adapterManager->has(ProfilerInterface::class) - ? $adapterManager->get(ProfilerInterface::class) + $profilerInstanceOrNull = $container->has(ProfilerInterface::class) + ? $container->get(ProfilerInterface::class) : null; return new Adapter( diff --git a/src/Container/AdapterManagerDelegator.php b/src/Container/AdapterManagerDelegator.php deleted file mode 100644 index c93cf39..0000000 --- a/src/Container/AdapterManagerDelegator.php +++ /dev/null @@ -1,28 +0,0 @@ -configure( - (new ConfigProvider())->getAdapterManagerConfig() - ); - - return $adapterManager; - } -} diff --git a/src/Container/ConnectionInterfaceFactoryFactory.php b/src/Container/ConnectionInterfaceFactoryFactory.php index d5f0cdf..001daa7 100644 --- a/src/Container/ConnectionInterfaceFactoryFactory.php +++ b/src/Container/ConnectionInterfaceFactoryFactory.php @@ -8,7 +8,6 @@ use PhpDb\Adapter\Mysql\Container\PdoConnectionFactory; use PhpDb\Adapter\Mysql\Driver\Mysqli\Mysqli; use PhpDb\Adapter\Mysql\Driver\Pdo\Pdo; -use PhpDb\Container\AdapterManager; use PhpDb\Container\ConnectionInterfaceFactoryFactoryInterface as FactoryFactoryInterface; use Psr\Container\ContainerInterface; use RuntimeException; @@ -29,7 +28,7 @@ public function __invoke( $requestedName )); } - $adapterServices = $container->get('config')[AdapterManager::class]; + $adapterServices = $container->get('config'); $configuredDriver = $adapterConfig[$requestedName]['driver']; if (array_key_exists($configuredDriver, $adapterServices['aliases'])) { $aliasTo = $adapterServices['aliases'][$configuredDriver]; diff --git a/src/Container/DriverInterfaceFactoryFactory.php b/src/Container/DriverInterfaceFactoryFactory.php index 11190a1..e4ce956 100644 --- a/src/Container/DriverInterfaceFactoryFactory.php +++ b/src/Container/DriverInterfaceFactoryFactory.php @@ -4,7 +4,6 @@ namespace PhpDb\Adapter\Mysql\Container; -use PhpDb\Container\AdapterManager; use PhpDb\Container\DriverInterfaceFactoryFactoryInterface as FactoryFactoryInterface; use Psr\Container\ContainerInterface; use RuntimeException; @@ -24,7 +23,7 @@ public function __invoke( $requestedName )); } - $adapterServices = $container->get('config')[AdapterManager::class]; + $adapterServices = $container->get('config'); $configuredDriver = $adapterConfig[$requestedName]['driver']; $aliasTo ??= $adapterServices['aliases'][$configuredDriver] ?? $configuredDriver; diff --git a/src/Container/MetadataInterfaceFactory.php b/src/Container/MetadataInterfaceFactory.php new file mode 100644 index 0000000..6080713 --- /dev/null +++ b/src/Container/MetadataInterfaceFactory.php @@ -0,0 +1,19 @@ +get(AdapterInterface::class); + return new MysqlMetadata($adapterInterface); + } +} diff --git a/src/Container/MysqliConnectionFactory.php b/src/Container/MysqliConnectionFactory.php index 01117eb..a47bb5d 100644 --- a/src/Container/MysqliConnectionFactory.php +++ b/src/Container/MysqliConnectionFactory.php @@ -4,12 +4,11 @@ namespace PhpDb\Adapter\Mysql\Container; -use Laminas\ServiceManager\Factory\FactoryInterface; use PhpDb\Adapter\Driver\ConnectionInterface; use PhpDb\Adapter\Mysql\Driver\Mysqli\Connection; use Psr\Container\ContainerInterface; -final class MysqliConnectionFactory implements FactoryInterface +final class MysqliConnectionFactory { public function __invoke( ContainerInterface $container, diff --git a/src/Container/MysqliDriverFactory.php b/src/Container/MysqliDriverFactory.php index 4b87376..4351254 100644 --- a/src/Container/MysqliDriverFactory.php +++ b/src/Container/MysqliDriverFactory.php @@ -6,16 +6,12 @@ use PhpDb\Adapter\Driver; use PhpDb\Adapter\Mysql\Driver\Mysqli; -use PhpDb\Container\AdapterManager; use Psr\Container\ContainerInterface; final class MysqliDriverFactory { public function __invoke(ContainerInterface $container): Driver\DriverInterface&Mysqli\Mysqli { - /** @var AdapterManager $adapterManager */ - $adapterManager = $container->get(AdapterManager::class); - /** @var array $config */ $config = $container->get('config'); @@ -26,13 +22,13 @@ public function __invoke(ContainerInterface $container): Driver\DriverInterface& $options = $dbConfig['options'] ?? []; /** @var Driver\ConnectionInterface&Mysqli\Connection $connectionInstance */ - $connectionInstance = $adapterManager->get(Mysqli\Connection::class); + $connectionInstance = $container->get(Mysqli\Connection::class); /** @var Driver\StatementInterface&Mysqli\Statement $statementInstance */ - $statementInstance = $adapterManager->get(Mysqli\Statement::class); + $statementInstance = $container->get(Mysqli\Statement::class); /** @var Driver\ResultInterface&Mysqli\Result $resultInstance */ - $resultInstance = $adapterManager->get(Mysqli\Result::class); + $resultInstance = $container->get(Mysqli\Result::class); return new Mysqli\Mysqli( $connectionInstance, @@ -46,10 +42,8 @@ public static function createFromConfig( ContainerInterface $container, string $requestedName, ): Driver\DriverInterface&Mysqli\Mysqli { - /** @var AdapterManager $adapterManager */ - $adapterManager = $container->get(AdapterManager::class); $connectionFactory = ( - $adapterManager->get(ConnectionInterfaceFactoryFactory::class) + $container->get(ConnectionInterfaceFactoryFactory::class) )($container, $requestedName); /** @var array $config */ $config = $container->get('config'); @@ -60,8 +54,8 @@ public static function createFromConfig( return new Mysqli\Mysqli( $connectionFactory::createFromConfig($container, $requestedName), - $adapterManager->get(Mysqli\Statement::class), - $adapterManager->get(Mysqli\Result::class), + $container->get(Mysqli\Statement::class), + $container->get(Mysqli\Result::class), $adapterConfig['options'] ?? [] ); } diff --git a/src/Container/PdoDriverFactory.php b/src/Container/PdoDriverFactory.php index 5e82d45..e245ca2 100644 --- a/src/Container/PdoDriverFactory.php +++ b/src/Container/PdoDriverFactory.php @@ -12,25 +12,20 @@ use PhpDb\Adapter\Driver\StatementInterface; use PhpDb\Adapter\Mysql\Driver\Pdo\Connection; use PhpDb\Adapter\Mysql\Driver\Pdo\Pdo as PdoDriver; -use PhpDb\Container\AdapterManager; use Psr\Container\ContainerInterface; final class PdoDriverFactory { public function __invoke(ContainerInterface $container): PdoDriverInterface&PdoDriver { - /** @var AdapterManager $adapterManager */ - $adapterManager = $container->get(AdapterManager::class); - /** @var ConnectionInterface&Connection $connectionInstance */ - $connectionInstance = $adapterManager->get(Connection::class); + $connectionInstance = $container->get(Connection::class); /** @var StatementInterface&Statement $statementInstance */ - $statementInstance = $adapterManager->get(Statement::class); + $statementInstance = $container->get(Statement::class); /** @var ResultInterface&Result $resultInstance */ - $resultInstance = $adapterManager->get(Result::class); - + $resultInstance = $container->get(Result::class); return new PdoDriver( $connectionInstance, $statementInstance, @@ -42,10 +37,8 @@ public static function createFromConfig( ContainerInterface $container, string $requestedName, ): PdoDriverInterface&PdoDriver { - /** @var AdapterManager $adapterManager */ - $adapterManager = $container->get(AdapterManager::class); $connectionFactory = ( - $adapterManager->get(ConnectionInterfaceFactoryFactory::class) + $container->get(ConnectionInterfaceFactoryFactory::class) )($container, $requestedName); /** @var array $config */ $config = $container->get('config'); @@ -60,10 +53,10 @@ public static function createFromConfig( $connectionInstance = $connectionFactory::createFromConfig($container, $requestedName); /** @var StatementInterface&Statement $statementInstance */ - $statementInstance = $adapterManager->get(Statement::class); + $statementInstance = $container->get(Statement::class); /** @var ResultInterface&Result $resultInstance */ - $resultInstance = $adapterManager->get(Result::class); + $resultInstance = $container->get(Result::class); return new PdoDriver( $connectionInstance, diff --git a/src/Container/PlatformInterfaceFactory.php b/src/Container/PlatformInterfaceFactory.php index 7edbefd..9a7b170 100644 --- a/src/Container/PlatformInterfaceFactory.php +++ b/src/Container/PlatformInterfaceFactory.php @@ -9,16 +9,12 @@ use PhpDb\Adapter\Driver\DriverInterface; use PhpDb\Adapter\Mysql\Platform\Mysql; use PhpDb\Adapter\Platform\PlatformInterface; -use PhpDb\Container\AdapterManager; use Psr\Container\ContainerInterface; final class PlatformInterfaceFactory { public function __invoke(ContainerInterface $container): PlatformInterface&Mysql { - /** @var AdapterManager $adapterManager */ - $adapterManager = $container->get(AdapterManager::class); - /** @var array $config */ $config = $container->get('config'); @@ -29,7 +25,7 @@ public function __invoke(ContainerInterface $container): PlatformInterface&Mysql $driver = $dbConfig['driver']; /** @var DriverInterface|mysqli|PDO $driverInstance */ - $driverInstance = $adapterManager->get($driver); + $driverInstance = $container->get($driver); return new Mysql($driverInstance); } diff --git a/test/integration/Container/TestAsset/SetupTrait.php b/test/integration/Container/TestAsset/SetupTrait.php index c985da0..aff2cf1 100644 --- a/test/integration/Container/TestAsset/SetupTrait.php +++ b/test/integration/Container/TestAsset/SetupTrait.php @@ -11,7 +11,6 @@ use PhpDb\Adapter\Mysql\ConfigProvider; use PhpDb\Adapter\Mysql\Driver\Pdo\Pdo; use PhpDb\ConfigProvider as LaminasDbConfigProvider; -use PhpDb\Container\AdapterManager; use Psr\Container\ContainerInterface; use function getenv; @@ -30,8 +29,6 @@ trait SetupTrait protected ?AdapterInterface $adapter; - protected AdapterManager $adapterManager; - protected ContainerInterface $container; protected DriverInterface|string|null $driver = null; @@ -87,10 +84,9 @@ protected function getAdapter(array $config = []): AdapterInterface ] ); - $this->config = $serviceManagerConfig; - $this->container = new ServiceManager($this->config); - $this->adapterManager = $this->container->get(AdapterManager::class); - $this->adapter = $this->adapterManager->get(AdapterInterface::class); + $this->config = $serviceManagerConfig; + $this->container = new ServiceManager($this->config); + $this->adapter = $this->container->get(AdapterInterface::class); return $this->adapter; }