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.

Error   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 41
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 4
eloc 12
c 1
b 0
f 0
dl 0
loc 41
rs 10
ccs 12
cts 12
cp 1

4 Methods

Rating   Name   Duplication   Size   Complexity  
A jsonSerialize() 0 5 1
A __construct() 0 3 1
A getPayload() 0 3 1
A handle() 0 16 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace WyriHaximus\React\ChildProcess\Messenger\Messages;
6
7
use JsonSerializable;
8
use Throwable;
9
10
use function WyriHaximus\throwable_encode;
11
12
final class Error implements JsonSerializable, ActionableMessageInterface
13
{
14
    protected Throwable $payload;
15
16
    public function __construct(Throwable $payload)
17
    {
18 3
        $this->payload = $payload;
19
    }
20 3
21 3
    public function getPayload(): Throwable
22
    {
23
        return $this->payload;
24
    }
25
26 2
    /**
27
     * @return array<string,string|array<mixed>>
28 2
     */
29
    public function jsonSerialize(): array
30
    {
31
        return [
32
            'type' => 'error',
33
            'payload' => throwable_encode($this->payload),
34 2
        ];
35
    }
36
37 2
    public function handle(object $bindTo, string $source): void
38 2
    {
39
        $cb = function (Throwable $payload): void {
40
            /**
41
             * @psalm-suppress UndefinedMethod
42
             */
43
            $this->emit('error', [ /** @phpstan-ignore-line  */
0 ignored issues
show
Bug introduced by
The method emit() does not exist on WyriHaximus\React\ChildP...essenger\Messages\Error. ( Ignorable by Annotation )

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

43
            $this->/** @scrutinizer ignore-call */ 
44
                   emit('error', [ /** @phpstan-ignore-line  */

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
44
                $payload,
45
                $this,
46
            ]);
47
        };
48 1
        $cb = $cb->bindTo($bindTo);
49 1
        /**
50 1
         * @psalm-suppress PossiblyInvalidFunctionCall
51 1
         */
52
        $cb($this->payload);
53 1
    }
54
}
55