Upgrade to 4.0.0

This commit is contained in:
Bastian Allgeier
2023-11-28 09:33:56 +01:00
parent f96b96af76
commit 3b0b6546ca
480 changed files with 21371 additions and 13327 deletions

View File

@@ -6,7 +6,6 @@ use Closure;
use Exception;
use Kirby\Exception\LogicException;
use Kirby\Filesystem\F;
use Throwable;
/**
* Representation of an Http response,
@@ -82,6 +81,7 @@ class Response
/**
* Improved `var_dump` output
* @codeCoverageIgnore
*/
public function __debugInfo(): array
{
@@ -95,11 +95,7 @@ class Response
*/
public function __toString(): string
{
try {
return $this->send();
} catch (Throwable) {
return '';
}
return $this->send();
}
/**
@@ -198,9 +194,8 @@ 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
public static function go(string $url = '/', int $code = 302): never
{
die(static::redirect($url, $code));
}
@@ -251,7 +246,7 @@ class Response
array $headers = []
): static {
if (is_array($body) === true) {
$body = json_encode($body, $pretty === true ? JSON_PRETTY_PRINT|JSON_UNESCAPED_SLASHES : 0);
$body = json_encode($body, $pretty === true ? JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES : 0);
}
return new static([