mirror of
https://github.com/flarum/core.git
synced 2025-10-14 16:34:26 +02:00
Use PSR-15 middleware standard
This finally adopts the new standardized interfaces instead of the work-in-progress ones with the `Interop\` prefix. Since we have now updated to PHP 7.1, we can also use Stratigility 3.0 as the middleware dispatcher.
This commit is contained in:
@@ -15,12 +15,12 @@ use FastRoute\Dispatcher;
|
||||
use Flarum\Http\Exception\MethodNotAllowedException;
|
||||
use Flarum\Http\Exception\RouteNotFoundException;
|
||||
use Flarum\Http\RouteCollection;
|
||||
use Interop\Http\ServerMiddleware\DelegateInterface;
|
||||
use Interop\Http\ServerMiddleware\MiddlewareInterface;
|
||||
use Psr\Http\Message\ResponseInterface as Response;
|
||||
use Psr\Http\Message\ServerRequestInterface as Request;
|
||||
use Psr\Http\Server\MiddlewareInterface as Middleware;
|
||||
use Psr\Http\Server\RequestHandlerInterface as Handler;
|
||||
|
||||
class DispatchRoute implements MiddlewareInterface
|
||||
class DispatchRoute implements Middleware
|
||||
{
|
||||
/**
|
||||
* @var RouteCollection
|
||||
@@ -45,13 +45,10 @@ class DispatchRoute implements MiddlewareInterface
|
||||
/**
|
||||
* Dispatch the given request to our route collection.
|
||||
*
|
||||
* @param Request $request
|
||||
* @param DelegateInterface $delegate
|
||||
* @return Response
|
||||
* @throws MethodNotAllowedException
|
||||
* @throws RouteNotFoundException
|
||||
*/
|
||||
public function process(Request $request, DelegateInterface $delegate)
|
||||
public function process(Request $request, Handler $handler): Response
|
||||
{
|
||||
$method = $request->getMethod();
|
||||
$uri = $request->getUri()->getPath() ?: '/';
|
||||
|
Reference in New Issue
Block a user