updated packages
This commit is contained in:
12
vendor/symfony/http-foundation/JsonResponse.php
vendored
12
vendor/symfony/http-foundation/JsonResponse.php
vendored
@@ -39,7 +39,7 @@ class JsonResponse extends Response
|
||||
* @param array $headers An array of response headers
|
||||
* @param bool $json If the data is already a JSON string
|
||||
*/
|
||||
public function __construct($data = null, int $status = 200, array $headers = array(), bool $json = false)
|
||||
public function __construct($data = null, int $status = 200, array $headers = [], bool $json = false)
|
||||
{
|
||||
parent::__construct('', $status, $headers);
|
||||
|
||||
@@ -64,7 +64,7 @@ class JsonResponse extends Response
|
||||
*
|
||||
* @return static
|
||||
*/
|
||||
public static function create($data = null, $status = 200, $headers = array())
|
||||
public static function create($data = null, $status = 200, $headers = [])
|
||||
{
|
||||
return new static($data, $status, $headers);
|
||||
}
|
||||
@@ -72,7 +72,7 @@ class JsonResponse extends Response
|
||||
/**
|
||||
* Make easier the creation of JsonResponse from raw json.
|
||||
*/
|
||||
public static function fromJsonString($data = null, $status = 200, $headers = array())
|
||||
public static function fromJsonString($data = null, $status = 200, $headers = [])
|
||||
{
|
||||
return new static($data, $status, $headers, true);
|
||||
}
|
||||
@@ -94,11 +94,11 @@ class JsonResponse extends Response
|
||||
// JsonpCallbackValidator is released under the MIT License. See https://github.com/willdurand/JsonpCallbackValidator/blob/v1.1.0/LICENSE for details.
|
||||
// (c) William Durand <william.durand1@gmail.com>
|
||||
$pattern = '/^[$_\p{L}][$_\p{L}\p{Mn}\p{Mc}\p{Nd}\p{Pc}\x{200C}\x{200D}]*(?:\[(?:"(?:\\\.|[^"\\\])*"|\'(?:\\\.|[^\'\\\])*\'|\d+)\])*?$/u';
|
||||
$reserved = array(
|
||||
$reserved = [
|
||||
'break', 'do', 'instanceof', 'typeof', 'case', 'else', 'new', 'var', 'catch', 'finally', 'return', 'void', 'continue', 'for', 'switch', 'while',
|
||||
'debugger', 'function', 'this', 'with', 'default', 'if', 'throw', 'delete', 'in', 'try', 'class', 'enum', 'extends', 'super', 'const', 'export',
|
||||
'import', 'implements', 'let', 'private', 'public', 'yield', 'interface', 'package', 'protected', 'static', 'null', 'true', 'false',
|
||||
);
|
||||
];
|
||||
$parts = explode('.', $callback);
|
||||
foreach ($parts as $part) {
|
||||
if (!preg_match($pattern, $part) || \in_array($part, $reserved, true)) {
|
||||
@@ -137,7 +137,7 @@ class JsonResponse extends Response
|
||||
*
|
||||
* @throws \InvalidArgumentException
|
||||
*/
|
||||
public function setData($data = array())
|
||||
public function setData($data = [])
|
||||
{
|
||||
try {
|
||||
$data = json_encode($data, $this->encodingOptions);
|
||||
|
||||
Reference in New Issue
Block a user