mirror of
https://github.com/itflow-org/itflow
synced 2026-09-23 15:11:16 +00:00
Update imapengine dependancies too
This commit is contained in:
52
libs/vendor/guzzlehttp/psr7/src/Response.php
vendored
52
libs/vendor/guzzlehttp/psr7/src/Response.php
vendored
@@ -78,11 +78,9 @@ class Response implements ResponseInterface
|
||||
511 => 'Network Authentication Required',
|
||||
];
|
||||
|
||||
/** @var string */
|
||||
private $reasonPhrase;
|
||||
private string $reasonPhrase;
|
||||
|
||||
/** @var int */
|
||||
private $statusCode;
|
||||
private int $statusCode;
|
||||
|
||||
/**
|
||||
* @param int $status Status code
|
||||
@@ -114,7 +112,7 @@ class Response implements ResponseInterface
|
||||
$reasonPhrase = (string) $reason;
|
||||
}
|
||||
|
||||
$this->assertNoLineSeparators($reasonPhrase, 'Reason phrase');
|
||||
$this->assertReasonPhrase($reasonPhrase);
|
||||
$this->reasonPhrase = $reasonPhrase;
|
||||
|
||||
$this->protocol = $version;
|
||||
@@ -130,56 +128,32 @@ class Response implements ResponseInterface
|
||||
return $this->reasonPhrase;
|
||||
}
|
||||
|
||||
public function withStatus($code, $reasonPhrase = ''): ResponseInterface
|
||||
public function withStatus(int $code, string $reasonPhrase = ''): ResponseInterface
|
||||
{
|
||||
if (!\is_int($code) && \filter_var($code, \FILTER_VALIDATE_INT) !== false) {
|
||||
\trigger_deprecation(
|
||||
'guzzlehttp/psr7',
|
||||
'2.11',
|
||||
'Passing %s to ResponseInterface::withStatus() is deprecated; guzzlehttp/psr7 3.0 requires int for $code.',
|
||||
\get_debug_type($code)
|
||||
);
|
||||
}
|
||||
|
||||
if (!\is_string($reasonPhrase)) {
|
||||
\trigger_deprecation(
|
||||
'guzzlehttp/psr7',
|
||||
'2.11',
|
||||
'Passing %s to ResponseInterface::withStatus() is deprecated; guzzlehttp/psr7 3.0 requires string for $reasonPhrase.',
|
||||
\get_debug_type($reasonPhrase)
|
||||
);
|
||||
}
|
||||
|
||||
$this->assertStatusCodeIsInteger($code);
|
||||
$code = (int) $code;
|
||||
$this->assertStatusCodeRange($code);
|
||||
|
||||
$new = clone $this;
|
||||
$new->statusCode = $code;
|
||||
if ($reasonPhrase == '' && isset(self::PHRASES[$new->statusCode])) {
|
||||
if ($reasonPhrase === '' && isset(self::PHRASES[$new->statusCode])) {
|
||||
$reasonPhrase = self::PHRASES[$new->statusCode];
|
||||
}
|
||||
$reasonPhrase = (string) $reasonPhrase;
|
||||
$this->assertNoLineSeparators($reasonPhrase, 'Reason phrase');
|
||||
$this->assertReasonPhrase($reasonPhrase);
|
||||
$new->reasonPhrase = $reasonPhrase;
|
||||
|
||||
return $new;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param mixed $statusCode
|
||||
*/
|
||||
private function assertStatusCodeIsInteger($statusCode): void
|
||||
{
|
||||
if (filter_var($statusCode, FILTER_VALIDATE_INT) === false) {
|
||||
throw new \InvalidArgumentException('Status code must be an integer value.');
|
||||
}
|
||||
}
|
||||
|
||||
private function assertStatusCodeRange(int $statusCode): void
|
||||
{
|
||||
if ($statusCode < 100 || $statusCode >= 600) {
|
||||
throw new \InvalidArgumentException('Status code must be an integer value between 1xx and 5xx.');
|
||||
}
|
||||
}
|
||||
|
||||
private function assertReasonPhrase(string $reasonPhrase): void
|
||||
{
|
||||
if (!Rfc9112::isValidReasonPhrase($reasonPhrase)) {
|
||||
throw new \InvalidArgumentException('Reason phrase must not contain invalid control characters.');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user