Update dependencies

This commit is contained in:
Chris Hunt
2024-02-16 21:36:54 +00:00
parent 22d7a59e59
commit d52ae0d3c3
9569 changed files with 460443 additions and 282416 deletions

View File

@@ -44,10 +44,8 @@ class ResponseHeaderBag extends HeaderBag
/**
* Returns the headers, with original capitalizations.
*
* @return array
*/
public function allPreserveCase()
public function allPreserveCase(): array
{
$headers = [];
foreach ($this->all() as $name => $value) {
@@ -57,6 +55,9 @@ class ResponseHeaderBag extends HeaderBag
return $headers;
}
/**
* @return array
*/
public function allPreserveCaseWithoutCookies()
{
$headers = $this->allPreserveCase();
@@ -68,7 +69,7 @@ class ResponseHeaderBag extends HeaderBag
}
/**
* {@inheritdoc}
* @return void
*/
public function replace(array $headers = [])
{
@@ -85,10 +86,7 @@ class ResponseHeaderBag extends HeaderBag
}
}
/**
* {@inheritdoc}
*/
public function all(string $key = null)
public function all(?string $key = null): array
{
$headers = parent::all();
@@ -106,9 +104,9 @@ class ResponseHeaderBag extends HeaderBag
}
/**
* {@inheritdoc}
* @return void
*/
public function set(string $key, $values, bool $replace = true)
public function set(string $key, string|array|null $values, bool $replace = true)
{
$uniqueKey = strtr($key, self::UPPER, self::LOWER);
@@ -137,7 +135,7 @@ class ResponseHeaderBag extends HeaderBag
}
/**
* {@inheritdoc}
* @return void
*/
public function remove(string $key)
{
@@ -161,22 +159,19 @@ class ResponseHeaderBag extends HeaderBag
}
}
/**
* {@inheritdoc}
*/
public function hasCacheControlDirective(string $key)
public function hasCacheControlDirective(string $key): bool
{
return \array_key_exists($key, $this->computedCacheControl);
}
/**
* {@inheritdoc}
*/
public function getCacheControlDirective(string $key)
public function getCacheControlDirective(string $key): bool|string|null
{
return $this->computedCacheControl[$key] ?? null;
}
/**
* @return void
*/
public function setCookie(Cookie $cookie)
{
$this->cookies[$cookie->getDomain()][$cookie->getPath()][$cookie->getName()] = $cookie;
@@ -185,12 +180,12 @@ class ResponseHeaderBag extends HeaderBag
/**
* Removes a cookie from the array, but does not unset it in the browser.
*
* @return void
*/
public function removeCookie(string $name, ?string $path = '/', string $domain = null)
public function removeCookie(string $name, ?string $path = '/', ?string $domain = null)
{
if (null === $path) {
$path = '/';
}
$path ??= '/';
unset($this->cookies[$domain][$path][$name]);
@@ -214,7 +209,7 @@ class ResponseHeaderBag extends HeaderBag
*
* @throws \InvalidArgumentException When the $format is invalid
*/
public function getCookies(string $format = self::COOKIES_FLAT)
public function getCookies(string $format = self::COOKIES_FLAT): array
{
if (!\in_array($format, [self::COOKIES_FLAT, self::COOKIES_ARRAY])) {
throw new \InvalidArgumentException(sprintf('Format "%s" invalid (%s).', $format, implode(', ', [self::COOKIES_FLAT, self::COOKIES_ARRAY])));
@@ -238,14 +233,18 @@ class ResponseHeaderBag extends HeaderBag
/**
* Clears a cookie in the browser.
*
* @return void
*/
public function clearCookie(string $name, ?string $path = '/', string $domain = null, bool $secure = false, bool $httpOnly = true, string $sameSite = null)
public function clearCookie(string $name, ?string $path = '/', ?string $domain = null, bool $secure = false, bool $httpOnly = true, ?string $sameSite = null)
{
$this->setCookie(new Cookie($name, null, 1, $path, $domain, $secure, $httpOnly, false, $sameSite));
}
/**
* @see HeaderUtils::makeDisposition()
*
* @return string
*/
public function makeDisposition(string $disposition, string $filename, string $filenameFallback = '')
{
@@ -257,10 +256,8 @@ class ResponseHeaderBag extends HeaderBag
*
* This considers several other headers and calculates or modifies the
* cache-control header to a sensible, conservative value.
*
* @return string
*/
protected function computeCacheControlValue()
protected function computeCacheControlValue(): string
{
if (!$this->cacheControl) {
if ($this->has('Last-Modified') || $this->has('Expires')) {