← All changes
|
includes/sdk/google/guzzlehttp/promises/src/Create.php
+9
-9
1.1.1
→
1.4.2
View file →
| @@ -1,8 +1,8 @@ | ||
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | 3 | declare (strict_types=1); |
| 4 | -namespace Dudlewebs\WPMCS\GuzzleHttp\Promise; | |
| 4 | +namespace Dudlewebs\WPMCS\GCP\GuzzleHttp\Promise; | |
| 5 | 5 | |
| 6 | 6 | final class Create |
| 7 | 7 | { |
| 8 | 8 | /** |
| @@ -9,17 +9,17 @@ | ||
| 9 | 9 | * Creates a promise for a value if the value is not a promise. |
| 10 | 10 | * |
| 11 | 11 | * @param mixed $value Promise or value. |
| 12 | 12 | */ |
| 13 | - public static function promiseFor($value): PromiseInterface | |
| 13 | + public static function promiseFor($value) : PromiseInterface | |
| 14 | 14 | { |
| 15 | 15 | if ($value instanceof PromiseInterface) { |
| 16 | 16 | return $value; |
| 17 | 17 | } |
| 18 | 18 | // Return a Guzzle promise that shadows the given promise. |
| 19 | - if (is_object($value) && method_exists($value, 'then')) { | |
| 20 | - $wfn = method_exists($value, 'wait') ? [$value, 'wait'] : null; | |
| 21 | - $cfn = method_exists($value, 'cancel') ? [$value, 'cancel'] : null; | |
| 19 | + if (\is_object($value) && \method_exists($value, 'then')) { | |
| 20 | + $wfn = \method_exists($value, 'wait') ? [$value, 'wait'] : null; | |
| 21 | + $cfn = \method_exists($value, 'cancel') ? [$value, 'cancel'] : null; | |
| 22 | 22 | $promise = new Promise($wfn, $cfn); |
| 23 | 23 | $value->then([$promise, 'resolve'], [$promise, 'reject']); |
| 24 | 24 | return $promise; |
| 25 | 25 | } |
| @@ -30,9 +30,9 @@ | ||
| 30 | 30 | * If the provided reason is a promise, then it is returned as-is. |
| 31 | 31 | * |
| 32 | 32 | * @param mixed $reason Promise or reason. |
| 33 | 33 | */ |
| 34 | - public static function rejectionFor($reason): PromiseInterface | |
| 34 | + public static function rejectionFor($reason) : PromiseInterface | |
| 35 | 35 | { |
| 36 | 36 | if ($reason instanceof PromiseInterface) { |
| 37 | 37 | return $reason; |
| 38 | 38 | } |
| @@ -42,9 +42,9 @@ | ||
| 42 | 42 | * Create an exception for a rejected promise value. |
| 43 | 43 | * |
| 44 | 44 | * @param mixed $reason |
| 45 | 45 | */ |
| 46 | - public static function exceptionFor($reason): \Throwable | |
| 46 | + public static function exceptionFor($reason) : \Throwable | |
| 47 | 47 | { |
| 48 | 48 | if ($reason instanceof \Throwable) { |
| 49 | 49 | return $reason; |
| 50 | 50 | } |
| @@ -54,14 +54,14 @@ | ||
| 54 | 54 | * Returns an iterator for the given value. |
| 55 | 55 | * |
| 56 | 56 | * @param mixed $value |
| 57 | 57 | */ |
| 58 | - public static function iterFor($value): \Iterator | |
| 58 | + public static function iterFor($value) : \Iterator | |
| 59 | 59 | { |
| 60 | 60 | if ($value instanceof \Iterator) { |
| 61 | 61 | return $value; |
| 62 | 62 | } |
| 63 | - if (is_array($value)) { | |
| 63 | + if (\is_array($value)) { | |
| 64 | 64 | return new \ArrayIterator($value); |
| 65 | 65 | } |
| 66 | 66 | return new \ArrayIterator([$value]); |
| 67 | 67 | } |