for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
declare(strict_types=1);
namespace BEAR\Sunday\Provide\Error;
use BEAR\Sunday\Extension\Error\ErrorInterface;
use BEAR\Sunday\Extension\Error\ThrowableHandlerInterface;
use BEAR\Sunday\Extension\Router\RouterMatch as Request;
use Error;
use ErrorException;
use Exception;
use Override;
use Throwable;
use const E_ERROR;
final class ThrowableHandler implements ThrowableHandlerInterface
{
public function __construct(
private ErrorInterface $error,
) {
}
#[Override]
public function handle(Throwable $e, Request $request): ThrowableHandlerInterface
if ($e instanceof Error) {
$e = new ErrorException($e->getMessage(), $e->getCode(), E_ERROR, $e->getFile(), $e->getLine(), $e);
$e
Error
Exception
$previous
ErrorException::__construct()
If this is a false-positive, you can also ignore this issue in your code via the ignore-type annotation
ignore-type
$e = new ErrorException($e->getMessage(), $e->getCode(), E_ERROR, $e->getFile(), $e->getLine(), /** @scrutinizer ignore-type */ $e);
/** @var Exception $e */
$this->error->handle($e, $request);
return $this;
public function transfer(): void
$this->error->transfer();