support for containers that resolve automatically dependencies without adding explicitly

pull/548/head
fadrian06 4 weeks ago
parent 7292464d1c
commit 8ccbd7ac9e

@ -437,11 +437,12 @@ class Dispatcher
public function resolveContainerClass(string $class, array &$params) public function resolveContainerClass(string $class, array &$params)
{ {
// PSR-11 // PSR-11
if ( if (is_a($this->containerHandler, '\Psr\Container\ContainerInterface')) {
is_a($this->containerHandler, '\Psr\Container\ContainerInterface') try {
&& $this->containerHandler->has($class)
) {
return $this->containerHandler->get($class); return $this->containerHandler->get($class);
} catch (Throwable) {
return null;
}
} }
// Just a callable where you configure the behavior (Dice, PHP-DI, etc.) // Just a callable where you configure the behavior (Dice, PHP-DI, etc.)

Loading…
Cancel
Save