support for containers that resolve automatically dependencies without adding explicitly

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

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

Loading…
Cancel
Save