Update Composer packages
This commit is contained in:
parent
67c3d8b307
commit
83cb211fe6
219 changed files with 6487 additions and 4444 deletions
|
@ -50,8 +50,13 @@ class Response
|
|||
/**
|
||||
* Creates a new response object
|
||||
*/
|
||||
public function __construct(string|array $body = '', string|null $type = null, int|null $code = null, array|null $headers = null, string|null $charset = null)
|
||||
{
|
||||
public function __construct(
|
||||
string|array $body = '',
|
||||
string|null $type = null,
|
||||
int|null $code = null,
|
||||
array|null $headers = null,
|
||||
string|null $charset = null
|
||||
) {
|
||||
// array construction
|
||||
if (is_array($body) === true) {
|
||||
$params = $body;
|
||||
|
@ -127,8 +132,11 @@ class Response
|
|||
*
|
||||
* @param array $props Custom overrides for response props (e.g. headers)
|
||||
*/
|
||||
public static function download(string $file, string|null $filename = null, array $props = []): static
|
||||
{
|
||||
public static function download(
|
||||
string $file,
|
||||
string|null $filename = null,
|
||||
array $props = []
|
||||
): static {
|
||||
if (file_exists($file) === false) {
|
||||
throw new Exception('The file could not be found');
|
||||
}
|
||||
|
@ -178,6 +186,7 @@ class Response
|
|||
* @since 3.7.0
|
||||
*
|
||||
* @codeCoverageIgnore
|
||||
* @todo Change return type to `never` once support for PHP 8.0 is dropped
|
||||
*/
|
||||
public static function go(string $url = '/', int $code = 302): void
|
||||
{
|
||||
|
@ -223,8 +232,12 @@ class Response
|
|||
* Creates a json response with appropriate
|
||||
* header and automatic conversion of arrays.
|
||||
*/
|
||||
public static function json(string|array $body = '', int|null $code = null, bool|null $pretty = null, array $headers = []): static
|
||||
{
|
||||
public static function json(
|
||||
string|array $body = '',
|
||||
int|null $code = null,
|
||||
bool|null $pretty = null,
|
||||
array $headers = []
|
||||
): static {
|
||||
if (is_array($body) === true) {
|
||||
$body = json_encode($body, $pretty === true ? JSON_PRETTY_PRINT|JSON_UNESCAPED_SLASHES : 0);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue