mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-09-06 04:34:00 +00:00
Various code cleanup
This commit is contained in:
@@ -11,6 +11,7 @@ parameters:
|
|||||||
- '#has a nullable return type declaration#'
|
- '#has a nullable return type declaration#'
|
||||||
- '#with a nullable type declaration#'
|
- '#with a nullable type declaration#'
|
||||||
- '#with null as default value#'
|
- '#with null as default value#'
|
||||||
|
- '#is not covariant with PHPDoc type array#'
|
||||||
-
|
-
|
||||||
message: '#but containers should not be injected#'
|
message: '#but containers should not be injected#'
|
||||||
paths:
|
paths:
|
||||||
@@ -65,4 +66,5 @@ parameters:
|
|||||||
- ../bootstrap/app.php
|
- ../bootstrap/app.php
|
||||||
|
|
||||||
# The level 8 is the highest level. original was 5
|
# The level 8 is the highest level. original was 5
|
||||||
level: 2
|
level: 4
|
||||||
|
|
||||||
|
@@ -29,7 +29,7 @@ use FireflyIII\User;
|
|||||||
use Illuminate\Database\Eloquent\Builder;
|
use Illuminate\Database\Eloquent\Builder;
|
||||||
use Illuminate\Database\Eloquent\Model;
|
use Illuminate\Database\Eloquent\Model;
|
||||||
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||||||
use Illuminate\Support\Carbon;
|
use Carbon\Carbon;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Class InvitedUser
|
* Class InvitedUser
|
||||||
|
@@ -54,6 +54,8 @@ class JournalAPIRepository implements JournalAPIRepositoryInterface
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* TODO pretty sure method duplicated.
|
||||||
|
*
|
||||||
* Return all attachments for journal.
|
* Return all attachments for journal.
|
||||||
*
|
*
|
||||||
* @param TransactionJournal $journal
|
* @param TransactionJournal $journal
|
||||||
@@ -71,7 +73,7 @@ class JournalAPIRepository implements JournalAPIRepositoryInterface
|
|||||||
static function (Attachment $attachment) use ($disk) {
|
static function (Attachment $attachment) use ($disk) {
|
||||||
$notes = $attachment->notes()->first();
|
$notes = $attachment->notes()->first();
|
||||||
$attachment->file_exists = $disk->exists($attachment->fileName());
|
$attachment->file_exists = $disk->exists($attachment->fileName());
|
||||||
$attachment->notes = $notes ? $notes->text : '';
|
$attachment->notes = $notes ? $notes->text : ''; // TODO should not set notes like this.
|
||||||
|
|
||||||
return $attachment;
|
return $attachment;
|
||||||
}
|
}
|
||||||
|
@@ -95,7 +95,8 @@ class PiggyBankRepository implements PiggyBankRepositoryInterface
|
|||||||
*/
|
*/
|
||||||
public function find(int $piggyBankId): ?PiggyBank
|
public function find(int $piggyBankId): ?PiggyBank
|
||||||
{
|
{
|
||||||
return $this->user->piggyBanks()->find($piggyBankId);
|
// phpstan doesn't get the Model.
|
||||||
|
return $this->user->piggyBanks()->find($piggyBankId); // @phpstan-ignore-line
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -124,7 +125,7 @@ class PiggyBankRepository implements PiggyBankRepositoryInterface
|
|||||||
static function (Attachment $attachment) use ($disk) {
|
static function (Attachment $attachment) use ($disk) {
|
||||||
$notes = $attachment->notes()->first();
|
$notes = $attachment->notes()->first();
|
||||||
$attachment->file_exists = $disk->exists($attachment->fileName());
|
$attachment->file_exists = $disk->exists($attachment->fileName());
|
||||||
$attachment->notes = $notes ? $notes->text : '';
|
$attachment->notes = $notes ? $notes->text : ''; // TODO setting the text to the 'notes' field doesn't work.
|
||||||
|
|
||||||
return $attachment;
|
return $attachment;
|
||||||
}
|
}
|
||||||
@@ -331,11 +332,11 @@ class PiggyBankRepository implements PiggyBankRepositoryInterface
|
|||||||
*/
|
*/
|
||||||
public function getPiggyBanks(): Collection
|
public function getPiggyBanks(): Collection
|
||||||
{
|
{
|
||||||
return $this->user
|
return $this->user // @phpstan-ignore-line (phpstan does not recognize objectGroups)
|
||||||
->piggyBanks()
|
->piggyBanks()
|
||||||
->with(
|
->with(
|
||||||
['account',
|
['account',
|
||||||
'objectGroups']) // @phpstan-ignore-line (phpstan does not recognize objectGroups)
|
'objectGroups'])
|
||||||
->orderBy('order', 'ASC')->get();
|
->orderBy('order', 'ASC')->get();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user