Thennable.php 475 B

123456789101112131415161718192021222324252627
  1. <?php
  2. declare(strict_types=1);
  3. namespace GuzzleHttp\Promise\Tests;
  4. use GuzzleHttp\Promise\Promise;
  5. class Thennable
  6. {
  7. private $nextPromise;
  8. public function __construct()
  9. {
  10. $this->nextPromise = new Promise();
  11. }
  12. public function then(callable $res = null, callable $rej = null)
  13. {
  14. return $this->nextPromise->then($res, $rej);
  15. }
  16. public function resolve($value): void
  17. {
  18. $this->nextPromise->resolve($value);
  19. }
  20. }