vendor/guzzlehttp/promises/src/Is.php
87 lines · 2427 bytes
1<?php
2
3declare(strict_types=1);
4
5namespace GuzzleHttp\Promise;
6
7/**
8 * @deprecated Is will be removed in guzzlehttp/promises:4.0. Use State instead.
9 */
10final class Is
11{
12 /**
13 * Returns true if a promise is pending.
14 *
15 * @deprecated Is::pending() will be removed in guzzlehttp/promises:4.0. Use
16 * State::isPending() instead.
17 */
18 public static function pending(PromiseInterface $promise): bool
19 {
20 \trigger_deprecation(
21 'guzzlehttp/promises',
22 '2.6',
23 '%s() is deprecated and will be removed in 4.0. Use %s::isPending() instead.',
24 __METHOD__,
25 State::class
26 );
27
28 return State::isPending($promise);
29 }
30
31 /**
32 * Returns true if a promise is fulfilled or rejected.
33 *
34 * @deprecated Is::settled() will be removed in guzzlehttp/promises:4.0. Use
35 * State::isSettled() instead.
36 */
37 public static function settled(PromiseInterface $promise): bool
38 {
39 \trigger_deprecation(
40 'guzzlehttp/promises',
41 '2.6',
42 '%s() is deprecated and will be removed in 4.0. Use %s::isSettled() instead.',
43 __METHOD__,
44 State::class
45 );
46
47 return State::isSettled($promise);
48 }
49
50 /**
51 * Returns true if a promise is fulfilled.
52 *
53 * @deprecated Is::fulfilled() will be removed in guzzlehttp/promises:4.0.
54 * Use State::isFulfilled() instead.
55 */
56 public static function fulfilled(PromiseInterface $promise): bool
57 {
58 \trigger_deprecation(
59 'guzzlehttp/promises',
60 '2.6',
61 '%s() is deprecated and will be removed in 4.0. Use %s::isFulfilled() instead.',
62 __METHOD__,
63 State::class
64 );
65
66 return State::isFulfilled($promise);
67 }
68
69 /**
70 * Returns true if a promise is rejected.
71 *
72 * @deprecated Is::rejected() will be removed in guzzlehttp/promises:4.0.
73 * Use State::isRejected() instead.
74 */
75 public static function rejected(PromiseInterface $promise): bool
76 {
77 \trigger_deprecation(
78 'guzzlehttp/promises',
79 '2.6',
80 '%s() is deprecated and will be removed in 4.0. Use %s::isRejected() instead.',
81 __METHOD__,
82 State::class
83 );
84
85 return State::isRejected($promise);
86 }
87}