diff --git a/etc/qa/phpstan.neon b/etc/qa/phpstan.neon index c008893..d0550bf 100644 --- a/etc/qa/phpstan.neon +++ b/etc/qa/phpstan.neon @@ -7,10 +7,11 @@ parameters: - ReactParallel\EventLoop\CanceledFuture - ReactParallel\EventLoop\KilledRuntime stubFiles: + - ../../stubs/Channel.stub - ../../stubs/Event.stub - - ../../stubs/Future.stub - ../../stubs/functions.stub - - ../../stubs/Channel.stub + - ../../stubs/Future.stub + - ../../stubs/Runtime.stub includes: - ../../vendor/wyrihaximus/async-test-utilities/rules.neon diff --git a/extension.neon b/extension.neon index 3d7cd60..05a0f87 100644 --- a/extension.neon +++ b/extension.neon @@ -4,3 +4,4 @@ parameters: - stubs/Event.stub - stubs/functions.stub - stubs/Future.stub + - stubs/Runtime.stub diff --git a/stubs/Runtime.stub b/stubs/Runtime.stub new file mode 100644 index 0000000..5abb4c2 --- /dev/null +++ b/stubs/Runtime.stub @@ -0,0 +1,60 @@ + $argv + * @template T + * @return ($task is (Closure():T) ? Future : null) + * + * @throws Runtime\Error\Closed if \parallel\Runtime was closed. + * @throws Runtime\Error\IllegalFunction if task is a closure created from an internal function. + * @throws Runtime\Error\IllegalInstruction if task contains illegal instructions. + * @throws Runtime\Error\IllegalParameter if task accepts or argv contains illegal variables. + * @throws Runtime\Error\IllegalReturn if task returns illegally. + */ + public function run(Closure $task, ?array $argv = null): ?Future {} + + /* Join */ + + /** + * @throws Runtime\Error\Closed if Runtime was already closed. + */ + public function close(): void {} + + /** + * @throws Runtime\Error\Closed if Runtime was closed. + */ + public function kill(): void {} +}