ReflectionFiber_backtrace.phpt 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  1. --TEST--
  2. ReflectionFiber backtrace test
  3. --FILE--
  4. <?php
  5. function suspend_fiber(): void {
  6. Fiber::suspend();
  7. }
  8. class Test
  9. {
  10. public function __invoke(string $arg): void
  11. {
  12. suspend_fiber();
  13. }
  14. }
  15. $fiber = new Fiber(new Test);
  16. $fiber->start('test');
  17. $reflection = new ReflectionFiber($fiber);
  18. var_dump($reflection->getTrace(DEBUG_BACKTRACE_PROVIDE_OBJECT));
  19. ?>
  20. --EXPECTF--
  21. array(3) {
  22. [0]=>
  23. array(6) {
  24. ["file"]=>
  25. string(%d) "%sReflectionFiber_backtrace.php"
  26. ["line"]=>
  27. int(4)
  28. ["function"]=>
  29. string(7) "suspend"
  30. ["class"]=>
  31. string(5) "Fiber"
  32. ["type"]=>
  33. string(2) "::"
  34. ["args"]=>
  35. array(0) {
  36. }
  37. }
  38. [1]=>
  39. array(4) {
  40. ["file"]=>
  41. string(%d) "%sReflectionFiber_backtrace.php"
  42. ["line"]=>
  43. int(11)
  44. ["function"]=>
  45. string(13) "suspend_fiber"
  46. ["args"]=>
  47. array(0) {
  48. }
  49. }
  50. [2]=>
  51. array(5) {
  52. ["function"]=>
  53. string(8) "__invoke"
  54. ["class"]=>
  55. string(4) "Test"
  56. ["object"]=>
  57. object(Test)#2 (0) {
  58. }
  59. ["type"]=>
  60. string(2) "->"
  61. ["args"]=>
  62. array(1) {
  63. [0]=>
  64. string(4) "test"
  65. }
  66. }
  67. }