1
0
mirror of https://github.com/flarum/core.git synced 2025-10-13 16:05:05 +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:
Franz Liedke
2018-05-29 00:17:13 +02:00
parent 5d0ebde6b8
commit 3680d88fb7
15 changed files with 101 additions and 96 deletions

View File

@@ -14,13 +14,14 @@ namespace Flarum\Http\Middleware;
use Flarum\User\Guest;
use Flarum\User\User;
use Illuminate\Contracts\Session\Session;
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 AuthenticateWithSession implements MiddlewareInterface
class AuthenticateWithSession implements Middleware
{
public function process(Request $request, DelegateInterface $delegate)
public function process(Request $request, Handler $handler): Response
{
$session = $request->getAttribute('session');
@@ -30,7 +31,7 @@ class AuthenticateWithSession implements MiddlewareInterface
$request = $request->withAttribute('actor', $actor);
return $delegate->process($request);
return $handler->handle($request);
}
private function getActor(Session $session)