Code cleanup

This commit is contained in:
James Cole
2024-12-22 08:43:12 +01:00
parent 5751f7e5a3
commit 565bd87959
574 changed files with 4600 additions and 4604 deletions

View File

@@ -158,7 +158,7 @@ class GracefulNotFoundHandler extends ExceptionHandler
$accountId = $param->id;
}
if (!($param instanceof Account) && !is_object($param)) {
$accountId = (int)$param;
$accountId = (int) $param;
}
/** @var null|Account $account */
@@ -188,7 +188,7 @@ class GracefulNotFoundHandler extends ExceptionHandler
$user = auth()->user();
$route = $request->route();
$param = $route->parameter('transactionGroup');
$groupId = !is_object($param) ? (int)$param : 0;
$groupId = !is_object($param) ? (int) $param : 0;
/** @var null|TransactionGroup $group */
$group = $user->transactionGroups()->withTrashed()->find($groupId);
@@ -228,7 +228,7 @@ class GracefulNotFoundHandler extends ExceptionHandler
$user = auth()->user();
$route = $request->route();
$param = $route->parameter('attachment');
$attachmentId = is_object($param) ? 0 : (int)$param;
$attachmentId = is_object($param) ? 0 : (int) $param;
/** @var null|Attachment $attachment */
$attachment = $user->attachments()->withTrashed()->find($attachmentId);

View File

@@ -157,7 +157,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)));
@@ -214,7 +214,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);
@@ -250,7 +250,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);