| @@ -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 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) : PromiseInterface | |
| 15 | 14 | { |
| 16 | 15 | if ($value instanceof 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) : PromiseInterface | |
| 38 | 35 | { |
| 39 | 36 | if ($reason instanceof 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 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 | } |