Change typehint from Exception
to Throwable
.
-function handler(Exception $exception) { ... }
+function handler(Throwable $exception) { ... }
set_exception_handler('handler');
Configure your rector.php
:
<?php
use Rector\Config\RectorConfig;
use Rector\Php70\Rector\FunctionLike\ExceptionHandlerTypehintRector;
return RectorConfig::configure()
->withRules([
ExceptionHandlerTypehintRector::class,
]);