updated packages
This commit is contained in:
32
vendor/symfony/http-foundation/Response.php
vendored
32
vendor/symfony/http-foundation/Response.php
vendored
@@ -128,7 +128,7 @@ class Response
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
public static $statusTexts = array(
|
||||
public static $statusTexts = [
|
||||
100 => 'Continue',
|
||||
101 => 'Switching Protocols',
|
||||
102 => 'Processing', // RFC2518
|
||||
@@ -191,12 +191,12 @@ class Response
|
||||
508 => 'Loop Detected', // RFC5842
|
||||
510 => 'Not Extended', // RFC2774
|
||||
511 => 'Network Authentication Required', // RFC6585
|
||||
);
|
||||
];
|
||||
|
||||
/**
|
||||
* @throws \InvalidArgumentException When the HTTP status code is not valid
|
||||
*/
|
||||
public function __construct($content = '', int $status = 200, array $headers = array())
|
||||
public function __construct($content = '', int $status = 200, array $headers = [])
|
||||
{
|
||||
$this->headers = new ResponseHeaderBag($headers);
|
||||
$this->setContent($content);
|
||||
@@ -218,7 +218,7 @@ class Response
|
||||
*
|
||||
* @return static
|
||||
*/
|
||||
public static function create($content = '', $status = 200, $headers = array())
|
||||
public static function create($content = '', $status = 200, $headers = [])
|
||||
{
|
||||
return new static($content, $status, $headers);
|
||||
}
|
||||
@@ -306,9 +306,9 @@ class Response
|
||||
}
|
||||
|
||||
// Check if we need to send extra expire info headers
|
||||
if ('1.0' == $this->getProtocolVersion() && false !== strpos($this->headers->get('Cache-Control'), 'no-cache')) {
|
||||
$this->headers->set('pragma', 'no-cache');
|
||||
$this->headers->set('expires', -1);
|
||||
if ('1.0' == $this->getProtocolVersion() && false !== strpos($headers->get('Cache-Control'), 'no-cache')) {
|
||||
$headers->set('pragma', 'no-cache');
|
||||
$headers->set('expires', -1);
|
||||
}
|
||||
|
||||
$this->ensureIEOverSSLCompatibility($request);
|
||||
@@ -377,7 +377,7 @@ class Response
|
||||
|
||||
if (\function_exists('fastcgi_finish_request')) {
|
||||
fastcgi_finish_request();
|
||||
} elseif (!\in_array(\PHP_SAPI, array('cli', 'phpdbg'), true)) {
|
||||
} elseif (!\in_array(\PHP_SAPI, ['cli', 'phpdbg'], true)) {
|
||||
static::closeOutputBuffers(0, true);
|
||||
}
|
||||
|
||||
@@ -397,7 +397,7 @@ class Response
|
||||
*/
|
||||
public function setContent($content)
|
||||
{
|
||||
if (null !== $content && !\is_string($content) && !is_numeric($content) && !\is_callable(array($content, '__toString'))) {
|
||||
if (null !== $content && !\is_string($content) && !is_numeric($content) && !\is_callable([$content, '__toString'])) {
|
||||
throw new \UnexpectedValueException(sprintf('The Response content must be a string or object implementing __toString(), "%s" given.', \gettype($content)));
|
||||
}
|
||||
|
||||
@@ -529,7 +529,7 @@ class Response
|
||||
*/
|
||||
public function isCacheable(): bool
|
||||
{
|
||||
if (!\in_array($this->statusCode, array(200, 203, 300, 301, 302, 404, 410))) {
|
||||
if (!\in_array($this->statusCode, [200, 203, 300, 301, 302, 404, 410])) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -939,7 +939,7 @@ class Response
|
||||
*/
|
||||
public function setCache(array $options)
|
||||
{
|
||||
if ($diff = array_diff(array_keys($options), array('etag', 'last_modified', 'max_age', 's_maxage', 'private', 'public', 'immutable'))) {
|
||||
if ($diff = array_diff(array_keys($options), ['etag', 'last_modified', 'max_age', 's_maxage', 'private', 'public', 'immutable'])) {
|
||||
throw new \InvalidArgumentException(sprintf('Response does not support the following options: "%s".', implode('", "', $diff)));
|
||||
}
|
||||
|
||||
@@ -1000,7 +1000,7 @@ class Response
|
||||
$this->setContent(null);
|
||||
|
||||
// remove headers that MUST NOT be included with 304 Not Modified responses
|
||||
foreach (array('Allow', 'Content-Encoding', 'Content-Language', 'Content-Length', 'Content-MD5', 'Content-Type', 'Last-Modified') as $header) {
|
||||
foreach (['Allow', 'Content-Encoding', 'Content-Language', 'Content-Length', 'Content-MD5', 'Content-Type', 'Last-Modified'] as $header) {
|
||||
$this->headers->remove($header);
|
||||
}
|
||||
|
||||
@@ -1025,10 +1025,10 @@ class Response
|
||||
public function getVary(): array
|
||||
{
|
||||
if (!$vary = $this->headers->get('Vary', null, false)) {
|
||||
return array();
|
||||
return [];
|
||||
}
|
||||
|
||||
$ret = array();
|
||||
$ret = [];
|
||||
foreach ($vary as $item) {
|
||||
$ret = array_merge($ret, preg_split('/[\s,]+/', $item));
|
||||
}
|
||||
@@ -1188,7 +1188,7 @@ class Response
|
||||
*/
|
||||
public function isRedirect(string $location = null): bool
|
||||
{
|
||||
return \in_array($this->statusCode, array(201, 301, 302, 303, 307, 308)) && (null === $location ?: $location == $this->headers->get('Location'));
|
||||
return \in_array($this->statusCode, [201, 301, 302, 303, 307, 308]) && (null === $location ?: $location == $this->headers->get('Location'));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1198,7 +1198,7 @@ class Response
|
||||
*/
|
||||
public function isEmpty(): bool
|
||||
{
|
||||
return \in_array($this->statusCode, array(204, 304));
|
||||
return \in_array($this->statusCode, [204, 304]);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user