This commit is contained in:
2021-04-21 10:27:15 +08:00
parent 294a5fccc0
commit bc6e4afe12
+6 -7
View File
@@ -3,19 +3,16 @@ declare(strict_types=1);
namespace HttpServer\Route;
use Annotation\Aspect;
use Closure;
use Database\InjectProperty;
use Exception;
use HttpServer\Abstracts\HttpService;
use HttpServer\Http\Request;
use HttpServer\IInterface\Middleware;
use HttpServer\IInterface\RouterInterface;
use JetBrains\PhpStorm\Pure;
use ReflectionException;
use Snowflake\Abstracts\Config;
use Snowflake\Core\Json;
use Snowflake\Exception\ComponentException;
use Snowflake\Exception\ConfigException;
use Snowflake\Exception\NotFindClassException;
use Snowflake\Snowflake;
@@ -331,9 +328,9 @@ class Router extends HttpService implements RouterInterface
* @param string|array $middleware
* @return array
* @throws NotFindClassException
* @throws \ReflectionException
* @throws ReflectionException
*/
private function resolve_middleware(string|array $middleware)
private function resolve_middleware(string|array $middleware): array
{
if (is_string($middleware)) {
$middleware = [$middleware];
@@ -346,9 +343,11 @@ class Router extends HttpService implements RouterInterface
if (!($value instanceof Middleware)) {
continue;
}
}
$array[] = [$value, 'onHandler'];
} else {
$array[] = $value;
}
}
return $array;
}