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.

Issues (47)

src/Messages/Rpc.php (4 issues)

1
<?php
2
3
declare(strict_types=1);
4
5
namespace WyriHaximus\React\ChildProcess\Messenger\Messages;
6
7
use Closure;
8
use Exception;
9
use JsonSerializable;
10
use Throwable;
11
12
use function sprintf;
13
14
final class Rpc implements JsonSerializable, ActionableMessageInterface
15
{
16
    protected string $target;
17
18
    protected Payload $payload;
19
20
    protected string $uniqid;
21
22
    /** @phpstan-ignore-next-line  */
23
    public function __construct(string $target, Payload $payload, string $uniqid = '') /** @phpstan-ignore-line  */
24
    {
25
        $this->target  = $target;
26
        $this->payload = $payload;
27 10
        $this->uniqid  = $uniqid;
28
    }
29 10
30 10
    public function getPayload(): Payload
31 10
    {
32 10
        return $this->payload;
33
    }
34
35
    public function setUniqid(string $uniqid): self
36
    {
37 3
        return new self($this->target, $this->payload, $uniqid);
38
    }
39 3
40
    /**
41
     * @return array<string,string|mixed>
42
     */
43
    public function jsonSerialize(): array
44
    {
45
        return [
46 3
            'type' => 'rpc',
47
            'uniqid' => $this->uniqid,
48 3
            'target' => $this->target,
49
            'payload' => $this->payload,
50
        ];
51
    }
52
53
    public function handle(object $bindTo, string $source): void
54 9
    {
55
        $cb = Closure::fromCallable(function (string $target, Payload $payload, string $uniqid): void {
56
            /**
57 9
             * @psalm-suppress UndefinedMethod
58 9
             */
59 9
            if (! $this->hasRpc($target)) { /** @phpstan-ignore-line  */
0 ignored issues
show
The method hasRpc() does not exist on WyriHaximus\React\ChildP...\Messenger\Messages\Rpc. ( Ignorable by Annotation )

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

59
            if (! $this->/** @scrutinizer ignore-call */ hasRpc($target)) { /** @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...
60 9
                $this->write($this->createLine(Factory::rpcError($uniqid, new Exception(sprintf('Rpc target <%s> doesn\'t exist', $target))))); /** @phpstan-ignore-line  */
0 ignored issues
show
The method createLine() does not exist on WyriHaximus\React\ChildP...\Messenger\Messages\Rpc. ( Ignorable by Annotation )

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

60
                $this->write($this->/** @scrutinizer ignore-call */ createLine(Factory::rpcError($uniqid, new Exception(sprintf('Rpc target <%s> doesn\'t exist', $target))))); /** @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...
The method write() does not exist on WyriHaximus\React\ChildP...\Messenger\Messages\Rpc. ( Ignorable by Annotation )

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

60
                $this->/** @scrutinizer ignore-call */ 
61
                       write($this->createLine(Factory::rpcError($uniqid, new Exception(sprintf('Rpc target <%s> doesn\'t exist', $target))))); /** @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...
61
62
                return;
63
            }
64
65
            /**
66
             * @psalm-suppress UndefinedMethod
67
             */
68 3
            $this->callRpc($target, $payload)->done( /** @phpstan-ignore-line  */
0 ignored issues
show
The method callRpc() does not exist on WyriHaximus\React\ChildP...\Messenger\Messages\Rpc. ( Ignorable by Annotation )

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

68
            $this->/** @scrutinizer ignore-call */ 
69
                   callRpc($target, $payload)->done( /** @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...
69
                function (array $payload) use ($uniqid): void {
70
                    /**
71 3
                     * @psalm-suppress UndefinedMethod
72
                     */
73
                    $this->write($this->createLine(Factory::rpcSuccess($uniqid, $payload))); /** @phpstan-ignore-line  */
74
                },
75
                function (Throwable $error) use ($uniqid): void {
76
                    /**
77 3
                     * @psalm-suppress UndefinedMethod
78
                     */
79 1
                    $this->write($this->createLine(Factory::rpcError($uniqid, $error))); /** @phpstan-ignore-line  */
80 3
                }
81
            );
82 2
        });
83 3
        $cb = $cb->bindTo($bindTo);
84 3
        /**
85
         * @psalm-suppress PossiblyInvalidFunctionCall
86 3
         */
87
        $cb($this->target, $this->payload, $this->uniqid);
88 3
    }
89
}
90