Skip to content

Commit 02e60a5

Browse files
authored
Merge pull request #24 from gacela-project/upgrade-container-0.3
Upgrade container:0.3
2 parents 65f6d69 + 3325cc5 commit 02e60a5

File tree

4 files changed

+8
-6
lines changed

4 files changed

+8
-6
lines changed

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
"license": "MIT",
55
"require": {
66
"php": ">=8.0.2",
7-
"gacela-project/resolver": "^0.2"
7+
"gacela-project/container": "^0.3"
88
},
99
"require-dev": {
1010
"ext-mbstring": "*",

psalm.xml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22
<psalm
33
errorLevel="1"
44
phpVersion="8.0"
5+
findUnusedBaselineEntry="true"
6+
findUnusedCode="false"
57
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
68
xmlns="https://getpsalm.org/schema/config"
79
xsi:schemaLocation="https://getpsalm.org/schema/config vendor/vimeo/psalm/config.xsd"

src/Router/Entities/Route.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
namespace Gacela\Router\Entities;
66

7-
use Gacela\Resolver\InstanceCreator;
7+
use Gacela\Container\Container;
88
use Gacela\Router\Bindings;
99

1010
use Gacela\Router\Exceptions\UnsupportedResponseTypeException;
@@ -34,8 +34,8 @@ public function run(Bindings $bindings): string|Stringable
3434
$params = (new RouteParams($this))->asArray();
3535

3636
if (!is_object($this->controller)) {
37-
$creator = new InstanceCreator($bindings->getAllBindings());
38-
$controller = $creator->createByClassName($this->controller);
37+
$creator = new Container($bindings->getAllBindings());
38+
$controller = $creator->get($this->controller);
3939
$response = $controller->{$this->action}(...$params);
4040
} else {
4141
/** @var string|Stringable $response */

src/Router/Router.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
use Closure;
88
use Exception;
9-
use Gacela\Resolver\InstanceCreator;
9+
use Gacela\Container\Container;
1010
use Gacela\Router\Entities\Route;
1111
use Gacela\Router\Exceptions\NotFound404Exception;
1212
use ReflectionFunction;
@@ -58,7 +58,7 @@ private static function handleException(Handlers $handlers, Exception $exception
5858
return $handler($exception);
5959
}
6060

61-
$instance = InstanceCreator::create($handler);
61+
$instance = Container::create($handler);
6262

6363
if (is_callable($instance)) {
6464
return $instance($exception);

0 commit comments

Comments
 (0)