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 | use WyriHaximus\React\ChildProcess\Messenger\MessengerInterface; |
||
12 | |||
13 | final class RpcError implements JsonSerializable, ActionableMessageInterface |
||
14 | { |
||
15 | protected string $uniqid; |
||
16 | |||
17 | protected Throwable $payload; |
||
18 | |||
19 | public function __construct(string $uniqid, Throwable $payload) |
||
20 | { |
||
21 | $this->uniqid = $uniqid; |
||
22 | $this->payload = $payload; |
||
23 | } |
||
24 | 4 | ||
25 | /** |
||
26 | 4 | * @return Exception|Throwable |
|
27 | 4 | */ |
|
28 | 4 | public function getPayload() |
|
29 | { |
||
30 | return $this->payload; |
||
31 | } |
||
32 | |||
33 | 2 | /** |
|
34 | * @return array<string,string|mixed> |
||
35 | 2 | */ |
|
36 | public function jsonSerialize(): array |
||
37 | { |
||
38 | return [ |
||
39 | 'type' => 'rpc_error', |
||
40 | 'uniqid' => $this->uniqid, |
||
41 | 2 | 'payload' => LineEncoder::encode($this->payload), |
|
42 | ]; |
||
43 | } |
||
44 | 2 | ||
45 | 2 | public function handle(MessengerInterface $bindTo, string $source): void |
|
46 | 2 | { |
|
47 | $cb = Closure::fromCallable(function (Throwable $payload, string $uniqid): void { |
||
48 | /** |
||
49 | * @psalm-suppress UndefinedMethod |
||
50 | */ |
||
51 | $this->getOutstandingCall($uniqid)->reject($payload); /** @phpstan-ignore-line */ |
||
0 ignored issues
–
show
|
|||
52 | }); |
||
53 | $cb = $cb->bindTo($bindTo); |
||
54 | /** |
||
55 | * @psalm-suppress PossiblyInvalidFunctionCall |
||
56 | 1 | */ |
|
57 | 1 | $cb($this->payload, $this->uniqid); |
|
58 | 1 | } |
|
59 | } |
||
60 |
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.