Fix various phpstan issues.

This commit is contained in:
James Cole
2023-11-04 11:31:14 +01:00
parent ef428a0226
commit 0220cf9784
64 changed files with 195 additions and 153 deletions

View File

@@ -239,7 +239,7 @@ class ForceDecimalSize extends Command
$query->where(static function (Builder $q) use ($fields, $currency, $operator, $cast, $regularExpression) {
foreach ($fields as $field) {
$q->orWhere(
DB::raw(sprintf('CAST(accounts.%s AS %s)', $field, $cast)),
DB::raw(sprintf('CAST(accounts.%s AS %s)', $field, $cast)), // @phpstan-ignore-line
$operator,
DB::raw(sprintf($regularExpression, $currency->decimal_places))
);
@@ -288,7 +288,7 @@ class ForceDecimalSize extends Command
static function (Builder $q) use ($fields, $currency, $operator, $cast, $regularExpression) {
foreach ($fields as $field) {
$q->orWhere(
DB::raw(sprintf('CAST(%s AS %s)', $field, $cast)),
DB::raw(sprintf('CAST(%s AS %s)', $field, $cast)), // @phpstan-ignore-line
$operator,
DB::raw(sprintf($regularExpression, $currency->decimal_places))
);
@@ -341,7 +341,7 @@ class ForceDecimalSize extends Command
->where(static function (Builder $q) use ($fields, $currency, $cast, $operator, $regularExpression) {
foreach ($fields as $field) {
$q->orWhere(
DB::raw(sprintf('CAST(piggy_bank_events.%s AS %s)', $field, $cast)),
DB::raw(sprintf('CAST(piggy_bank_events.%s AS %s)', $field, $cast)), // @phpstan-ignore-line
$operator,
DB::raw(sprintf($regularExpression, $currency->decimal_places))
);
@@ -395,7 +395,7 @@ class ForceDecimalSize extends Command
->where(static function (Builder $q) use ($fields, $currency, $operator, $cast, $regularExpression) {
foreach ($fields as $field) {
$q->orWhere(
DB::raw(sprintf('CAST(piggy_bank_repetitions.%s AS %s)', $field, $cast)),
DB::raw(sprintf('CAST(piggy_bank_repetitions.%s AS %s)', $field, $cast)), // @phpstan-ignore-line
$operator,
DB::raw(sprintf($regularExpression, $currency->decimal_places))
);
@@ -448,7 +448,7 @@ class ForceDecimalSize extends Command
->where(static function (Builder $q) use ($fields, $currency, $operator, $cast, $regularExpression) {
foreach ($fields as $field) {
$q->orWhere(
DB::raw(sprintf('CAST(piggy_banks.%s AS %s)', $field, $cast)),
DB::raw(sprintf('CAST(piggy_banks.%s AS %s)', $field, $cast)), // @phpstan-ignore-line
$operator,
DB::raw(sprintf($regularExpression, $currency->decimal_places))
);
@@ -489,7 +489,7 @@ class ForceDecimalSize extends Command
// select all transactions with this currency and issue.
/** @var Builder $query */
$query = Transaction::where('transaction_currency_id', $currency->id)->where(
DB::raw(sprintf('CAST(amount as %s)', $this->cast)),
DB::raw(sprintf('CAST(amount as %s)', $this->cast)), // @phpstan-ignore-line
$this->operator,
DB::raw(sprintf($this->regularExpression, $currency->decimal_places))
);
@@ -515,7 +515,7 @@ class ForceDecimalSize extends Command
// select all transactions with this FOREIGN currency and issue.
/** @var Builder $query */
$query = Transaction::where('foreign_currency_id', $currency->id)->where(
DB::raw(sprintf('CAST(foreign_amount as %s)', $this->cast)),
DB::raw(sprintf('CAST(foreign_amount as %s)', $this->cast)), // @phpstan-ignore-line
$this->operator,
DB::raw(sprintf($this->regularExpression, $currency->decimal_places))
);

View File

@@ -98,7 +98,7 @@ class AppendBudgetLimitPeriods extends Command
/**
* @param BudgetLimit $limit
*/
private function fixLimit(BudgetLimit $limit)
private function fixLimit(BudgetLimit $limit): void
{
$period = $this->getLimitPeriod($limit);

View File

@@ -56,16 +56,12 @@ class MigrateToRules extends Command
*
* @var string
*/
protected $signature = 'firefly-iii:bills-to-rules {--F|force : Force the execution of this command.}';
/** @var BillRepositoryInterface */
private $billRepository;
private $count;
/** @var RuleGroupRepositoryInterface */
private $ruleGroupRepository;
/** @var RuleRepositoryInterface */
private $ruleRepository;
/** @var UserRepositoryInterface */
private $userRepository;
protected $signature = 'firefly-iii:bills-to-rules {--F|force : Force the execution of this command.}';
private BillRepositoryInterface $billRepository;
private int $count;
private RuleGroupRepositoryInterface $ruleGroupRepository;
private RuleRepositoryInterface $ruleRepository;
private UserRepositoryInterface $userRepository;
/**
* Execute the console command.

View File

@@ -219,11 +219,11 @@ class UpgradeLiabilitiesEight extends Command
}
/**
* @param $account
* @param Account $account
*
* @return int
*/
private function deleteTransactions($account): int
private function deleteTransactions(Account $account): int
{
$count = 0;
$journals = TransactionJournal::leftJoin('transactions', 'transaction_journals.id', '=', 'transactions.transaction_journal_id')