Fix code quality with rector [skip ci]

This commit is contained in:
James Cole
2025-11-09 09:07:14 +01:00
parent 38691d6fdf
commit d2610be790
262 changed files with 873 additions and 1186 deletions

View File

@@ -53,7 +53,7 @@ class MonthReportGenerator implements ReportGeneratorInterface
$preferredPeriod = $this->preferredPeriod();
try {
$result = view('reports.double.report', compact('accountIds', 'reportType', 'doubleIds', 'preferredPeriod'))
$result = view('reports.double.report', ['accountIds' => $accountIds, 'reportType' => $reportType, 'doubleIds' => $doubleIds, 'preferredPeriod' => $preferredPeriod])
->with('start', $this->start)->with('end', $this->end)
->with('doubles', $this->expense)
->render()

View File

@@ -100,7 +100,7 @@ class MonthReportGenerator implements ReportGeneratorInterface
];
try {
$result = view('reports.audit.report', compact('reportType', 'accountIds', 'auditData', 'hideable', 'defaultShow'))
$result = view('reports.audit.report', ['reportType' => $reportType, 'accountIds' => $accountIds, 'auditData' => $auditData, 'hideable' => $hideable, 'defaultShow' => $defaultShow])
->with('start', $this->start)->with('end', $this->end)->with('accounts', $this->accounts)
->render()
;

View File

@@ -41,17 +41,9 @@ class MonthReportGenerator implements ReportGeneratorInterface
private Collection $accounts;
private Collection $budgets;
private Carbon $end;
private array $expenses;
private array $expenses = [];
private Carbon $start;
/**
* MonthReportGenerator constructor.
*/
public function __construct()
{
$this->expenses = [];
}
/**
* Generates the report.
*
@@ -65,7 +57,7 @@ class MonthReportGenerator implements ReportGeneratorInterface
try {
$result = view(
'reports.budget.month',
compact('accountIds', 'budgetIds')
['accountIds' => $accountIds, 'budgetIds' => $budgetIds]
)
->with('start', $this->start)->with('end', $this->end)
->with('budgets', $this->budgets)

View File

@@ -41,19 +41,10 @@ class MonthReportGenerator implements ReportGeneratorInterface
private Collection $accounts;
private Collection $categories;
private Carbon $end;
private array $expenses;
private array $income;
private array $expenses = [];
private array $income = [];
private Carbon $start;
/**
* MonthReportGenerator constructor.
*/
public function __construct()
{
$this->income = [];
$this->expenses = [];
}
/**
* Generates the report.
*
@@ -67,7 +58,7 @@ class MonthReportGenerator implements ReportGeneratorInterface
// render!
try {
return view('reports.category.month', compact('accountIds', 'categoryIds', 'reportType'))
return view('reports.category.month', ['accountIds' => $accountIds, 'categoryIds' => $categoryIds, 'reportType' => $reportType])
->with('start', $this->start)->with('end', $this->end)
->with('categories', $this->categories)
->with('accounts', $this->accounts)

View File

@@ -36,13 +36,13 @@ use Illuminate\Support\Facades\Log;
class MonthReportGenerator implements ReportGeneratorInterface
{
/** @var Collection The accounts involved in the report. */
private $accounts;
private ?Collection $accounts = null;
/** @var Carbon The end date. */
private $end;
private ?Carbon $end = null;
/** @var Carbon The start date. */
private $start;
private ?Carbon $start = null;
/**
* Generates the report.
@@ -55,7 +55,7 @@ class MonthReportGenerator implements ReportGeneratorInterface
$reportType = 'default';
try {
return view('reports.default.month', compact('accountIds', 'reportType'))->with('start', $this->start)->with('end', $this->end)->render();
return view('reports.default.month', ['accountIds' => $accountIds, 'reportType' => $reportType])->with('start', $this->start)->with('end', $this->end)->render();
} catch (Throwable $e) {
Log::error(sprintf('Cannot render reports.default.month: %s', $e->getMessage()));
Log::error($e->getTraceAsString());

View File

@@ -36,13 +36,13 @@ use Illuminate\Support\Facades\Log;
class MultiYearReportGenerator implements ReportGeneratorInterface
{
/** @var Collection The accounts involved. */
private $accounts;
private ?Collection $accounts = null;
/** @var Carbon The end date. */
private $end;
private ?Carbon $end = null;
/** @var Carbon The start date. */
private $start;
private ?Carbon $start = null;
/**
* Generates the report.
@@ -58,7 +58,7 @@ class MultiYearReportGenerator implements ReportGeneratorInterface
try {
return view(
'reports.default.multi-year',
compact('accountIds', 'reportType')
['accountIds' => $accountIds, 'reportType' => $reportType]
)->with('start', $this->start)->with('end', $this->end)->render();
} catch (Throwable $e) {
Log::error(sprintf('Cannot render reports.default.multi-year: %s', $e->getMessage()));

View File

@@ -36,13 +36,13 @@ use Illuminate\Support\Facades\Log;
class YearReportGenerator implements ReportGeneratorInterface
{
/** @var Collection The accounts involved. */
private $accounts;
private ?Collection $accounts = null;
/** @var Carbon The end date. */
private $end;
private ?Carbon $end = null;
/** @var Carbon The start date. */
private $start;
private ?Carbon $start = null;
/**
* Generates the report.
@@ -58,7 +58,7 @@ class YearReportGenerator implements ReportGeneratorInterface
try {
$result = view(
'reports.default.year',
compact('accountIds', 'reportType')
['accountIds' => $accountIds, 'reportType' => $reportType]
)->with('start', $this->start)->with('end', $this->end)->render();
} catch (Throwable $e) {
Log::error(sprintf('Cannot render reports.account.report: %s', $e->getMessage()));

View File

@@ -65,7 +65,7 @@ class MonthReportGenerator implements ReportGeneratorInterface
try {
$result = view(
'reports.tag.month',
compact('accountIds', 'reportType', 'tagIds')
['accountIds' => $accountIds, 'reportType' => $reportType, 'tagIds' => $tagIds]
)->with('start', $this->start)->with('end', $this->end)->with('tags', $this->tags)->with('accounts', $this->accounts)->render();
} catch (Throwable $e) {
Log::error(sprintf('Cannot render reports.tag.month: %s', $e->getMessage()));

View File

@@ -130,7 +130,7 @@ class StandardMessageGenerator implements MessageGeneratorInterface
/** @var WebhookResponseModel $response */
$response = $webhook->webhookResponses()->first();
$triggers = $this->getTriggerTitles($webhook->webhookTriggers()->get());
$this->getTriggerTitles($webhook->webhookTriggers()->get());
$basicMessage = [
'uuid' => $uuid->toString(),
'user_id' => 0,
@@ -171,7 +171,7 @@ class StandardMessageGenerator implements MessageGeneratorInterface
break;
}
$responseTitle = $this->getRelevantResponse($triggers, $response, $class);
$responseTitle = $this->getRelevantResponse($response, $class);
switch ($responseTitle) {
default:
@@ -298,7 +298,7 @@ class StandardMessageGenerator implements MessageGeneratorInterface
$this->webhooks = $webhooks;
}
private function getRelevantResponse(array $triggers, WebhookResponseModel $response, string $class): string
private function getRelevantResponse(WebhookResponseModel $response, string $class): string
{
// return none if none.
if (WebhookResponse::NONE->name === $response->title) {