1--TEST-- 2Fiber status methods 3--FILE-- 4<?php 5 6$fiber = new Fiber(function (): void { 7 $fiber = Fiber::getCurrent(); 8 echo "\nWithin Fiber:\n"; 9 var_dump($fiber->isStarted()); 10 var_dump($fiber->isRunning()); 11 var_dump($fiber->isSuspended()); 12 var_dump($fiber->isTerminated()); 13 14 $nested = new Fiber(function () use ($fiber): void { 15 echo "\nWithin Nested Fiber:\n"; 16 var_dump($fiber->isStarted()); 17 var_dump($fiber->isRunning()); 18 var_dump($fiber->isSuspended()); 19 var_dump($fiber->isTerminated()); 20 Fiber::suspend(); 21 }); 22 23 $nested->start(); 24 25 Fiber::suspend(); 26}); 27 28echo "\nBefore Start:\n"; 29var_dump($fiber->isStarted()); 30var_dump($fiber->isRunning()); 31var_dump($fiber->isSuspended()); 32var_dump($fiber->isTerminated()); 33 34$fiber->start(); 35 36echo "\nAfter Start:\n"; 37var_dump($fiber->isStarted()); 38var_dump($fiber->isRunning()); 39var_dump($fiber->isSuspended()); 40var_dump($fiber->isTerminated()); 41 42$fiber->resume(); 43 44echo "\nAfter Resume:\n"; 45var_dump($fiber->isStarted()); 46var_dump($fiber->isRunning()); 47var_dump($fiber->isSuspended()); 48var_dump($fiber->isTerminated()); 49 50?> 51--EXPECT-- 52Before Start: 53bool(false) 54bool(false) 55bool(false) 56bool(false) 57 58Within Fiber: 59bool(true) 60bool(true) 61bool(false) 62bool(false) 63 64Within Nested Fiber: 65bool(true) 66bool(true) 67bool(false) 68bool(false) 69 70After Start: 71bool(true) 72bool(false) 73bool(true) 74bool(false) 75 76After Resume: 77bool(true) 78bool(false) 79bool(false) 80bool(true) 81