PluginProbe
Media Cloud Sync / 1.4.2
Media Cloud Sync v1.4.2
1.4.2 1.4.1 1.4.0 1.3.12 1.3.11 1.3.10 trunk 1.0.0 1.0.1 1.0.2 1.0.3 1.1.0 1.1.1 1.2.0 1.2.10 1.2.11 1.2.12 1.2.13 1.2.2 1.2.3 1.2.4 1.2.5 1.2.6 1.2.7 1.2.8 All 36 releases
← All changes | includes/sdk/s3/GuzzleHttp/Promise/Each.php +6 -16 1.2.3 → 1.4.2 View file →
@@ -1,6 +1,7 @@
1 1 <?php
2 2
3 +declare (strict_types=1);
3 4 namespace Dudlewebs\WPMCS\s3\GuzzleHttp\Promise;
4 5
5 6 final class Each
6 7 {
@@ -16,15 +17,11 @@
16 17 * $onRejected is a function that accepts the rejection reason, iterator
17 18 * index, and the aggregate promise. The callback can invoke any necessary
18 19 * side effects and choose to resolve or reject the aggregate if needed.
19 20 *
20 - * @param mixed $iterable Iterator or array to iterate over.
21 - * @param callable $onFulfilled
22 - * @param callable $onRejected
23 - *
24 - * @return PromiseInterface
21 + * @param mixed $iterable Iterator or array to iterate over.
25 22 */
26 - public static function of($iterable, callable $onFulfilled = null, callable $onRejected = null)
23 + public static function of($iterable, ?callable $onFulfilled = null, ?callable $onRejected = null) : PromiseInterface
27 24 {
28 25 return (new EachPromise($iterable, ['fulfilled' => $onFulfilled, 'rejected' => $onRejected]))->promise();
29 26 }
30 27 /**
@@ -36,14 +33,10 @@
36 33 * for dynamic a concurrency size.
37 34 *
38 35 * @param mixed $iterable
39 36 * @param int|callable $concurrency
40 - * @param callable $onFulfilled
41 - * @param callable $onRejected
42 - *
43 - * @return PromiseInterface
44 37 */
45 - public static function ofLimit($iterable, $concurrency, callable $onFulfilled = null, callable $onRejected = null)
38 + public static function ofLimit($iterable, $concurrency, ?callable $onFulfilled = null, ?callable $onRejected = null) : PromiseInterface
46 39 {
47 40 return (new EachPromise($iterable, ['fulfilled' => $onFulfilled, 'rejected' => $onRejected, 'concurrency' => $concurrency]))->promise();
48 41 }
49 42 /**
@@ -52,15 +45,12 @@
52 45 * rejected with the encountered rejection.
53 46 *
54 47 * @param mixed $iterable
55 48 * @param int|callable $concurrency
56 - * @param callable $onFulfilled
57 - *
58 - * @return PromiseInterface
59 49 */
60 - public static function ofLimitAll($iterable, $concurrency, callable $onFulfilled = null)
50 + public static function ofLimitAll($iterable, $concurrency, ?callable $onFulfilled = null) : PromiseInterface
61 51 {
62 - return each_limit($iterable, $concurrency, $onFulfilled, function ($reason, $idx, PromiseInterface $aggregate) {
52 + return self::ofLimit($iterable, $concurrency, $onFulfilled, function ($reason, $idx, PromiseInterface $aggregate) : void {
63 53 $aggregate->reject($reason);
64 54 });
65 55 }
66 56 }