mirror of
https://github.com/Combodo/iTop.git
synced 2026-04-24 11:08:45 +02:00
N°6934 - Symfony 6.4 - upgrade Symfony bundles to 6.4 (#580)
* Update Symfony lib to version ~6.4.0 * Update code missing return type * Add an iTop general configuration entry to store application secret (Symfony mandatory parameter) * Use dependency injection in ExceptionListener & UserProvider classes
This commit is contained in:
@@ -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)
|
||||
{
|
||||
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,6 +233,8 @@ 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)
|
||||
{
|
||||
@@ -246,6 +243,8 @@ class ResponseHeaderBag extends HeaderBag
|
||||
|
||||
/**
|
||||
* @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')) {
|
||||
|
||||
Reference in New Issue
Block a user