mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-09-18 18:44:16 +00:00
Clean up and fix phpstan issues.
This commit is contained in:
@@ -7,21 +7,19 @@ parameters:
|
|||||||
- ../bootstrap/app.php
|
- ../bootstrap/app.php
|
||||||
universalObjectCratesClasses:
|
universalObjectCratesClasses:
|
||||||
- Illuminate\Database\Eloquent\Model
|
- Illuminate\Database\Eloquent\Model
|
||||||
# TODO: slowly remove these parameters and fix the issues found.
|
|
||||||
reportUnmatchedIgnoredErrors: true
|
reportUnmatchedIgnoredErrors: true
|
||||||
ignoreErrors:
|
ignoreErrors:
|
||||||
# TODO: slowly remove these exceptions and fix the issues found.
|
# all errors below I will never fix.
|
||||||
- identifier: varTag.type
|
- '#expects view-string\|null, string given#'
|
||||||
|
- '#expects view-string, string given#'
|
||||||
|
- "#Parameter \\#[1-2] \\$num[1-2] of function bc[a-z]+ expects numeric-string, [a-z\\-|&]+ given#"
|
||||||
|
- identifier: missingType.generics # not interesting enough to fix.
|
||||||
-
|
-
|
||||||
identifier: larastan.noEnvCallsOutsideOfConfig
|
identifier: larastan.noEnvCallsOutsideOfConfig
|
||||||
path: ../app/Console/Commands/System/CreatesDatabase.php
|
path: ../app/Console/Commands/System/CreatesDatabase.php
|
||||||
- identifier: missingType.iterableValue # not interesting enough to fix.
|
- identifier: missingType.iterableValue # not interesting enough to fix.
|
||||||
- identifier: missingType.generics # not interesting enough to fix.
|
- identifier: varTag.type # needs a custom extension for every repository, not gonna happen.
|
||||||
- "#Parameter \\#[1-2] \\$num[1-2] of function bc[a-z]+ expects numeric-string, [a-z\\-|&]+ given#"
|
- '#Dynamic call to static method Illuminate#'
|
||||||
- '#expects view-string, string given#'
|
|
||||||
- '#expects view-string\|null, string given#'
|
|
||||||
|
|
||||||
# phpstan can't handle this so we ignore them.
|
|
||||||
- '#Call to an undefined method Illuminate\\Database\\Eloquent\\Relations\\HasMany::before#' # is custom scope
|
- '#Call to an undefined method Illuminate\\Database\\Eloquent\\Relations\\HasMany::before#' # is custom scope
|
||||||
- '#Call to an undefined method Illuminate\\Database\\Eloquent\\Relations\\HasMany::after#' # is custom scope
|
- '#Call to an undefined method Illuminate\\Database\\Eloquent\\Relations\\HasMany::after#' # is custom scope
|
||||||
- '#Call to an undefined method Illuminate\\Database\\Eloquent\\Relations\\HasMany::withTrashed#' # is to allow soft delete
|
- '#Call to an undefined method Illuminate\\Database\\Eloquent\\Relations\\HasMany::withTrashed#' # is to allow soft delete
|
||||||
@@ -30,5 +28,5 @@ parameters:
|
|||||||
|
|
||||||
# The level 8 is the highest level. original was 5
|
# The level 8 is the highest level. original was 5
|
||||||
# 7 is more than enough, higher just leaves NULL things.
|
# 7 is more than enough, higher just leaves NULL things.
|
||||||
level: 7
|
level: 8
|
||||||
|
|
||||||
|
@@ -250,7 +250,9 @@ class BudgetController extends Controller
|
|||||||
// var_dump($return);
|
// var_dump($return);
|
||||||
/** @var array $journal */
|
/** @var array $journal */
|
||||||
foreach ($currentBudgetArray['transaction_journals'] as $journal) {
|
foreach ($currentBudgetArray['transaction_journals'] as $journal) {
|
||||||
$return[$currencyId]['spent'] = bcadd($return[$currencyId]['spent'], (string)$journal['amount']);
|
/** @var numeric-string $amount */
|
||||||
|
$amount= (string)$journal['amount'];
|
||||||
|
$return[$currencyId]['spent'] = bcadd($return[$currencyId]['spent'], $amount);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -35,6 +35,9 @@ class StoreByDateRequest extends FormRequest
|
|||||||
use ChecksLogin;
|
use ChecksLogin;
|
||||||
use ConvertsDataTypes;
|
use ConvertsDataTypes;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return array<string, mixed>
|
||||||
|
*/
|
||||||
public function getAll(): array
|
public function getAll(): array
|
||||||
{
|
{
|
||||||
return [
|
return [
|
||||||
@@ -50,6 +53,7 @@ class StoreByDateRequest extends FormRequest
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* The rules that the incoming request must be matched against.
|
* The rules that the incoming request must be matched against.
|
||||||
|
* @return array<string, string>
|
||||||
*/
|
*/
|
||||||
public function rules(): array
|
public function rules(): array
|
||||||
{
|
{
|
||||||
|
@@ -26,6 +26,7 @@ namespace FireflyIII\Helpers\Collector;
|
|||||||
|
|
||||||
use Carbon\Carbon;
|
use Carbon\Carbon;
|
||||||
use Carbon\Exceptions\InvalidFormatException;
|
use Carbon\Exceptions\InvalidFormatException;
|
||||||
|
use Closure;
|
||||||
use Exception;
|
use Exception;
|
||||||
use FireflyIII\Enums\TransactionTypeEnum;
|
use FireflyIII\Enums\TransactionTypeEnum;
|
||||||
use FireflyIII\Exceptions\FireflyException;
|
use FireflyIII\Exceptions\FireflyException;
|
||||||
@@ -45,9 +46,7 @@ use Illuminate\Database\Query\JoinClause;
|
|||||||
use Illuminate\Pagination\LengthAwarePaginator;
|
use Illuminate\Pagination\LengthAwarePaginator;
|
||||||
use Illuminate\Support\Collection;
|
use Illuminate\Support\Collection;
|
||||||
use Illuminate\Support\Facades\Log;
|
use Illuminate\Support\Facades\Log;
|
||||||
use Closure;
|
|
||||||
use Override;
|
use Override;
|
||||||
|
|
||||||
use function Safe\json_decode;
|
use function Safe\json_decode;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -1075,8 +1074,7 @@ class GroupCollector implements GroupCollectorInterface
|
|||||||
'transactions as source',
|
'transactions as source',
|
||||||
static function (JoinClause $join): void {
|
static function (JoinClause $join): void {
|
||||||
$join->on('source.transaction_journal_id', '=', 'transaction_journals.id')
|
$join->on('source.transaction_journal_id', '=', 'transaction_journals.id')
|
||||||
->where('source.amount', '<', 0)
|
->where('source.amount', '<', 0);
|
||||||
;
|
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
// join destination transaction
|
// join destination transaction
|
||||||
@@ -1084,8 +1082,7 @@ class GroupCollector implements GroupCollectorInterface
|
|||||||
'transactions as destination',
|
'transactions as destination',
|
||||||
static function (JoinClause $join): void {
|
static function (JoinClause $join): void {
|
||||||
$join->on('destination.transaction_journal_id', '=', 'transaction_journals.id')
|
$join->on('destination.transaction_journal_id', '=', 'transaction_journals.id')
|
||||||
->where('destination.amount', '>', 0)
|
->where('destination.amount', '>', 0);
|
||||||
;
|
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
// left join transaction type.
|
// left join transaction type.
|
||||||
@@ -1098,15 +1095,13 @@ class GroupCollector implements GroupCollectorInterface
|
|||||||
|
|
||||||
// #10507 ignore opening balance.
|
// #10507 ignore opening balance.
|
||||||
->where('transaction_types.type', '!=', TransactionTypeEnum::OPENING_BALANCE->value)
|
->where('transaction_types.type', '!=', TransactionTypeEnum::OPENING_BALANCE->value)
|
||||||
|
|
||||||
->whereNotNull('transaction_groups.id')
|
->whereNotNull('transaction_groups.id')
|
||||||
->whereNull('destination.deleted_at')
|
->whereNull('destination.deleted_at')
|
||||||
->orderBy('transaction_journals.date', 'DESC')
|
->orderBy('transaction_journals.date', 'DESC')
|
||||||
->orderBy('transaction_journals.order', 'ASC')
|
->orderBy('transaction_journals.order', 'ASC')
|
||||||
->orderBy('transaction_journals.id', 'DESC')
|
->orderBy('transaction_journals.id', 'DESC')
|
||||||
->orderBy('transaction_journals.description', 'DESC')
|
->orderBy('transaction_journals.description', 'DESC')
|
||||||
->orderBy('source.amount', 'DESC')
|
->orderBy('source.amount', 'DESC');
|
||||||
;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -1137,8 +1132,7 @@ class GroupCollector implements GroupCollectorInterface
|
|||||||
'transactions as source',
|
'transactions as source',
|
||||||
static function (JoinClause $join): void {
|
static function (JoinClause $join): void {
|
||||||
$join->on('source.transaction_journal_id', '=', 'transaction_journals.id')
|
$join->on('source.transaction_journal_id', '=', 'transaction_journals.id')
|
||||||
->where('source.amount', '<', 0)
|
->where('source.amount', '<', 0);
|
||||||
;
|
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
// join destination transaction
|
// join destination transaction
|
||||||
@@ -1146,8 +1140,7 @@ class GroupCollector implements GroupCollectorInterface
|
|||||||
'transactions as destination',
|
'transactions as destination',
|
||||||
static function (JoinClause $join): void {
|
static function (JoinClause $join): void {
|
||||||
$join->on('destination.transaction_journal_id', '=', 'transaction_journals.id')
|
$join->on('destination.transaction_journal_id', '=', 'transaction_journals.id')
|
||||||
->where('destination.amount', '>', 0)
|
->where('destination.amount', '>', 0);
|
||||||
;
|
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
// left join transaction type.
|
// left join transaction type.
|
||||||
@@ -1162,8 +1155,7 @@ class GroupCollector implements GroupCollectorInterface
|
|||||||
->orderBy('transaction_journals.order', 'ASC')
|
->orderBy('transaction_journals.order', 'ASC')
|
||||||
->orderBy('transaction_journals.id', 'DESC')
|
->orderBy('transaction_journals.id', 'DESC')
|
||||||
->orderBy('transaction_journals.description', 'DESC')
|
->orderBy('transaction_journals.description', 'DESC')
|
||||||
->orderBy('source.amount', 'DESC')
|
->orderBy('source.amount', 'DESC');
|
||||||
;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -1178,9 +1170,9 @@ class GroupCollector implements GroupCollectorInterface
|
|||||||
// include budget ID + name (if any)
|
// include budget ID + name (if any)
|
||||||
->withBudgetInformation()
|
->withBudgetInformation()
|
||||||
// include bill ID + name (if any)
|
// include bill ID + name (if any)
|
||||||
->withBillInformation()
|
->withBillInformation();
|
||||||
;
|
|
||||||
|
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user