forked from phpstan/phpstan-src
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathProcess.php
More file actions
37 lines (29 loc) · 1.08 KB
/
Copy pathProcess.php
File metadata and controls
37 lines (29 loc) · 1.08 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
<?php declare(strict_types = 1);
namespace PHPStan\Parallel;
use React\Stream\ReadableStreamInterface;
use React\Stream\WritableStreamInterface;
use Throwable;
/**
* A parallel analysis worker as seen by ParallelAnalyser / ProcessPool.
*
* Implementations differ only in how the worker process comes to life:
* SpawnedProcess spawns a fresh PHP process via react/child-process,
* ForkedProcess forks the already-booted main process via pcntl_fork(). Both
* then speak the same TCP + NDJSON protocol, so request()/quit()/
* bindConnection() behave identically and live in ProcessBase.
*/
interface Process
{
/**
* @param callable(mixed[] $json) : void $onData
* @param callable(Throwable $exception): void $onError
* @param callable(?int $exitCode, string $output) : void $onExit
*/
public function start(callable $onData, callable $onError, callable $onExit): void;
/**
* @param mixed[] $data
*/
public function request(array $data): void;
public function quit(): void;
public function bindConnection(ReadableStreamInterface $out, WritableStreamInterface $in): void;
}