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