Various code cleanup.

This commit is contained in:
James Cole
2023-12-22 20:12:38 +01:00
parent 067d160c13
commit 581e5d7330
69 changed files with 361 additions and 317 deletions

View File

@@ -45,6 +45,8 @@ class GracefulNotFoundHandler extends ExceptionHandler
* @param Request $request
*
* @throws \Throwable
*
* @SuppressWarnings(PHPMD.CyclomaticComplexity)
*/
public function render($request, \Throwable $e): Response
{

View File

@@ -65,11 +65,15 @@ class Handler extends ExceptionHandler
];
/**
* Render an exception into an HTTP response.
* Render an exception into an HTTP response. It's complex but lucky for us, we never use it because
* Firefly III never crashes.
*
* @param Request $request
*
* @throws \Throwable
*
* @SuppressWarnings(PHPMD.NPathComplexity)
* @SuppressWarnings(PHPMD.CyclomaticComplexity)
*/
public function render($request, \Throwable $e): Response
{
@@ -124,7 +128,7 @@ class Handler extends ExceptionHandler
$errorCode = 500;
$errorCode = $e instanceof MethodNotAllowedHttpException ? 405 : $errorCode;
$isDebug = (bool)config('app.debug', false);
$isDebug = (bool) config('app.debug', false);
if ($isDebug) {
app('log')->debug(sprintf('Return JSON %s with debug.', get_class($e)));
@@ -181,7 +185,7 @@ class Handler extends ExceptionHandler
*/
public function report(\Throwable $e): void
{
$doMailError = (bool)config('firefly.send_error_message');
$doMailError = (bool) config('firefly.send_error_message');
if ($this->shouldntReportLocal($e) || !$doMailError) {
parent::report($e);
@@ -216,7 +220,7 @@ class Handler extends ExceptionHandler
// create job that will mail.
$ipAddress = request()->ip() ?? '0.0.0.0';
$job = new MailError($userData, (string)config('firefly.site_owner'), $ipAddress, $data);
$job = new MailError($userData, (string) config('firefly.site_owner'), $ipAddress, $data);
dispatch($job);
parent::report($e);