Skip to content

Commit 1862281

Browse files
committed
allow resolver middleware to be instancied
1 parent 81de520 commit 1862281

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/Support/Field.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,7 @@ protected function getMiddleware(): array
147147
}
148148

149149
/**
150-
* @return array<string>
150+
* @return array<class-string|object>
151151
* @phpstan-param array<string> $middleware
152152
*/
153153
protected function appendGlobalMiddlewares(array $middleware): array
@@ -175,7 +175,7 @@ protected function getResolver(): ?Closure
175175

176176
foreach ($middleware as $name) {
177177
/** @var Middleware $instance */
178-
$instance = app()->make($name);
178+
$instance = \is_object($name) ? $name : app()->make($name);
179179

180180
if (method_exists($instance, 'terminate')) {
181181
app()->terminating(function () use ($arguments, $instance, $result): void {

0 commit comments

Comments
 (0)