Skip to content

Commit 34151be

Browse files
committed
move CallableResolver to container
1 parent df0a839 commit 34151be

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

src/Bridge.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
use Slim\App;
1313
use Slim\Factory\AppFactory;
1414
use \Invoker\CallableResolver as InvokerCallableResolver;
15+
use Slim\Interfaces\CallableResolverInterface;
1516

1617
/**
1718
* This factory creates a Slim application correctly configured with PHP-DI.
@@ -26,8 +27,8 @@ public static function create(ContainerInterface $container = null): App
2627
$container = $container ?: new Container;
2728

2829
$callableResolver = new InvokerCallableResolver($container);
29-
AppFactory::setCallableResolver(new CallableResolver($callableResolver));
3030

31+
$container->set(CallableResolverInterface::class, new CallableResolver($callableResolver));
3132
$app = AppFactory::createFromContainer($container);
3233

3334
$controllerInvoker = self::createControllerInvoker($container);

tests/RoutingTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ public function injects_route_placeholder_over_request_attribute()
118118
public function resolve_controller_from_container()
119119
{
120120
$app = Bridge::create();
121-
$app->get('/', UserController::class . ':dashboard');
121+
$app->get('/', [UserController::class, 'dashboard']);
122122

123123
$response = $app->handle(RequestFactory::create());
124124
$this->assertEquals('Hello world!', (string) $response->getBody());

0 commit comments

Comments
 (0)