add proxy server command and update lowest version of PHP >= 8.0

This commit is contained in:
crazywhalecc
2022-11-03 10:18:17 +08:00
parent 6b34427855
commit 35dec947df
49 changed files with 826 additions and 301 deletions

View File

@@ -4,9 +4,7 @@ declare(strict_types=1);
namespace ZM\Middleware;
use Closure;
use OneBot\Util\Singleton;
use Throwable;
use ZM\Exception\InvalidArgumentException;
class MiddlewareHandler
@@ -107,7 +105,7 @@ class MiddlewareHandler
$after_result = container()->call($this->middlewares[$item[0]]['after'], $args);
}
}
} catch (Throwable $e) {
} catch (\Throwable $e) {
while (isset($this->stack[$stack_id]) && ($item = array_pop($this->stack[$stack_id])) !== null) {
// 如果是 pipeline 形式的中间件,则使用闭包回去
if (class_exists($item[0]) && is_a($item[0], PipelineInterface::class, true)) {
@@ -134,7 +132,7 @@ class MiddlewareHandler
/**
* @throws InvalidArgumentException
* @throws Throwable
* @throws \Throwable
*/
public function process(callable $callback, ...$args)
{
@@ -169,7 +167,7 @@ class MiddlewareHandler
*/
public function getStackId(callable $callback): string
{
if ($callback instanceof Closure) {
if ($callback instanceof \Closure) {
// 闭包情况下直接根据闭包的ID号来找stack
return strval(spl_object_id($callback));
}