Skip to content
This repository was archived by the owner on Jan 29, 2020. It is now read-only.

Commit fdf3b25

Browse files
committed
Revert change to MiddlewareFactory::prepare()
This patch re-instates the conditional check for non-string or empty middleware, but with a slight change; it now reads: ```php if (! is_string($middleware) || $middleware === '') { throw Exception\InvalidMiddlewareException::forMiddleware($middleware); } ``` This satisfies the static analyzer, while simultaneously ensuring the intended behavior.
1 parent 0123f50 commit fdf3b25

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/MiddlewareFactory.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -76,11 +76,11 @@ public function prepare($middleware) : MiddlewareInterface
7676
return $this->pipeline(...$middleware);
7777
}
7878

79-
if (is_string($middleware)) {
80-
return $this->lazy($middleware);
79+
if (! is_string($middleware) || $middleware === '') {
80+
throw Exception\InvalidMiddlewareException::forMiddleware($middleware);
8181
}
8282

83-
throw Exception\InvalidMiddlewareException::forMiddleware($middleware);
83+
return $this->lazy($middleware);
8484
}
8585

8686
/**

0 commit comments

Comments
 (0)