Skip to content

Commit

Permalink
Make sure CallableResolver throws an exception if the callable cannot…
Browse files Browse the repository at this point in the history
… be resolved
  • Loading branch information
mnapoli committed Aug 18, 2015
1 parent e87d996 commit ba08a05
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions Slim/CallableResolver.php
Original file line number Diff line number Diff line change
Expand Up @@ -64,15 +64,13 @@ public function resolve($toResolve)
}
$resolved = [new $class, $method];
}

if (!is_callable($resolved)) {
throw new RuntimeException(sprintf('%s is not resolvable', $toResolve));
}
} else {
$resolved = $toResolve;
}

if ($resolved instanceof \Closure) {
if (!is_callable($resolved)) {
throw new RuntimeException(sprintf('%s is not resolvable', $toResolve));
} elseif ($resolved instanceof \Closure) {
$resolved = $resolved->bindTo($this->container);
}

Expand Down

0 comments on commit ba08a05

Please sign in to comment.