Skip to content

Commit

Permalink
Reordered parameter list for Route::resolveClass to fix null paramete…
Browse files Browse the repository at this point in the history
…r order error.
  • Loading branch information
alanondra committed Aug 8, 2024
1 parent bb97a32 commit 4f40450
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/Route.php
Original file line number Diff line number Diff line change
Expand Up @@ -91,11 +91,11 @@ public function getCallable(?ContainerInterface $container = null): callable
}

if (is_array($callable) && isset($callable[0]) && is_string($callable[0])) {
$callable = [$this->resolveClass($container, $callable[0]), $callable[1]];
$callable = [$this->resolveClass($callable[0], $container), $callable[1]];
}

if (is_string($callable) && method_exists($callable, '__invoke')) {
$callable = $this->resolveClass($container, $callable);
$callable = $this->resolveClass($callable, $container);
}

if (! is_callable($callable)) {
Expand All @@ -108,12 +108,12 @@ public function getCallable(?ContainerInterface $container = null): callable
/**
* Get an object instance from a class name
*
* @param ContainerInterface|null $container
* @param string $class
* @param ContainerInterface|null $container
*
* @return object
*/
protected function resolveClass(?ContainerInterface $container = null, string $class)
protected function resolveClass(string $class, ?ContainerInterface $container = null)
{
if ($container instanceof ContainerInterface && $container->has($class)) {
return $container->get($class);
Expand Down

0 comments on commit 4f40450

Please sign in to comment.