mirror of
https://github.com/danog/amp.git
synced 2024-12-02 09:27:46 +01:00
Remove fiber stubs
This commit is contained in:
parent
9f6b75485f
commit
467ab0aa06
@ -1,92 +0,0 @@
|
||||
<?php
|
||||
|
||||
final class Fiber
|
||||
{
|
||||
/**
|
||||
* @param callable $callback Function to invoke when starting the fiber.
|
||||
*/
|
||||
public function __construct(callable $callback) { }
|
||||
|
||||
/**
|
||||
* Starts execution of the fiber. Returns when the fiber suspends or terminates.
|
||||
*
|
||||
* @param mixed ...$args Arguments passed to fiber function.
|
||||
*
|
||||
* @return mixed Value from the first suspension point.
|
||||
*
|
||||
* @throw FiberError If the fiber is running or terminated.
|
||||
* @throw Throwable If the fiber callable throws an uncaught exception.
|
||||
*/
|
||||
public function start(mixed ...$args): mixed { }
|
||||
|
||||
/**
|
||||
* Resumes the fiber, returning the given value from {@see Fiber::suspend()}.
|
||||
* Returns when the fiber suspends or terminates.
|
||||
*
|
||||
* @param mixed $value
|
||||
*
|
||||
* @return mixed Value from the next suspension point or NULL if the fiber terminates.
|
||||
*
|
||||
* @throw FiberError If the fiber is running or terminated.
|
||||
* @throw Throwable If the fiber callable throws an uncaught exception.
|
||||
*/
|
||||
public function resume(mixed $value = null): mixed { }
|
||||
|
||||
/**
|
||||
* Throws the given exception into the fiber from {@see Fiber::suspend()}.
|
||||
* Returns when the fiber suspends or terminates.
|
||||
*
|
||||
* @param Throwable $exception
|
||||
*
|
||||
* @return mixed Value from the next suspension point or NULL if the fiber terminates.
|
||||
*
|
||||
* @throw FiberError If the fiber is running or terminated.
|
||||
* @throw Throwable If the fiber callable throws an uncaught exception.
|
||||
*/
|
||||
public function throw(Throwable $exception): mixed { }
|
||||
|
||||
/**
|
||||
* @return bool True if the fiber has been started.
|
||||
*/
|
||||
public function isStarted(): bool { }
|
||||
|
||||
/**
|
||||
* @return bool True if the fiber is suspended.
|
||||
*/
|
||||
public function isSuspended(): bool { }
|
||||
|
||||
/**
|
||||
* @return bool True if the fiber is currently running.
|
||||
*/
|
||||
public function isRunning(): bool { }
|
||||
|
||||
/**
|
||||
* @return bool True if the fiber has completed execution.
|
||||
*/
|
||||
public function isTerminated(): bool { }
|
||||
|
||||
/**
|
||||
* @return mixed Return value of the fiber callback.
|
||||
*
|
||||
* @throws FiberError If the fiber has not terminated or did not return a value.
|
||||
*/
|
||||
public function getReturn(): mixed { }
|
||||
|
||||
/**
|
||||
* @return self|null Returns the currently executing fiber instance or NULL if in {main}.
|
||||
*/
|
||||
public static function this(): ?self { }
|
||||
|
||||
/**
|
||||
* Suspend execution of the fiber. The fiber may be resumed with {@see Fiber::resume()} or {@see Fiber::throw()}.
|
||||
*
|
||||
* Cannot be called from {main}.
|
||||
*
|
||||
* @param mixed $value Value to return from {@see Fiber::resume()} or {@see Fiber::throw()}.
|
||||
*
|
||||
* @return mixed Value provided to {@see Fiber::resume()}.
|
||||
*
|
||||
* @throws Throwable Exception provided to {@see Fiber::throw()}.
|
||||
*/
|
||||
public static function suspend(mixed $value = null): mixed { }
|
||||
}
|
@ -1,15 +0,0 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Exception thrown due to invalid fiber actions, such as resuming a terminated fiber.
|
||||
*/
|
||||
final class FiberError extends Error
|
||||
{
|
||||
/**
|
||||
* Constructor throws to prevent user code from throwing FiberError.
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
throw new \Error('The "FiberError" class is reserved for internal use and cannot be manually instantiated');
|
||||
}
|
||||
}
|
@ -1,15 +0,0 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Exception thrown when destroying a fiber. This exception cannot be caught by user code.
|
||||
*/
|
||||
final class FiberExit extends Exception
|
||||
{
|
||||
/**
|
||||
* Constructor throws to prevent user code from throwing FiberExit.
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
throw new \Error('The "FiberExit" class is reserved for internal use and cannot be manually instantiated');
|
||||
}
|
||||
}
|
@ -1,49 +0,0 @@
|
||||
<?php
|
||||
|
||||
class ReflectionFiber
|
||||
{
|
||||
/**
|
||||
* @param Fiber $fiber Any Fiber object, including those that are not started or have
|
||||
* terminated.
|
||||
*/
|
||||
public function __construct(Fiber $fiber) { }
|
||||
|
||||
/**
|
||||
* @return string Current file of fiber execution.
|
||||
*/
|
||||
public function getExecutingFile(): string { }
|
||||
|
||||
/**
|
||||
* @return int Current line of fiber execution.
|
||||
*/
|
||||
public function getExecutingLine(): int { }
|
||||
|
||||
/**
|
||||
* @param int $options Same flags as {@see debug_backtrace()}.
|
||||
*
|
||||
* @return array Fiber backtrace, similar to {@see debug_backtrace()}
|
||||
* and {@see ReflectionGenerator::getTrace()}.
|
||||
*/
|
||||
public function getTrace(int $options = DEBUG_BACKTRACE_PROVIDE_OBJECT): array { }
|
||||
|
||||
/**
|
||||
* @return bool True if the fiber has been started.
|
||||
*/
|
||||
public function isStarted(): bool { }
|
||||
|
||||
/**
|
||||
* @return bool True if the fiber is currently suspended.
|
||||
*/
|
||||
public function isSuspended(): bool { }
|
||||
|
||||
/**
|
||||
* @return bool True if the fiber is currently running.
|
||||
*/
|
||||
public function isRunning(): bool { }
|
||||
|
||||
/**
|
||||
* @return bool True if the fiber has completed execution (either returning or
|
||||
* throwing an exception), false otherwise.
|
||||
*/
|
||||
public function isTerminated(): bool { }
|
||||
}
|
Loading…
Reference in New Issue
Block a user