summaryrefslogtreecommitdiff
path: root/vendor/guzzlehttp/promises/src/Create.php
diff options
context:
space:
mode:
Diffstat (limited to 'vendor/guzzlehttp/promises/src/Create.php')
-rw-r--r--vendor/guzzlehttp/promises/src/Create.php21
1 files changed, 8 insertions, 13 deletions
diff --git a/vendor/guzzlehttp/promises/src/Create.php b/vendor/guzzlehttp/promises/src/Create.php
index 8d038e9..9d3fc4a 100644
--- a/vendor/guzzlehttp/promises/src/Create.php
+++ b/vendor/guzzlehttp/promises/src/Create.php
@@ -1,5 +1,7 @@
<?php
+declare(strict_types=1);
+
namespace GuzzleHttp\Promise;
final class Create
@@ -8,10 +10,8 @@ final class Create
* Creates a promise for a value if the value is not a promise.
*
* @param mixed $value Promise or value.
- *
- * @return PromiseInterface
*/
- public static function promiseFor($value)
+ public static function promiseFor($value): PromiseInterface
{
if ($value instanceof PromiseInterface) {
return $value;
@@ -23,6 +23,7 @@ final class Create
$cfn = method_exists($value, 'cancel') ? [$value, 'cancel'] : null;
$promise = new Promise($wfn, $cfn);
$value->then([$promise, 'resolve'], [$promise, 'reject']);
+
return $promise;
}
@@ -34,10 +35,8 @@ final class Create
* If the provided reason is a promise, then it is returned as-is.
*
* @param mixed $reason Promise or reason.
- *
- * @return PromiseInterface
*/
- public static function rejectionFor($reason)
+ public static function rejectionFor($reason): PromiseInterface
{
if ($reason instanceof PromiseInterface) {
return $reason;
@@ -50,12 +49,10 @@ final class Create
* Create an exception for a rejected promise value.
*
* @param mixed $reason
- *
- * @return \Exception|\Throwable
*/
- public static function exceptionFor($reason)
+ public static function exceptionFor($reason): \Throwable
{
- if ($reason instanceof \Exception || $reason instanceof \Throwable) {
+ if ($reason instanceof \Throwable) {
return $reason;
}
@@ -66,10 +63,8 @@ final class Create
* Returns an iterator for the given value.
*
* @param mixed $value
- *
- * @return \Iterator
*/
- public static function iterFor($value)
+ public static function iterFor($value): \Iterator
{
if ($value instanceof \Iterator) {
return $value;