Various PSR12 code cleanup

This commit is contained in:
James Cole
2022-12-29 19:41:57 +01:00
parent 0022009dd5
commit dbf3e76ecc
340 changed files with 4079 additions and 3816 deletions

View File

@@ -48,8 +48,8 @@ class GracefulNotFoundHandler extends ExceptionHandler
/**
* Render an exception into an HTTP response.
*
* @param Request $request
* @param Throwable $e
* @param Request $request
* @param Throwable $e
*
* @return Application|JsonResponse|\Illuminate\Http\Response|Redirector|RedirectResponse|Response
* @throws Throwable
@@ -135,8 +135,8 @@ class GracefulNotFoundHandler extends ExceptionHandler
}
/**
* @param Request $request
* @param Throwable $exception
* @param Request $request
* @param Throwable $exception
*
* @return Redirector|Response
* @throws Throwable
@@ -145,14 +145,14 @@ class GracefulNotFoundHandler extends ExceptionHandler
{
Log::debug('404 page is probably a deleted account. Redirect to overview of account types.');
/** @var User $user */
$user = auth()->user();
$route = $request->route();
$user = auth()->user();
$route = $request->route();
$param = $route->parameter('account');
if ($param instanceof Account) {
$accountId = (int) $param->id;
$accountId = (int)$param->id;
}
if (!($param instanceof Account)) {
$accountId = (int) $param;
$accountId = (int)$param;
}
/** @var Account $account */
$account = $user->accounts()->with(['accountType'])->withTrashed()->find($accountId);
@@ -169,8 +169,8 @@ class GracefulNotFoundHandler extends ExceptionHandler
}
/**
* @param Request $request
* @param Throwable $exception
* @param Request $request
* @param Throwable $exception
*
* @return RedirectResponse|\Illuminate\Http\Response|Redirector|Response
* @throws Throwable
@@ -181,7 +181,7 @@ class GracefulNotFoundHandler extends ExceptionHandler
/** @var User $user */
$user = auth()->user();
$route = $request->route();
$groupId = (int) $route->parameter('transactionGroup');
$groupId = (int)$route->parameter('transactionGroup');
/** @var TransactionGroup $group */
$group = $user->transactionGroups()->withTrashed()->find($groupId);
@@ -208,8 +208,8 @@ class GracefulNotFoundHandler extends ExceptionHandler
}
/**
* @param Request $request
* @param Throwable $exception
* @param Request $request
* @param Throwable $exception
*
* @return RedirectResponse|Redirector|Response
* @throws Throwable
@@ -220,7 +220,7 @@ class GracefulNotFoundHandler extends ExceptionHandler
/** @var User $user */
$user = auth()->user();
$route = $request->route();
$attachmentId = (int) $route->parameter('attachment');
$attachmentId = (int)$route->parameter('attachment');
/** @var Attachment $attachment */
$attachment = $user->attachments()->withTrashed()->find($attachmentId);
if (null === $attachment) {

View File

@@ -38,8 +38,8 @@ use Illuminate\Support\Arr;
use Illuminate\Validation\ValidationException as LaravelValidationException;
use Laravel\Passport\Exceptions\OAuthServerException as LaravelOAuthException;
use League\OAuth2\Server\Exception\OAuthServerException;
use Symfony\Component\HttpKernel\Exception\BadRequestHttpException;
use Symfony\Component\HttpFoundation\Exception\SuspiciousOperationException;
use Symfony\Component\HttpKernel\Exception\BadRequestHttpException;
use Symfony\Component\HttpKernel\Exception\HttpException;
use Symfony\Component\HttpKernel\Exception\MethodNotAllowedHttpException;
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
@@ -64,14 +64,14 @@ class Handler extends ExceptionHandler
LaravelOAuthException::class,
TokenMismatchException::class,
HttpException::class,
SuspiciousOperationException::class
SuspiciousOperationException::class,
];
/**
* Render an exception into an HTTP response.
*
* @param Request $request
* @param Throwable $e
* @param Request $request
* @param Throwable $e
*
* @return mixed
* @throws Throwable
@@ -154,7 +154,7 @@ class Handler extends ExceptionHandler
/**
* Report or log an exception.
*
* @param Throwable $e
* @param Throwable $e
*
* @return void
* @throws Throwable
@@ -200,14 +200,14 @@ 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);
}
/**
* @param Throwable $e
* @param Throwable $e
*
* @return bool
*/
@@ -226,8 +226,8 @@ class Handler extends ExceptionHandler
/**
* Convert a validation exception into a response.
*
* @param Request $request
* @param LaravelValidationException $exception
* @param Request $request
* @param LaravelValidationException $exception
*
* @return Application|RedirectResponse|Redirector
*/
@@ -245,7 +245,7 @@ class Handler extends ExceptionHandler
/**
* Only return the redirectTo property from the exception if it is a valid URL. Return NULL otherwise.
*
* @param LaravelValidationException $exception
* @param LaravelValidationException $exception
*
* @return string|null
*/