PluginProbe
Yoast SEO – Advanced SEO with real-time guidance and built-in AI / trunk
Yoast SEO – Advanced SEO with real-time guidance and built-in AI vtrunk
28.5 28.4 28.3 28.2 28.1 28.0 27.9 27.8 27.7 27.6 27.5 trunk 18.0 18.1 18.2 18.3 18.4 18.4.1 18.5 18.5.1 18.6 18.7 18.8 18.9 19.0 All 129 releases
← All changes | vendor_prefixed/guzzlehttp/promises/src/Create.php +9 -13 18.9 → trunk View file →
@@ -1,6 +1,7 @@
1 1 <?php
2 2
3 +declare (strict_types=1);
3 4 namespace YoastSEO_Vendor\GuzzleHttp\Promise;
4 5
5 6 final class Create
6 7 {
@@ -7,12 +8,10 @@
7 8 /**
8 9 * Creates a promise for a value if the value is not a promise.
9 10 *
10 11 * @param mixed $value Promise or value.
11 - *
12 - * @return PromiseInterface
13 12 */
14 - public static function promiseFor($value)
13 + public static function promiseFor($value) : \YoastSEO_Vendor\GuzzleHttp\Promise\PromiseInterface
15 14 {
16 15 if ($value instanceof \YoastSEO_Vendor\GuzzleHttp\Promise\PromiseInterface) {
17 16 return $value;
18 17 }
@@ -30,12 +29,10 @@
30 29 * Creates a rejected promise for a reason if the reason is not a promise.
31 30 * If the provided reason is a promise, then it is returned as-is.
32 31 *
33 32 * @param mixed $reason Promise or reason.
34 - *
35 - * @return PromiseInterface
36 33 */
37 - public static function rejectionFor($reason)
34 + public static function rejectionFor($reason) : \YoastSEO_Vendor\GuzzleHttp\Promise\PromiseInterface
38 35 {
39 36 if ($reason instanceof \YoastSEO_Vendor\GuzzleHttp\Promise\PromiseInterface) {
40 37 return $reason;
41 38 }
@@ -44,14 +41,12 @@
44 41 /**
45 42 * Create an exception for a rejected promise value.
46 43 *
47 44 * @param mixed $reason
48 - *
49 - * @return \Exception|\Throwable
50 45 */
51 - public static function exceptionFor($reason)
46 + public static function exceptionFor($reason) : \Throwable
52 47 {
53 - if ($reason instanceof \Exception || $reason instanceof \Throwable) {
48 + if ($reason instanceof \Throwable) {
54 49 return $reason;
55 50 }
56 51 return new \YoastSEO_Vendor\GuzzleHttp\Promise\RejectionException($reason);
57 52 }
@@ -58,12 +53,10 @@
58 53 /**
59 54 * Returns an iterator for the given value.
60 55 *
61 56 * @param mixed $value
62 - *
63 - * @return \Iterator
64 57 */
65 - public static function iterFor($value)
58 + public static function iterFor($value) : \Iterator
66 59 {
67 60 if ($value instanceof \Iterator) {
68 61 return $value;
69 62 }
@@ -68,8 +61,11 @@
68 61 return $value;
69 62 }
70 63 if (\is_array($value)) {
71 64 return new \ArrayIterator($value);
65 + }
66 + if (!\is_iterable($value)) {
67 + \YoastSEO_Vendor\trigger_deprecation('guzzlehttp/promises', '2.5', 'Passing a non-iterable to %s::%s() is deprecated; guzzlehttp/promises 3.0 will require an iterable.', __CLASS__, __FUNCTION__);
72 68 }
73 69 return new \ArrayIterator([$value]);
74 70 }
75 71 }