GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.
Passed
Push — master ( 35bb54...9b0758 )
by Cees-Jan
08:54 queued 12s
created

WithHeadersMiddlewareTest   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 16
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 11
c 1
b 0
f 0
dl 0
loc 16
rs 10
wmc 1

1 Method

Rating   Name   Duplication   Size   Complexity  
A testWithHeaders() 0 14 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace WyriHaximus\React\Tests\Http\Middleware;
6
7
use Psr\Http\Message\ResponseInterface;
8
use Psr\Http\Message\ServerRequestInterface;
9
use React\Http\Message\Response;
10
use React\Http\Message\ServerRequest;
11
use WyriHaximus\AsyncTestUtilities\AsyncTestCase;
12
use WyriHaximus\React\Http\Middleware\Header;
13
use WyriHaximus\React\Http\Middleware\WithHeadersMiddleware;
14
15
final class WithHeadersMiddlewareTest extends AsyncTestCase
16
{
17
    public function testWithHeaders(): void
18
    {
19
        $headers            = [
20
            new Header('X-Powered-By', 'ReactPHP 7'),
21
            new Header('X-Foo', 'Bar'),
22
        ];
23
        $request            = new ServerRequest('GET', 'https://example.com/');
24
        $middleware         = new WithHeadersMiddleware(...$headers);
25
        $requestWithHeaders = $this->await($middleware($request, static fn (ServerRequestInterface $request): ResponseInterface => new Response()), 1);
0 ignored issues
show
Unused Code introduced by
The parameter $request is not used and could be removed. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-unused  annotation

25
        $requestWithHeaders = $this->await($middleware($request, static fn (/** @scrutinizer ignore-unused */ ServerRequestInterface $request): ResponseInterface => new Response()), 1);

This check looks for parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
26
27
        self::assertTrue($requestWithHeaders->hasHeader('X-Powered-By'));
28
        self::assertSame('ReactPHP 7', $requestWithHeaders->getHeaderLine('X-Powered-By'));
29
        self::assertTrue($requestWithHeaders->hasHeader('X-Foo'));
30
        self::assertSame('Bar', $requestWithHeaders->getHeaderLine('X-Foo'));
31
    }
32
}
33