summaryrefslogtreecommitdiff
path: root/vendor/guzzlehttp/promises/src
diff options
context:
space:
mode:
Diffstat (limited to 'vendor/guzzlehttp/promises/src')
-rw-r--r--vendor/guzzlehttp/promises/src/Coroutine.php4
-rw-r--r--vendor/guzzlehttp/promises/src/Each.php17
-rw-r--r--vendor/guzzlehttp/promises/src/EachPromise.php8
-rw-r--r--vendor/guzzlehttp/promises/src/FulfilledPromise.php4
-rw-r--r--vendor/guzzlehttp/promises/src/Promise.php8
-rw-r--r--vendor/guzzlehttp/promises/src/PromiseInterface.php4
-rw-r--r--vendor/guzzlehttp/promises/src/RejectedPromise.php4
-rw-r--r--vendor/guzzlehttp/promises/src/Utils.php2
8 files changed, 22 insertions, 29 deletions
diff --git a/vendor/guzzlehttp/promises/src/Coroutine.php b/vendor/guzzlehttp/promises/src/Coroutine.php
index 0b5b9c0a4..0da022834 100644
--- a/vendor/guzzlehttp/promises/src/Coroutine.php
+++ b/vendor/guzzlehttp/promises/src/Coroutine.php
@@ -84,8 +84,8 @@ final class Coroutine implements PromiseInterface
}
public function then(
- callable $onFulfilled = null,
- callable $onRejected = null
+ ?callable $onFulfilled = null,
+ ?callable $onRejected = null
): PromiseInterface {
return $this->result->then($onFulfilled, $onRejected);
}
diff --git a/vendor/guzzlehttp/promises/src/Each.php b/vendor/guzzlehttp/promises/src/Each.php
index 1a7aa0fb6..dd72c8310 100644
--- a/vendor/guzzlehttp/promises/src/Each.php
+++ b/vendor/guzzlehttp/promises/src/Each.php
@@ -19,14 +19,12 @@ final class Each
* index, and the aggregate promise. The callback can invoke any necessary
* side effects and choose to resolve or reject the aggregate if needed.
*
- * @param mixed $iterable Iterator or array to iterate over.
- * @param callable $onFulfilled
- * @param callable $onRejected
+ * @param mixed $iterable Iterator or array to iterate over.
*/
public static function of(
$iterable,
- callable $onFulfilled = null,
- callable $onRejected = null
+ ?callable $onFulfilled = null,
+ ?callable $onRejected = null
): PromiseInterface {
return (new EachPromise($iterable, [
'fulfilled' => $onFulfilled,
@@ -44,14 +42,12 @@ final class Each
*
* @param mixed $iterable
* @param int|callable $concurrency
- * @param callable $onFulfilled
- * @param callable $onRejected
*/
public static function ofLimit(
$iterable,
$concurrency,
- callable $onFulfilled = null,
- callable $onRejected = null
+ ?callable $onFulfilled = null,
+ ?callable $onRejected = null
): PromiseInterface {
return (new EachPromise($iterable, [
'fulfilled' => $onFulfilled,
@@ -67,12 +63,11 @@ final class Each
*
* @param mixed $iterable
* @param int|callable $concurrency
- * @param callable $onFulfilled
*/
public static function ofLimitAll(
$iterable,
$concurrency,
- callable $onFulfilled = null
+ ?callable $onFulfilled = null
): PromiseInterface {
return self::ofLimit(
$iterable,
diff --git a/vendor/guzzlehttp/promises/src/EachPromise.php b/vendor/guzzlehttp/promises/src/EachPromise.php
index 28dd9793a..e12389818 100644
--- a/vendor/guzzlehttp/promises/src/EachPromise.php
+++ b/vendor/guzzlehttp/promises/src/EachPromise.php
@@ -135,7 +135,7 @@ class EachPromise implements PromisorInterface
// Add only up to N pending promises.
$concurrency = is_callable($this->concurrency)
- ? call_user_func($this->concurrency, count($this->pending))
+ ? ($this->concurrency)(count($this->pending))
: $this->concurrency;
$concurrency = max($concurrency - count($this->pending), 0);
// Concurrency may be set to 0 to disallow new promises.
@@ -170,8 +170,7 @@ class EachPromise implements PromisorInterface
$this->pending[$idx] = $promise->then(
function ($value) use ($idx, $key): void {
if ($this->onFulfilled) {
- call_user_func(
- $this->onFulfilled,
+ ($this->onFulfilled)(
$value,
$key,
$this->aggregate
@@ -181,8 +180,7 @@ class EachPromise implements PromisorInterface
},
function ($reason) use ($idx, $key): void {
if ($this->onRejected) {
- call_user_func(
- $this->onRejected,
+ ($this->onRejected)(
$reason,
$key,
$this->aggregate
diff --git a/vendor/guzzlehttp/promises/src/FulfilledPromise.php b/vendor/guzzlehttp/promises/src/FulfilledPromise.php
index ab7129659..727ec315c 100644
--- a/vendor/guzzlehttp/promises/src/FulfilledPromise.php
+++ b/vendor/guzzlehttp/promises/src/FulfilledPromise.php
@@ -31,8 +31,8 @@ class FulfilledPromise implements PromiseInterface
}
public function then(
- callable $onFulfilled = null,
- callable $onRejected = null
+ ?callable $onFulfilled = null,
+ ?callable $onRejected = null
): PromiseInterface {
// Return itself if there is no onFulfilled function.
if (!$onFulfilled) {
diff --git a/vendor/guzzlehttp/promises/src/Promise.php b/vendor/guzzlehttp/promises/src/Promise.php
index 1b07bdc9a..c0c5be2c0 100644
--- a/vendor/guzzlehttp/promises/src/Promise.php
+++ b/vendor/guzzlehttp/promises/src/Promise.php
@@ -25,16 +25,16 @@ class Promise implements PromiseInterface
* @param callable $cancelFn Fn that when invoked cancels the promise.
*/
public function __construct(
- callable $waitFn = null,
- callable $cancelFn = null
+ ?callable $waitFn = null,
+ ?callable $cancelFn = null
) {
$this->waitFn = $waitFn;
$this->cancelFn = $cancelFn;
}
public function then(
- callable $onFulfilled = null,
- callable $onRejected = null
+ ?callable $onFulfilled = null,
+ ?callable $onRejected = null
): PromiseInterface {
if ($this->state === self::PENDING) {
$p = new Promise(null, [$this, 'cancel']);
diff --git a/vendor/guzzlehttp/promises/src/PromiseInterface.php b/vendor/guzzlehttp/promises/src/PromiseInterface.php
index 2824802bb..c11721e4d 100644
--- a/vendor/guzzlehttp/promises/src/PromiseInterface.php
+++ b/vendor/guzzlehttp/promises/src/PromiseInterface.php
@@ -27,8 +27,8 @@ interface PromiseInterface
* @param callable $onRejected Invoked when the promise is rejected.
*/
public function then(
- callable $onFulfilled = null,
- callable $onRejected = null
+ ?callable $onFulfilled = null,
+ ?callable $onRejected = null
): PromiseInterface;
/**
diff --git a/vendor/guzzlehttp/promises/src/RejectedPromise.php b/vendor/guzzlehttp/promises/src/RejectedPromise.php
index d947da1f5..1ebf0b2a6 100644
--- a/vendor/guzzlehttp/promises/src/RejectedPromise.php
+++ b/vendor/guzzlehttp/promises/src/RejectedPromise.php
@@ -31,8 +31,8 @@ class RejectedPromise implements PromiseInterface
}
public function then(
- callable $onFulfilled = null,
- callable $onRejected = null
+ ?callable $onFulfilled = null,
+ ?callable $onRejected = null
): PromiseInterface {
// If there's no onRejected callback then just return self.
if (!$onRejected) {
diff --git a/vendor/guzzlehttp/promises/src/Utils.php b/vendor/guzzlehttp/promises/src/Utils.php
index e1570d727..45b0893fc 100644
--- a/vendor/guzzlehttp/promises/src/Utils.php
+++ b/vendor/guzzlehttp/promises/src/Utils.php
@@ -21,7 +21,7 @@ final class Utils
*
* @param TaskQueueInterface|null $assign Optionally specify a new queue instance.
*/
- public static function queue(TaskQueueInterface $assign = null): TaskQueueInterface
+ public static function queue(?TaskQueueInterface $assign = null): TaskQueueInterface
{
static $queue;