diff --git a/composer.lock b/composer.lock index ba10c5f0..02a39ab0 100644 --- a/composer.lock +++ b/composer.lock @@ -688,22 +688,22 @@ }, { "name": "laminas/laminas-hydrator", - "version": "4.17.0", + "version": "4.18.0", "source": { "type": "git", "url": "https://github.com/laminas/laminas-hydrator.git", - "reference": "626c5e446fdfa27865dfe3cd29123108408c2555" + "reference": "ab208d1b8a2dc4251182a6cd2d123ccbc56eda50" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/laminas/laminas-hydrator/zipball/626c5e446fdfa27865dfe3cd29123108408c2555", - "reference": "626c5e446fdfa27865dfe3cd29123108408c2555", + "url": "https://api.github.com/repos/laminas/laminas-hydrator/zipball/ab208d1b8a2dc4251182a6cd2d123ccbc56eda50", + "reference": "ab208d1b8a2dc4251182a6cd2d123ccbc56eda50", "shasum": "" }, "require": { "laminas/laminas-stdlib": "^3.20", "php": "~8.2.0 || ~8.3.0 || ~8.4.0 || ~8.5.0", - "webmozart/assert": "^1.11" + "webmozart/assert": "^1.11 || ^2.0" }, "conflict": { "laminas/laminas-servicemanager": "<3.14.0", @@ -761,7 +761,7 @@ "type": "community_bridge" } ], - "time": "2025-11-06T11:05:29+00:00" + "time": "2026-01-13T10:10:41+00:00" }, { "name": "myclabs/deep-copy", @@ -1092,16 +1092,16 @@ }, { "name": "phpstan/phpdoc-parser", - "version": "2.3.0", + "version": "2.3.1", "source": { "type": "git", "url": "https://github.com/phpstan/phpdoc-parser.git", - "reference": "1e0cd5370df5dd2e556a36b9c62f62e555870495" + "reference": "16dbf9937da8d4528ceb2145c9c7c0bd29e26374" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpstan/phpdoc-parser/zipball/1e0cd5370df5dd2e556a36b9c62f62e555870495", - "reference": "1e0cd5370df5dd2e556a36b9c62f62e555870495", + "url": "https://api.github.com/repos/phpstan/phpdoc-parser/zipball/16dbf9937da8d4528ceb2145c9c7c0bd29e26374", + "reference": "16dbf9937da8d4528ceb2145c9c7c0bd29e26374", "shasum": "" }, "require": { @@ -1133,9 +1133,9 @@ "description": "PHPDoc parser with support for nullable, intersection and generic types", "support": { "issues": "https://github.com/phpstan/phpdoc-parser/issues", - "source": "https://github.com/phpstan/phpdoc-parser/tree/2.3.0" + "source": "https://github.com/phpstan/phpdoc-parser/tree/2.3.1" }, - "time": "2025-08-30T15:50:23+00:00" + "time": "2026-01-12T11:33:04+00:00" }, { "name": "phpstan/phpstan", @@ -1788,16 +1788,16 @@ }, { "name": "rector/rector", - "version": "2.3.0", + "version": "2.3.1", "source": { "type": "git", "url": "https://github.com/rectorphp/rector.git", - "reference": "f7166355dcf47482f27be59169b0825995f51c7d" + "reference": "9afc1bb43571b25629f353c61a9315b5ef31383a" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/rectorphp/rector/zipball/f7166355dcf47482f27be59169b0825995f51c7d", - "reference": "f7166355dcf47482f27be59169b0825995f51c7d", + "url": "https://api.github.com/repos/rectorphp/rector/zipball/9afc1bb43571b25629f353c61a9315b5ef31383a", + "reference": "9afc1bb43571b25629f353c61a9315b5ef31383a", "shasum": "" }, "require": { @@ -1836,7 +1836,7 @@ ], "support": { "issues": "https://github.com/rectorphp/rector/issues", - "source": "https://github.com/rectorphp/rector/tree/2.3.0" + "source": "https://github.com/rectorphp/rector/tree/2.3.1" }, "funding": [ { @@ -1844,7 +1844,7 @@ "type": "github" } ], - "time": "2025-12-25T22:00:18+00:00" + "time": "2026-01-13T15:13:58+00:00" }, { "name": "sebastian/cli-parser", @@ -4151,23 +4151,23 @@ }, { "name": "webmozart/assert", - "version": "1.12.1", + "version": "2.1.2", "source": { "type": "git", "url": "https://github.com/webmozarts/assert.git", - "reference": "9be6926d8b485f55b9229203f962b51ed377ba68" + "reference": "ce6a2f100c404b2d32a1dd1270f9b59ad4f57649" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/webmozarts/assert/zipball/9be6926d8b485f55b9229203f962b51ed377ba68", - "reference": "9be6926d8b485f55b9229203f962b51ed377ba68", + "url": "https://api.github.com/repos/webmozarts/assert/zipball/ce6a2f100c404b2d32a1dd1270f9b59ad4f57649", + "reference": "ce6a2f100c404b2d32a1dd1270f9b59ad4f57649", "shasum": "" }, "require": { "ext-ctype": "*", "ext-date": "*", "ext-filter": "*", - "php": "^7.2 || ^8.0" + "php": "^8.2" }, "suggest": { "ext-intl": "", @@ -4177,7 +4177,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "1.10-dev" + "dev-feature/2-0": "2.0-dev" } }, "autoload": { @@ -4193,6 +4193,10 @@ { "name": "Bernhard Schussek", "email": "bschussek@gmail.com" + }, + { + "name": "Woody Gilk", + "email": "woody.gilk@gmail.com" } ], "description": "Assertions to validate method input/output with nice error messages.", @@ -4203,9 +4207,9 @@ ], "support": { "issues": "https://github.com/webmozarts/assert/issues", - "source": "https://github.com/webmozarts/assert/tree/1.12.1" + "source": "https://github.com/webmozarts/assert/tree/2.1.2" }, - "time": "2025-10-29T15:56:20+00:00" + "time": "2026-01-13T14:02:24+00:00" }, { "name": "webmozart/glob", diff --git a/src/ConfigProvider.php b/src/ConfigProvider.php index 1fde2b58..eb1758d9 100644 --- a/src/ConfigProvider.php +++ b/src/ConfigProvider.php @@ -7,25 +7,11 @@ final class ConfigProvider { public const NAMED_ADAPTER_KEY = 'adapters'; - public function __invoke(): array - { - return [ - 'dependencies' => $this->getDependencies(), - Adapter\AdapterInterface::class => $this->getConfig(), - ]; - } - public function getConfig(): array + public function __invoke(): array { - // supported configuration structure return [ - // Adapter\Adapter::class => [], - // Adapter\AdapterInterface::class => [], - // self::NAMED_ADAPTER_KEY => [ - // Adapter\Adapter::class => [], - // Adapter\AdapterInterface::class => [], - // 'Custom\Name' => [], - // ], + 'dependencies' => $this->getDependencies(), ]; } diff --git a/src/Container/AdapterInterfaceFactory.php b/src/Container/AdapterInterfaceFactory.php index 7e8921a1..8969e896 100644 --- a/src/Container/AdapterInterfaceFactory.php +++ b/src/Container/AdapterInterfaceFactory.php @@ -29,6 +29,7 @@ public function __invoke( 'Container is missing a config service' ); } + $config = $container->get('config') ?? []; $adapterConfig = $config[AdapterInterface::class] ?? $config[Adapter::class] ?? []; @@ -43,14 +44,6 @@ public function __invoke( /** @var class-string|class-string|null $driverClass */ $driverClass = $adapterConfig['driver'] ?? null; - if ($driverClass === null || ! $container->has($driverClass)) { - throw ContainerException::forService( - AdapterInterface::class, - self::class, - 'Invalid or missing driver provided for ' . $requestedName - ); - } - /** @var DriverInterface|PdoDriverInterface $driver */ $driver = $container->build($driverClass, $adapterConfig); diff --git a/test/unit/ConfigProviderTest.php b/test/unit/ConfigProviderTest.php index 0e9242f1..9fc3a0e2 100644 --- a/test/unit/ConfigProviderTest.php +++ b/test/unit/ConfigProviderTest.php @@ -21,8 +21,7 @@ class ConfigProviderTest extends TestCase * } * */ private array $config = [ - Adapter\AdapterInterface::class => [], - 'dependencies' => [ + 'dependencies' => [ 'abstract_factories' => [ Container\AbstractAdapterInterfaceFactory::class, ],