1
0
mirror of https://github.com/danog/amp.git synced 2025-01-23 05:41:25 +01:00
amp/stubs/Fiber.php

32 lines
1.1 KiB
PHP
Raw Normal View History

2020-09-24 11:52:22 -05:00
<?php
final class Fiber
{
/**
* Can only be called within {@see FiberScheduler::run()}.
*
* @param callable $callback Function to invoke when starting the Fiber.
* @param mixed ...$args Function arguments.
*/
public static function run(callable $callback, mixed ...$args): void { }
/**
2020-11-05 11:29:31 -06:00
* Suspend execution of the fiber. A Continuation object is provided as the first argument to the given callback.
* The fiber may be resumed with {@see Continuation::resume()} or {@see Continuation::throw()}.
2020-09-24 11:52:22 -05:00
*
* @param callable(Fiber):void $enqueue
2020-09-24 11:52:22 -05:00
* @param FiberScheduler $scheduler
*
2020-11-05 11:29:31 -06:00
* @return mixed Value provided to {@see Continuation::resume()}.
2020-09-24 11:52:22 -05:00
*
* @throws FiberError Thrown if within {@see FiberScheduler::run()}.
2020-11-05 11:29:31 -06:00
* @throws Throwable Exception provided to {@see Continuation::throw()}.
2020-09-24 11:52:22 -05:00
*/
public static function suspend(callable $enqueue, FiberScheduler $scheduler): mixed { }
2020-11-05 11:29:31 -06:00
/**
* Private constructor to force use of {@see run()}.
*/
private function __construct() { }
2020-09-24 11:52:22 -05:00
}