mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2026-01-09 20:11:22 +00:00
Fix phpstan issues
This commit is contained in:
@@ -49,7 +49,7 @@ class CreateController extends Controller
|
||||
private AttachmentHelperInterface $attachments;
|
||||
private BillRepositoryInterface $billRepository;
|
||||
private BudgetRepositoryInterface $budgetRepos;
|
||||
private RecurringRepositoryInterface $recurring;
|
||||
private RecurringRepositoryInterface $repository;
|
||||
|
||||
/**
|
||||
* CreateController constructor.
|
||||
@@ -65,8 +65,8 @@ class CreateController extends Controller
|
||||
app('view')->share('title', (string) trans('firefly.recurrences'));
|
||||
app('view')->share('subTitle', (string) trans('firefly.create_new_recurrence'));
|
||||
|
||||
$this->recurring = app(RecurringRepositoryInterface::class);
|
||||
$this->budgetRepos = app(BudgetRepositoryInterface::class);
|
||||
$this->repository = app(RecurringRepositoryInterface::class);
|
||||
$this->budgetRepos = app(BudgetRepositoryInterface::class);
|
||||
$this->attachments = app(AttachmentHelperInterface::class);
|
||||
$this->billRepository = app(BillRepositoryInterface::class);
|
||||
|
||||
@@ -221,7 +221,7 @@ class CreateController extends Controller
|
||||
$data = $request->getAll();
|
||||
|
||||
try {
|
||||
$recurrence = $this->recurring->store($data);
|
||||
$recurrence = $this->repository->store($data);
|
||||
} catch (FireflyException $e) {
|
||||
session()->flash('error', $e->getMessage());
|
||||
|
||||
|
||||
@@ -38,8 +38,7 @@ use Illuminate\View\View;
|
||||
*/
|
||||
class DeleteController extends Controller
|
||||
{
|
||||
/** @var RecurringRepositoryInterface Recurring repository */
|
||||
private $recurring;
|
||||
private RecurringRepositoryInterface $repository;
|
||||
|
||||
/**
|
||||
* DeleteController constructor.
|
||||
@@ -54,7 +53,7 @@ class DeleteController extends Controller
|
||||
app('view')->share('mainTitleIcon', 'fa-paint-brush');
|
||||
app('view')->share('title', (string) trans('firefly.recurrences'));
|
||||
|
||||
$this->recurring = app(RecurringRepositoryInterface::class);
|
||||
$this->repository = app(RecurringRepositoryInterface::class);
|
||||
|
||||
return $next($request);
|
||||
}
|
||||
@@ -72,7 +71,7 @@ class DeleteController extends Controller
|
||||
// put previous url in session
|
||||
$this->rememberPreviousUrl('recurrences.delete.url');
|
||||
|
||||
$journalsCreated = $this->recurring->getTransactions($recurrence)->count();
|
||||
$journalsCreated = $this->repository->getTransactions($recurrence)->count();
|
||||
|
||||
return view('recurring.delete', compact('recurrence', 'subTitle', 'journalsCreated'));
|
||||
}
|
||||
|
||||
@@ -54,7 +54,7 @@ class EditController extends Controller
|
||||
private AttachmentHelperInterface $attachments;
|
||||
private BillRepositoryInterface $billRepository;
|
||||
private BudgetRepositoryInterface $budgetRepos;
|
||||
private RecurringRepositoryInterface $recurring;
|
||||
private RecurringRepositoryInterface $repository;
|
||||
|
||||
/**
|
||||
* EditController constructor.
|
||||
@@ -70,8 +70,8 @@ class EditController extends Controller
|
||||
app('view')->share('title', (string) trans('firefly.recurrences'));
|
||||
app('view')->share('subTitle', (string) trans('firefly.recurrences'));
|
||||
|
||||
$this->recurring = app(RecurringRepositoryInterface::class);
|
||||
$this->budgetRepos = app(BudgetRepositoryInterface::class);
|
||||
$this->repository = app(RecurringRepositoryInterface::class);
|
||||
$this->budgetRepos = app(BudgetRepositoryInterface::class);
|
||||
$this->attachments = app(AttachmentHelperInterface::class);
|
||||
$this->billRepository = app(BillRepositoryInterface::class);
|
||||
|
||||
@@ -100,6 +100,7 @@ class EditController extends Controller
|
||||
$admin = auth()->user();
|
||||
$enrichment = new RecurringEnrichment();
|
||||
$enrichment->setUser($admin);
|
||||
/** @var Recurrence $recurrence */
|
||||
$recurrence = $enrichment->enrichSingle($recurrence);
|
||||
|
||||
/** @var RecurrenceTransformer $transformer */
|
||||
@@ -180,7 +181,7 @@ class EditController extends Controller
|
||||
public function update(RecurrenceFormRequest $request, Recurrence $recurrence)
|
||||
{
|
||||
$data = $request->getAll();
|
||||
$this->recurring->update($recurrence, $data);
|
||||
$this->repository->update($recurrence, $data);
|
||||
|
||||
$request->session()->flash('success', (string) trans('firefly.updated_recurrence', ['title' => $recurrence->title]));
|
||||
Log::channel('audit')->info(sprintf('Updated recurrence #%d.', $recurrence->id), $data);
|
||||
|
||||
@@ -45,7 +45,7 @@ class IndexController extends Controller
|
||||
{
|
||||
use GetConfigurationData;
|
||||
|
||||
private RecurringRepositoryInterface $recurringRepos;
|
||||
private RecurringRepositoryInterface $repository;
|
||||
|
||||
/**
|
||||
* IndexController constructor.
|
||||
@@ -60,7 +60,7 @@ class IndexController extends Controller
|
||||
app('view')->share('mainTitleIcon', 'fa-paint-brush');
|
||||
app('view')->share('title', (string) trans('firefly.recurrences'));
|
||||
|
||||
$this->recurringRepos = app(RecurringRepositoryInterface::class);
|
||||
$this->repository = app(RecurringRepositoryInterface::class);
|
||||
|
||||
return $next($request);
|
||||
}
|
||||
@@ -79,7 +79,7 @@ class IndexController extends Controller
|
||||
{
|
||||
$page = 0 === (int) $request->get('page') ? 1 : (int) $request->get('page');
|
||||
$pageSize = (int) app('preferences')->get('listPageSize', 50)->data;
|
||||
$collection = $this->recurringRepos->get();
|
||||
$collection = $this->repository->get();
|
||||
$today = today(config('app.timezone'));
|
||||
$year = today(config('app.timezone'));
|
||||
|
||||
|
||||
@@ -47,8 +47,7 @@ class ShowController extends Controller
|
||||
{
|
||||
use GetConfigurationData;
|
||||
|
||||
/** @var RecurringRepositoryInterface Recurring repository */
|
||||
private $recurring;
|
||||
private RecurringRepositoryInterface $repository;
|
||||
|
||||
/**
|
||||
* IndexController constructor.
|
||||
@@ -64,7 +63,7 @@ class ShowController extends Controller
|
||||
app('view')->share('mainTitleIcon', 'fa-paint-brush');
|
||||
app('view')->share('title', (string) trans('firefly.recurrences'));
|
||||
|
||||
$this->recurring = app(RecurringRepositoryInterface::class);
|
||||
$this->repository = app(RecurringRepositoryInterface::class);
|
||||
|
||||
return $next($request);
|
||||
}
|
||||
@@ -87,6 +86,7 @@ class ShowController extends Controller
|
||||
$admin = auth()->user();
|
||||
$enrichment = new RecurringEnrichment();
|
||||
$enrichment->setUser($admin);
|
||||
/** @var Recurrence $recurrence */
|
||||
$recurrence = $enrichment->enrichSingle($recurrence);
|
||||
|
||||
/** @var RecurrenceTransformer $transformer */
|
||||
@@ -95,10 +95,10 @@ class ShowController extends Controller
|
||||
|
||||
$array = $transformer->transform($recurrence);
|
||||
|
||||
$groups = $this->recurring->getTransactions($recurrence);
|
||||
$groups = $this->repository->getTransactions($recurrence);
|
||||
$today = today(config('app.timezone'));
|
||||
$array['repeat_until'] = null !== $array['repeat_until'] ? new Carbon($array['repeat_until']) : null;
|
||||
$array['journal_count'] = $this->recurring->getJournalCount($recurrence);
|
||||
$array['journal_count'] = $this->repository->getJournalCount($recurrence);
|
||||
|
||||
// transform dates back to Carbon objects and expand information
|
||||
foreach ($array['repetitions'] as $index => $repetition) {
|
||||
@@ -106,8 +106,8 @@ class ShowController extends Controller
|
||||
$date = new Carbon($occurrence)->startOfDay();
|
||||
$set = [
|
||||
'date' => $date,
|
||||
'fired' => $this->recurring->createdPreviously($recurrence, $date)
|
||||
|| $this->recurring->getJournalCount($recurrence, $date) > 0,
|
||||
'fired' => $this->repository->createdPreviously($recurrence, $date)
|
||||
|| $this->repository->getJournalCount($recurrence, $date) > 0,
|
||||
];
|
||||
$array['repetitions'][$index]['occurrences'][$item] = $set;
|
||||
}
|
||||
|
||||
@@ -28,6 +28,7 @@ use FireflyIII\Http\Controllers\Controller;
|
||||
use FireflyIII\Http\Requests\TriggerRecurrenceRequest;
|
||||
use FireflyIII\Jobs\CreateRecurringTransactions;
|
||||
use FireflyIII\Models\Recurrence;
|
||||
use FireflyIII\Repositories\Recurring\RecurringRepositoryInterface;
|
||||
use FireflyIII\Support\Facades\Preferences;
|
||||
use Illuminate\Http\RedirectResponse;
|
||||
use Illuminate\Support\Collection;
|
||||
@@ -37,6 +38,28 @@ use Illuminate\Support\Collection;
|
||||
*/
|
||||
class TriggerController extends Controller
|
||||
{
|
||||
private RecurringRepositoryInterface $repository;
|
||||
|
||||
/**
|
||||
* IndexController constructor.
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
app('view')->share('showCategory', true);
|
||||
|
||||
// translations:
|
||||
$this->middleware(
|
||||
function ($request, $next) {
|
||||
app('view')->share('mainTitleIcon', 'fa-paint-brush');
|
||||
app('view')->share('title', (string) trans('firefly.recurrences'));
|
||||
|
||||
$this->repository = app(RecurringRepositoryInterface::class);
|
||||
|
||||
return $next($request);
|
||||
}
|
||||
);
|
||||
}
|
||||
public function trigger(Recurrence $recurrence, TriggerRecurrenceRequest $request): RedirectResponse
|
||||
{
|
||||
$all = $request->getAll();
|
||||
|
||||
Reference in New Issue
Block a user