for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
declare(strict_types=1);
namespace Foo\Debug\Exceptions\Handlers\Whoops;
use Psr\Log\LoggerInterface;
use Opulence\Debug\Exceptions\Handlers;
use Throwable;
class ExceptionHandler extends Handlers\ExceptionHandler
{
/** @var LoggerInterface */
protected $logger;
/** @var ExceptionRenderer */
protected $exceptionRenderer;
/** @var bool */
protected $isCli = false;
/**
* @return bool
*/
public function getIsCli(): bool
if (null === $this->isCli) {
$this->isCli = (php_sapi_name() === 'cli');
}
return $this->isCli;
* @param bool $isCli
public function setIsCli(bool $isCli)
$this->isCli = $isCli;
* Handles an exception
*
* @param Throwable $ex The exception to handle
public function handle($ex)
$this->exceptionRenderer->render($ex);
* Registers the handler with PHP
public function register()
$renderer = $this->exceptionRenderer->getRun();
if ($this->getIsCli()) {
$renderer->pushHandler(new \Whoops\Handler\PlainTextHandler($this->logger));
new \Whoops\Handler\Plai...tHandler($this->logger)
object<Whoops\Handler\PlainTextHandler>
callable
It seems like the type of the argument is not accepted by the function/method which you are calling.
In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.
We suggest to add an explicit type cast like in the following example:
function acceptsInteger($int) { } $x = '123'; // string "123" // Instead of acceptsInteger($x); // we recommend to use acceptsInteger((integer) $x);
} else {
$renderer->pushHandler(new \Whoops\Handler\PrettyPageHandler());
new \Whoops\Handler\PrettyPageHandler()
object<Whoops\Handler\PrettyPageHandler>
$renderer->register();
It seems like the type of the argument is not accepted by the function/method which you are calling.
In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.
We suggest to add an explicit type cast like in the following example: