Update composer.json for PHP 7.2

This commit is contained in:
Kijin Sung 2022-12-26 00:19:37 +09:00
parent 35a93f3928
commit e79493bda5
549 changed files with 21493 additions and 24634 deletions

View file

@ -1,5 +1,7 @@
<?php
declare(strict_types=1);
namespace GuzzleHttp\Psr7;
use InvalidArgumentException;
@ -57,17 +59,17 @@ class ServerRequest extends Request implements ServerRequestInterface
/**
* @param string $method HTTP method
* @param string|UriInterface $uri URI
* @param array $headers Request headers
* @param array<string, string|string[]> $headers Request headers
* @param string|resource|StreamInterface|null $body Request body
* @param string $version Protocol version
* @param array $serverParams Typically the $_SERVER superglobal
*/
public function __construct(
$method,
string $method,
$uri,
array $headers = [],
$body = null,
$version = '1.1',
string $version = '1.1',
array $serverParams = []
) {
$this->serverParams = $serverParams;
@ -78,13 +80,11 @@ class ServerRequest extends Request implements ServerRequestInterface
/**
* Return an UploadedFile instance array.
*
* @param array $files A array which respect $_FILES structure
*
* @return array
* @param array $files An array which respect $_FILES structure
*
* @throws InvalidArgumentException for unrecognized values
*/
public static function normalizeFiles(array $files)
public static function normalizeFiles(array $files): array
{
$normalized = [];
@ -112,7 +112,7 @@ class ServerRequest extends Request implements ServerRequestInterface
*
* @param array $value $_FILES struct
*
* @return array|UploadedFileInterface
* @return UploadedFileInterface|UploadedFileInterface[]
*/
private static function createUploadedFileFromSpec(array $value)
{
@ -135,11 +135,9 @@ class ServerRequest extends Request implements ServerRequestInterface
* Loops through all nested files and returns a normalized array of
* UploadedFileInterface instances.
*
* @param array $files
*
* @return UploadedFileInterface[]
*/
private static function normalizeNestedFileSpec(array $files = [])
private static function normalizeNestedFileSpec(array $files = []): array
{
$normalizedFiles = [];
@ -164,12 +162,10 @@ class ServerRequest extends Request implements ServerRequestInterface
* $_COOKIE
* $_FILES
* $_SERVER
*
* @return ServerRequestInterface
*/
public static function fromGlobals()
public static function fromGlobals(): ServerRequestInterface
{
$method = isset($_SERVER['REQUEST_METHOD']) ? $_SERVER['REQUEST_METHOD'] : 'GET';
$method = $_SERVER['REQUEST_METHOD'] ?? 'GET';
$headers = getallheaders();
$uri = self::getUriFromGlobals();
$body = new CachingStream(new LazyOpenStream('php://input', 'r+'));
@ -184,7 +180,7 @@ class ServerRequest extends Request implements ServerRequestInterface
->withUploadedFiles(self::normalizeFiles($_FILES));
}
private static function extractHostAndPortFromAuthority($authority)
private static function extractHostAndPortFromAuthority(string $authority): array
{
$uri = 'http://' . $authority;
$parts = parse_url($uri);
@ -192,18 +188,16 @@ class ServerRequest extends Request implements ServerRequestInterface
return [null, null];
}
$host = isset($parts['host']) ? $parts['host'] : null;
$port = isset($parts['port']) ? $parts['port'] : null;
$host = $parts['host'] ?? null;
$port = $parts['port'] ?? null;
return [$host, $port];
}
/**
* Get a Uri populated with values from $_SERVER.
*
* @return UriInterface
*/
public static function getUriFromGlobals()
public static function getUriFromGlobals(): UriInterface
{
$uri = new Uri('');
@ -211,7 +205,7 @@ class ServerRequest extends Request implements ServerRequestInterface
$hasPort = false;
if (isset($_SERVER['HTTP_HOST'])) {
list($host, $port) = self::extractHostAndPortFromAuthority($_SERVER['HTTP_HOST']);
[$host, $port] = self::extractHostAndPortFromAuthority($_SERVER['HTTP_HOST']);
if ($host !== null) {
$uri = $uri->withHost($host);
}
@ -247,26 +241,17 @@ class ServerRequest extends Request implements ServerRequestInterface
return $uri;
}
/**
* {@inheritdoc}
*/
public function getServerParams()
public function getServerParams(): array
{
return $this->serverParams;
}
/**
* {@inheritdoc}
*/
public function getUploadedFiles()
public function getUploadedFiles(): array
{
return $this->uploadedFiles;
}
/**
* {@inheritdoc}
*/
public function withUploadedFiles(array $uploadedFiles)
public function withUploadedFiles(array $uploadedFiles): ServerRequestInterface
{
$new = clone $this;
$new->uploadedFiles = $uploadedFiles;
@ -274,18 +259,12 @@ class ServerRequest extends Request implements ServerRequestInterface
return $new;
}
/**
* {@inheritdoc}
*/
public function getCookieParams()
public function getCookieParams(): array
{
return $this->cookieParams;
}
/**
* {@inheritdoc}
*/
public function withCookieParams(array $cookies)
public function withCookieParams(array $cookies): ServerRequestInterface
{
$new = clone $this;
$new->cookieParams = $cookies;
@ -293,18 +272,12 @@ class ServerRequest extends Request implements ServerRequestInterface
return $new;
}
/**
* {@inheritdoc}
*/
public function getQueryParams()
public function getQueryParams(): array
{
return $this->queryParams;
}
/**
* {@inheritdoc}
*/
public function withQueryParams(array $query)
public function withQueryParams(array $query): ServerRequestInterface
{
$new = clone $this;
$new->queryParams = $query;
@ -314,16 +287,15 @@ class ServerRequest extends Request implements ServerRequestInterface
/**
* {@inheritdoc}
*
* @return array|object|null
*/
public function getParsedBody()
{
return $this->parsedBody;
}
/**
* {@inheritdoc}
*/
public function withParsedBody($data)
public function withParsedBody($data): ServerRequestInterface
{
$new = clone $this;
$new->parsedBody = $data;
@ -331,16 +303,15 @@ class ServerRequest extends Request implements ServerRequestInterface
return $new;
}
/**
* {@inheritdoc}
*/
public function getAttributes()
public function getAttributes(): array
{
return $this->attributes;
}
/**
* {@inheritdoc}
*
* @return mixed
*/
public function getAttribute($attribute, $default = null)
{
@ -351,10 +322,7 @@ class ServerRequest extends Request implements ServerRequestInterface
return $this->attributes[$attribute];
}
/**
* {@inheritdoc}
*/
public function withAttribute($attribute, $value)
public function withAttribute($attribute, $value): ServerRequestInterface
{
$new = clone $this;
$new->attributes[$attribute] = $value;
@ -362,10 +330,7 @@ class ServerRequest extends Request implements ServerRequestInterface
return $new;
}
/**
* {@inheritdoc}
*/
public function withoutAttribute($attribute)
public function withoutAttribute($attribute): ServerRequestInterface
{
if (false === array_key_exists($attribute, $this->attributes)) {
return $this;