mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-10-12 15:35:15 +00:00
Fix code
This commit is contained in:
@@ -87,7 +87,7 @@ trait AccountCollection
|
||||
if ($accounts->count() > 0) {
|
||||
$accountIds = $accounts->pluck('id')->toArray();
|
||||
$this->query->where(
|
||||
static function (EloquentBuilder $query) use ($accountIds) { // @phpstan-ignore-line
|
||||
static function (EloquentBuilder $query) use ($accountIds): void { // @phpstan-ignore-line
|
||||
$query->whereIn('source.account_id', $accountIds);
|
||||
$query->orWhereIn('destination.account_id', $accountIds);
|
||||
}
|
||||
@@ -106,7 +106,7 @@ trait AccountCollection
|
||||
if ($accounts->count() > 0) {
|
||||
$accountIds = $accounts->pluck('id')->toArray();
|
||||
$this->query->where(
|
||||
static function (EloquentBuilder $query) use ($accountIds) { // @phpstan-ignore-line
|
||||
static function (EloquentBuilder $query) use ($accountIds): void { // @phpstan-ignore-line
|
||||
$query->whereIn('source.account_id', $accountIds);
|
||||
$query->whereIn('destination.account_id', $accountIds);
|
||||
}
|
||||
@@ -140,7 +140,7 @@ trait AccountCollection
|
||||
if ($accounts->count() > 0) {
|
||||
$accountIds = $accounts->pluck('id')->toArray();
|
||||
$this->query->where(
|
||||
static function (EloquentBuilder $query) use ($accountIds) { // @phpstan-ignore-line
|
||||
static function (EloquentBuilder $query) use ($accountIds): void { // @phpstan-ignore-line
|
||||
$query->whereNotIn('source.account_id', $accountIds);
|
||||
$query->whereNotIn('destination.account_id', $accountIds);
|
||||
}
|
||||
@@ -174,18 +174,18 @@ trait AccountCollection
|
||||
if ($accounts->count() > 0) {
|
||||
$accountIds = $accounts->pluck('id')->toArray();
|
||||
$this->query->where(
|
||||
static function (EloquentBuilder $q1) use ($accountIds) { // @phpstan-ignore-line
|
||||
static function (EloquentBuilder $q1) use ($accountIds): void { // @phpstan-ignore-line
|
||||
// sourceAccount is in the set, and destination is NOT.
|
||||
|
||||
$q1->where(
|
||||
static function (EloquentBuilder $q2) use ($accountIds) {
|
||||
static function (EloquentBuilder $q2) use ($accountIds): void {
|
||||
$q2->whereIn('source.account_id', $accountIds);
|
||||
$q2->whereNotIn('destination.account_id', $accountIds);
|
||||
}
|
||||
);
|
||||
// destination is in the set, and source is NOT
|
||||
$q1->orWhere(
|
||||
static function (EloquentBuilder $q3) use ($accountIds) {
|
||||
static function (EloquentBuilder $q3) use ($accountIds): void {
|
||||
$q3->whereNotIn('source.account_id', $accountIds);
|
||||
$q3->whereIn('destination.account_id', $accountIds);
|
||||
}
|
||||
|
@@ -38,7 +38,7 @@ trait AmountCollection
|
||||
public function amountIs(string $amount): GroupCollectorInterface
|
||||
{
|
||||
$this->query->where(
|
||||
static function (EloquentBuilder $q) use ($amount) { // @phpstan-ignore-line
|
||||
static function (EloquentBuilder $q) use ($amount): void { // @phpstan-ignore-line
|
||||
$q->where('source.amount', app('steam')->negative($amount));
|
||||
}
|
||||
);
|
||||
@@ -49,7 +49,7 @@ trait AmountCollection
|
||||
public function amountIsNot(string $amount): GroupCollectorInterface
|
||||
{
|
||||
$this->query->where(
|
||||
static function (EloquentBuilder $q) use ($amount) { // @phpstan-ignore-line
|
||||
static function (EloquentBuilder $q) use ($amount): void { // @phpstan-ignore-line
|
||||
$q->where('source.amount', '!=', app('steam')->negative($amount));
|
||||
}
|
||||
);
|
||||
@@ -63,7 +63,7 @@ trait AmountCollection
|
||||
public function amountLess(string $amount): GroupCollectorInterface
|
||||
{
|
||||
$this->query->where(
|
||||
static function (EloquentBuilder $q) use ($amount) { // @phpstan-ignore-line
|
||||
static function (EloquentBuilder $q) use ($amount): void { // @phpstan-ignore-line
|
||||
$q->where('destination.amount', '<=', app('steam')->positive($amount));
|
||||
}
|
||||
);
|
||||
@@ -77,7 +77,7 @@ trait AmountCollection
|
||||
public function amountMore(string $amount): GroupCollectorInterface
|
||||
{
|
||||
$this->query->where(
|
||||
static function (EloquentBuilder $q) use ($amount) { // @phpstan-ignore-line
|
||||
static function (EloquentBuilder $q) use ($amount): void { // @phpstan-ignore-line
|
||||
$q->where('destination.amount', '>=', app('steam')->positive($amount));
|
||||
}
|
||||
);
|
||||
@@ -91,7 +91,7 @@ trait AmountCollection
|
||||
public function foreignAmountIs(string $amount): GroupCollectorInterface
|
||||
{
|
||||
$this->query->where(
|
||||
static function (EloquentBuilder $q) use ($amount) { // @phpstan-ignore-line
|
||||
static function (EloquentBuilder $q) use ($amount): void { // @phpstan-ignore-line
|
||||
$q->whereNotNull('source.foreign_amount');
|
||||
$q->where('source.foreign_amount', app('steam')->negative($amount));
|
||||
}
|
||||
@@ -106,7 +106,7 @@ trait AmountCollection
|
||||
public function foreignAmountIsNot(string $amount): GroupCollectorInterface
|
||||
{
|
||||
$this->query->where(
|
||||
static function (EloquentBuilder $q) use ($amount) { // @phpstan-ignore-line
|
||||
static function (EloquentBuilder $q) use ($amount): void { // @phpstan-ignore-line
|
||||
$q->whereNull('source.foreign_amount');
|
||||
$q->orWhere('source.foreign_amount', '!=', app('steam')->negative($amount));
|
||||
}
|
||||
@@ -121,7 +121,7 @@ trait AmountCollection
|
||||
public function foreignAmountLess(string $amount): GroupCollectorInterface
|
||||
{
|
||||
$this->query->where(
|
||||
static function (EloquentBuilder $q) use ($amount) { // @phpstan-ignore-line
|
||||
static function (EloquentBuilder $q) use ($amount): void { // @phpstan-ignore-line
|
||||
$q->whereNotNull('destination.foreign_amount');
|
||||
$q->where('destination.foreign_amount', '<=', app('steam')->positive($amount));
|
||||
}
|
||||
@@ -136,7 +136,7 @@ trait AmountCollection
|
||||
public function foreignAmountMore(string $amount): GroupCollectorInterface
|
||||
{
|
||||
$this->query->where(
|
||||
static function (EloquentBuilder $q) use ($amount) { // @phpstan-ignore-line
|
||||
static function (EloquentBuilder $q) use ($amount): void { // @phpstan-ignore-line
|
||||
$q->whereNotNull('destination.foreign_amount');
|
||||
$q->where('destination.foreign_amount', '>=', app('steam')->positive($amount));
|
||||
}
|
||||
|
@@ -495,10 +495,10 @@ trait AttachmentCollection
|
||||
app('log')->debug('Add filter on no attachments.');
|
||||
$this->joinAttachmentTables();
|
||||
|
||||
$this->query->where(static function (Builder $q1) { // @phpstan-ignore-line
|
||||
$this->query->where(static function (Builder $q1): void { // @phpstan-ignore-line
|
||||
$q1
|
||||
->whereNull('attachments.attachable_id')
|
||||
->orWhere(static function (Builder $q2) {
|
||||
->orWhere(static function (Builder $q2): void {
|
||||
$q2
|
||||
->whereNotNull('attachments.attachable_id')
|
||||
->whereNotNull('attachments.deleted_at')
|
||||
@@ -522,7 +522,7 @@ trait AttachmentCollection
|
||||
$this->hasJoinedAttTables = true;
|
||||
$this->query->leftJoin('attachments', 'attachments.attachable_id', '=', 'transaction_journals.id')
|
||||
->where(
|
||||
static function (EloquentBuilder $q1) { // @phpstan-ignore-line
|
||||
static function (EloquentBuilder $q1): void { // @phpstan-ignore-line
|
||||
$q1->where('attachments.attachable_type', TransactionJournal::class);
|
||||
$q1->where('attachments.uploaded', true);
|
||||
$q1->whereNull('attachments.deleted_at');
|
||||
|
@@ -42,7 +42,7 @@ trait MetaCollection
|
||||
public function excludeBills(Collection $bills): GroupCollectorInterface
|
||||
{
|
||||
$this->withBillInformation();
|
||||
$this->query->where(static function (EloquentBuilder $q1) use ($bills) { // @phpstan-ignore-line
|
||||
$this->query->where(static function (EloquentBuilder $q1) use ($bills): void { // @phpstan-ignore-line
|
||||
$q1->whereNotIn('transaction_journals.bill_id', $bills->pluck('id')->toArray());
|
||||
$q1->orWhereNull('transaction_journals.bill_id');
|
||||
});
|
||||
@@ -74,7 +74,7 @@ trait MetaCollection
|
||||
{
|
||||
$this->withBudgetInformation();
|
||||
|
||||
$this->query->where(static function (EloquentBuilder $q2) use ($budget) { // @phpstan-ignore-line
|
||||
$this->query->where(static function (EloquentBuilder $q2) use ($budget): void { // @phpstan-ignore-line
|
||||
$q2->where('budgets.id', '!=', $budget->id);
|
||||
$q2->orWhereNull('budgets.id');
|
||||
});
|
||||
@@ -105,7 +105,7 @@ trait MetaCollection
|
||||
{
|
||||
if ($budgets->count() > 0) {
|
||||
$this->withBudgetInformation();
|
||||
$this->query->where(static function (EloquentBuilder $q1) use ($budgets) { // @phpstan-ignore-line
|
||||
$this->query->where(static function (EloquentBuilder $q1) use ($budgets): void { // @phpstan-ignore-line
|
||||
$q1->whereNotIn('budgets.id', $budgets->pluck('id')->toArray());
|
||||
$q1->orWhereNull('budgets.id');
|
||||
});
|
||||
@@ -118,7 +118,7 @@ trait MetaCollection
|
||||
{
|
||||
if ($categories->count() > 0) {
|
||||
$this->withCategoryInformation();
|
||||
$this->query->where(static function (EloquentBuilder $q1) use ($categories) { // @phpstan-ignore-line
|
||||
$this->query->where(static function (EloquentBuilder $q1) use ($categories): void { // @phpstan-ignore-line
|
||||
$q1->whereNotIn('categories.id', $categories->pluck('id')->toArray());
|
||||
$q1->orWhereNull('categories.id');
|
||||
});
|
||||
@@ -153,7 +153,7 @@ trait MetaCollection
|
||||
{
|
||||
$this->withCategoryInformation();
|
||||
|
||||
$this->query->where(static function (EloquentBuilder $q2) use ($category) { // @phpstan-ignore-line
|
||||
$this->query->where(static function (EloquentBuilder $q2) use ($category): void { // @phpstan-ignore-line
|
||||
$q2->where('categories.id', '!=', $category->id);
|
||||
$q2->orWhereNull('categories.id');
|
||||
});
|
||||
@@ -456,7 +456,7 @@ trait MetaCollection
|
||||
// join bill table
|
||||
$this->query->leftJoin(
|
||||
'notes',
|
||||
static function (JoinClause $join) {
|
||||
static function (JoinClause $join): void {
|
||||
$join->on('notes.noteable_id', '=', 'transaction_journals.id');
|
||||
$join->where('notes.noteable_type', '=', 'FireflyIII\Models\TransactionJournal');
|
||||
$join->whereNull('notes.deleted_at');
|
||||
@@ -473,7 +473,7 @@ trait MetaCollection
|
||||
public function notesDoNotContain(string $value): GroupCollectorInterface
|
||||
{
|
||||
$this->withNotes();
|
||||
$this->query->where(static function (Builder $q) use ($value) { // @phpstan-ignore-line
|
||||
$this->query->where(static function (Builder $q) use ($value): void { // @phpstan-ignore-line
|
||||
$q->whereNull('notes.text');
|
||||
$q->orWhere('notes.text', 'NOT LIKE', sprintf('%%%s%%', $value));
|
||||
});
|
||||
@@ -484,7 +484,7 @@ trait MetaCollection
|
||||
public function notesDontEndWith(string $value): GroupCollectorInterface
|
||||
{
|
||||
$this->withNotes();
|
||||
$this->query->where(static function (Builder $q) use ($value) { // @phpstan-ignore-line
|
||||
$this->query->where(static function (Builder $q) use ($value): void { // @phpstan-ignore-line
|
||||
$q->whereNull('notes.text');
|
||||
$q->orWhere('notes.text', 'NOT LIKE', sprintf('%%%s', $value));
|
||||
});
|
||||
@@ -495,7 +495,7 @@ trait MetaCollection
|
||||
public function notesDontStartWith(string $value): GroupCollectorInterface
|
||||
{
|
||||
$this->withNotes();
|
||||
$this->query->where(static function (Builder $q) use ($value) { // @phpstan-ignore-line
|
||||
$this->query->where(static function (Builder $q) use ($value): void { // @phpstan-ignore-line
|
||||
$q->whereNull('notes.text');
|
||||
$q->orWhere('notes.text', 'NOT LIKE', sprintf('%s%%', $value));
|
||||
});
|
||||
@@ -522,7 +522,7 @@ trait MetaCollection
|
||||
public function notesExactlyNot(string $value): GroupCollectorInterface
|
||||
{
|
||||
$this->withNotes();
|
||||
$this->query->where(static function (Builder $q) use ($value) { // @phpstan-ignore-line
|
||||
$this->query->where(static function (Builder $q) use ($value): void { // @phpstan-ignore-line
|
||||
$q->whereNull('notes.text');
|
||||
$q->orWhere('notes.text', '!=', sprintf('%s', $value));
|
||||
});
|
||||
@@ -801,13 +801,13 @@ trait MetaCollection
|
||||
{
|
||||
$this->joinMetaDataTables();
|
||||
// TODO not sure if this will work properly.
|
||||
$this->query->where(static function (Builder $q1) { // @phpstan-ignore-line
|
||||
$q1->where(static function (Builder $q2) {
|
||||
$this->query->where(static function (Builder $q1): void { // @phpstan-ignore-line
|
||||
$q1->where(static function (Builder $q2): void {
|
||||
$q2->where('journal_meta.name', '=', 'external_id');
|
||||
$q2->whereNull('journal_meta.data');
|
||||
})->orWhere(static function (Builder $q3) {
|
||||
})->orWhere(static function (Builder $q3): void {
|
||||
$q3->where('journal_meta.name', '!=', 'external_id');
|
||||
})->orWhere(static function (Builder $q4) {
|
||||
})->orWhere(static function (Builder $q4): void {
|
||||
$q4->whereNull('journal_meta.name');
|
||||
});
|
||||
});
|
||||
@@ -819,13 +819,13 @@ trait MetaCollection
|
||||
{
|
||||
$this->joinMetaDataTables();
|
||||
// TODO not sure if this will work properly.
|
||||
$this->query->where(static function (Builder $q1) { // @phpstan-ignore-line
|
||||
$q1->where(static function (Builder $q2) {
|
||||
$this->query->where(static function (Builder $q1): void { // @phpstan-ignore-line
|
||||
$q1->where(static function (Builder $q2): void {
|
||||
$q2->where('journal_meta.name', '=', 'external_url');
|
||||
$q2->whereNull('journal_meta.data');
|
||||
})->orWhere(static function (Builder $q3) {
|
||||
})->orWhere(static function (Builder $q3): void {
|
||||
$q3->where('journal_meta.name', '!=', 'external_url');
|
||||
})->orWhere(static function (Builder $q4) {
|
||||
})->orWhere(static function (Builder $q4): void {
|
||||
$q4->whereNull('journal_meta.name');
|
||||
});
|
||||
});
|
||||
@@ -836,7 +836,7 @@ trait MetaCollection
|
||||
public function withoutNotes(): GroupCollectorInterface
|
||||
{
|
||||
$this->withNotes();
|
||||
$this->query->where(static function (Builder $q) { // @phpstan-ignore-line
|
||||
$this->query->where(static function (Builder $q): void { // @phpstan-ignore-line
|
||||
$q->whereNull('notes.text');
|
||||
$q->orWhere('notes.text', '');
|
||||
});
|
||||
|
Reference in New Issue
Block a user