1--TEST--
2ReflectionFiber errors
3--FILE--
4<?php
5
6$fiber = new Fiber(function (): void {
7    Fiber::suspend();
8});
9
10$reflection = new ReflectionFiber($fiber);
11
12try {
13    $reflection->getTrace();
14} catch (Error $error) {
15    echo $error->getMessage(), "\n";
16}
17
18try {
19    $reflection->getExecutingFile();
20} catch (Error $error) {
21    echo $error->getMessage(), "\n";
22}
23
24try {
25    $reflection->getExecutingLine();
26} catch (Error $error) {
27    echo $error->getMessage(), "\n";
28}
29
30$fiber->start();
31
32var_dump($reflection->getExecutingFile());
33var_dump($reflection->getExecutingLine());
34
35$fiber->resume();
36
37try {
38    $reflection->getTrace();
39} catch (Error $error) {
40    echo $error->getMessage(), "\n";
41}
42
43try {
44    $reflection->getExecutingFile();
45} catch (Error $error) {
46    echo $error->getMessage(), "\n";
47}
48
49try {
50    $reflection->getExecutingLine();
51} catch (Error $error) {
52    echo $error->getMessage(), "\n";
53}
54
55try {
56    $reflection->getCallable();
57} catch (Error $error) {
58    echo $error->getMessage(), "\n";
59}
60
61?>
62--EXPECTF--
63Cannot fetch information from a fiber that has not been started or is terminated
64Cannot fetch information from a fiber that has not been started or is terminated
65Cannot fetch information from a fiber that has not been started or is terminated
66string(%d) "%s%eReflectionFiber_errors.php"
67int(4)
68Cannot fetch information from a fiber that has not been started or is terminated
69Cannot fetch information from a fiber that has not been started or is terminated
70Cannot fetch information from a fiber that has not been started or is terminated
71Cannot fetch the callable from a fiber that has terminated
72