mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-10-12 15:35:15 +00:00
Fix various phpstan issues.
This commit is contained in:
@@ -653,7 +653,7 @@ class BillRepository implements BillRepositoryInterface
|
||||
return $this->user->bills()
|
||||
->where('active', true)
|
||||
->orderBy('bills.name', 'ASC')
|
||||
->get(['bills.*', DB::raw('((bills.amount_min + bills.amount_max) / 2) AS expectedAmount'),]);
|
||||
->get(['bills.*', DB::raw('((bills.amount_min + bills.amount_max) / 2) AS expectedAmount'),]); // @phpstan-ignore-line
|
||||
}
|
||||
|
||||
/**
|
||||
|
@@ -201,7 +201,7 @@ class JournalCLIRepository implements JournalCLIRepositoryInterface
|
||||
{
|
||||
$query = TransactionJournal::leftJoin('transactions', 'transaction_journals.id', '=', 'transactions.transaction_journal_id')
|
||||
->groupBy('transaction_journals.id');
|
||||
$result = $query->get(['transaction_journals.id as id', DB::raw('count(transactions.id) as transaction_count')]);
|
||||
$result = $query->get(['transaction_journals.id as id', DB::raw('count(transactions.id) as transaction_count')]); // @phpstan-ignore-line
|
||||
$journalIds = [];
|
||||
/** @var stdClass $row */
|
||||
foreach ($result as $row) {
|
||||
|
@@ -69,9 +69,9 @@ class RecurringRepository implements RecurringRepositoryInterface
|
||||
// if not, loop set and try to read the recurrence_date. If it matches start or end, return it as well.
|
||||
$set
|
||||
= TransactionJournalMeta::where(static function (Builder $q1) use ($recurrence) {
|
||||
$q1->where('name', 'recurrence_id');
|
||||
$q1->where('data', json_encode((string)$recurrence->id));
|
||||
})->get(['journal_meta.transaction_journal_id']);
|
||||
$q1->where('name', 'recurrence_id');
|
||||
$q1->where('data', json_encode((string)$recurrence->id));
|
||||
})->get(['journal_meta.transaction_journal_id']);
|
||||
|
||||
// there are X journals made for this recurrence. Any of them meant for today?
|
||||
foreach ($set as $journalMeta) {
|
||||
@@ -495,6 +495,10 @@ class RecurringRepository implements RecurringRepositoryInterface
|
||||
/** @var Preference $pref */
|
||||
$pref = app('preferences')->getForUser($this->user, 'language', config('firefly.default_language', 'en_US'));
|
||||
$language = $pref->data;
|
||||
if (is_array($language)) {
|
||||
$language = 'en_US';
|
||||
}
|
||||
$language = (string)$language;
|
||||
if ('daily' === $repetition->repetition_type) {
|
||||
return (string)trans('firefly.recurring_daily', [], $language);
|
||||
}
|
||||
@@ -532,6 +536,9 @@ class RecurringRepository implements RecurringRepositoryInterface
|
||||
//
|
||||
$today = today(config('app.timezone'))->endOfYear();
|
||||
$repDate = Carbon::createFromFormat('Y-m-d', $repetition->repetition_moment);
|
||||
if(false === $repDate) {
|
||||
$repDate = clone $today;
|
||||
}
|
||||
$diffInYears = $today->diffInYears($repDate);
|
||||
$repDate->addYears($diffInYears); // technically not necessary.
|
||||
$string = $repDate->isoFormat((string)trans('config.month_and_day_no_year_js'));
|
||||
|
@@ -206,12 +206,15 @@ class UserGroupRepository implements UserGroupRepositoryInterface
|
||||
{
|
||||
$owner = UserRole::whereTitle(UserRoleEnum::OWNER)->first();
|
||||
app('log')->debug('in update membership');
|
||||
/** @var User|null $user */
|
||||
$user = null;
|
||||
if (array_key_exists('id', $data)) {
|
||||
/** @var User|null $user */
|
||||
$user = User::find($data['id']);
|
||||
app('log')->debug('Found user by ID');
|
||||
}
|
||||
if (array_key_exists('email', $data) && '' !== (string)$data['email']) {
|
||||
/** @var User|null $user */
|
||||
$user = User::whereEmail($data['email'])->first();
|
||||
app('log')->debug('Found user by email');
|
||||
}
|
||||
|
Reference in New Issue
Block a user