src/Leevel/Router/Router.php
protected function mergeMatchedData(array $before, array $after): array
    {
        $result = [];

        foreach (self::MATCHED as $key) {
            if (self::MIDDLEWARES === $key) {
                $result[$key] = $this->mergeMiddlewares($before[$key] ?? [], $after[$key] ?? []);
            } elseif (in_array($key, [self::PARAMS, self::VARS], true)) {
                $result[$key] = array_merge($before[$key] ?? [], $after[$key] ?? []);
            } else {
                $result[$key] = $after[$key] ?? $before[$key] ?? null;
            }
        }

        return $result;
    }
protected function mergeMatchedData(array $before, array $after): array
    {
        $result = [];

        foreach (self::MATCHED as $key) {
            if (self::MIDDLEWARES === $key) {
                $result[$key] = $this->mergeMiddlewares($before[$key] ?? [], $after[$key] ?? []);
            } elseif (in_array($key, [self::PARAMS, self::VARS], true)) {
                $result[$key] = array_merge($before[$key] ?? [], $after[$key] ?? []);
            } else {
                $result[$key] = $after[$key] ?? $before[$key] ?? null;
            }
        }

        return $result;
    }
合并匹配数据.

@param array $before
@param array $after

@return array