phasync
phasync / getFiber

Method

phasync::getFiber

Returns the running coroutine.

Description#

public static phasync::getFiber(): Fiber

Return values#

Fiber

Errors / Exceptions#

ExceptionWhen
LogicExceptionOutside a coroutine

Examples#

Example 1
phasync::run(function () {
    $fiber = phasync::getFiber();
    var_dump($fiber->isRunning());   // true
});

See also#

  • phasync::goStarts $fn as a coroutine in the current frame and scope, and returns it, without waiting for it.