京东云

This commit is contained in:
“wanyongkang”
2024-05-28 17:04:50 +08:00
parent f644932afb
commit f3c7432100
672 changed files with 209344 additions and 6593 deletions

View File

@@ -1,7 +1,5 @@
<?php
declare(strict_types=1);
namespace GuzzleHttp\Promise;
/**
@@ -15,23 +13,24 @@ class RejectionException extends \RuntimeException
private $reason;
/**
* @param mixed $reason Rejection reason.
* @param string|null $description Optional description.
* @param mixed $reason Rejection reason.
* @param string $description Optional description
*/
public function __construct($reason, ?string $description = null)
public function __construct($reason, $description = null)
{
$this->reason = $reason;
$message = 'The promise was rejected';
if ($description) {
$message .= ' with reason: '.$description;
$message .= ' with reason: ' . $description;
} elseif (is_string($reason)
|| (is_object($reason) && method_exists($reason, '__toString'))
) {
$message .= ' with reason: '.$this->reason;
$message .= ' with reason: ' . $this->reason;
} elseif ($reason instanceof \JsonSerializable) {
$message .= ' with reason: '.json_encode($this->reason, JSON_PRETTY_PRINT);
$message .= ' with reason: '
. json_encode($this->reason, JSON_PRETTY_PRINT);
}
parent::__construct($message);