Upgrade framework

This commit is contained in:
2023-11-14 16:54:35 +01:00
parent 1648a5cd42
commit 4fcf6fffcc
10548 changed files with 693138 additions and 466698 deletions

View File

@@ -11,85 +11,63 @@
namespace Symfony\Component\HttpKernel\DataCollector;
use Symfony\Component\Debug\Exception\FlattenException;
use Symfony\Component\ErrorHandler\Exception\FlattenException;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
/**
* ExceptionDataCollector.
*
* @author Fabien Potencier <fabien@symfony.com>
*
* @final
*/
class ExceptionDataCollector extends DataCollector
{
/**
* {@inheritdoc}
*/
public function collect(Request $request, Response $response, \Exception $exception = null)
public function collect(Request $request, Response $response, \Throwable $exception = null)
{
if (null !== $exception) {
$this->data = array(
'exception' => FlattenException::create($exception),
);
$this->data = [
'exception' => FlattenException::createFromThrowable($exception),
];
}
}
/**
* Checks if the exception is not null.
*
* @return bool true if the exception is not null, false otherwise
* {@inheritdoc}
*/
public function hasException()
public function reset()
{
$this->data = [];
}
public function hasException(): bool
{
return isset($this->data['exception']);
}
/**
* Gets the exception.
*
* @return \Exception The exception
*/
public function getException()
public function getException(): \Exception|FlattenException
{
return $this->data['exception'];
}
/**
* Gets the exception message.
*
* @return string The exception message
*/
public function getMessage()
public function getMessage(): string
{
return $this->data['exception']->getMessage();
}
/**
* Gets the exception code.
*
* @return int The exception code
*/
public function getCode()
public function getCode(): int
{
return $this->data['exception']->getCode();
}
/**
* Gets the status code.
*
* @return int The status code
*/
public function getStatusCode()
public function getStatusCode(): int
{
return $this->data['exception']->getStatusCode();
}
/**
* Gets the exception trace.
*
* @return array The exception trace
*/
public function getTrace()
public function getTrace(): array
{
return $this->data['exception']->getTrace();
}
@@ -97,7 +75,7 @@ class ExceptionDataCollector extends DataCollector
/**
* {@inheritdoc}
*/
public function getName()
public function getName(): string
{
return 'exception';
}