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