FunctionRejectTestCatchMismatchShouldReportUnhandled.phpt 562 B

123456789101112131415161718192021
  1. --TEST--
  2. Calling reject() and then catch() with mismatched type should report unhandled rejection
  3. --INI--
  4. # suppress legacy PHPUnit 7 warning for Xdebug 3
  5. xdebug.default_enable=
  6. --FILE--
  7. <?php
  8. use function React\Promise\reject;
  9. require __DIR__ . '/../vendor/autoload.php';
  10. reject(new RuntimeException('foo'))->catch(function (UnexpectedValueException $unexpected): void {
  11. echo 'This will never be shown because the types do not match' . PHP_EOL;
  12. });
  13. ?>
  14. --EXPECTF--
  15. Unhandled promise rejection with RuntimeException: foo in %s:%d
  16. Stack trace:
  17. #0 %A{main}