src/Viserio/Component/Routing/SortedMiddleware.php
protected function moveMiddleware(array $middleware, int $from, int $to): array
    {
        \array_splice($middleware, $to, 0, $middleware[$from]);

        unset($middleware[$from + 1]);

        return $middleware;
    }
protected function moveMiddleware(array $middleware, int $from, int $to): array
    {
        \array_splice($middleware, $to, 0, $middleware[$from]);

        unset($middleware[$from + 1]);

        return $middleware;
    }
Splice a middleware into a new position and remove the old entry.

@param array $middleware
@param int   $from
@param int   $to

@return array