mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2026-01-07 06:31:22 +00:00
Replace phpstan suggestions
This commit is contained in:
@@ -61,7 +61,7 @@ trait ReconciliationValidation
|
||||
$search = $this->findExistingAccount($validTypes, $array);
|
||||
if (null === $search) {
|
||||
$this->sourceError = (string) trans('validation.reconciliation_source_bad_data', ['id' => $accountId, 'name' => $accountName]);
|
||||
Log::warning('Not a valid source. Cant find it.', $validTypes);
|
||||
app('log')->warning('Not a valid source. Cant find it.', $validTypes);
|
||||
|
||||
return false;
|
||||
}
|
||||
@@ -98,7 +98,7 @@ trait ReconciliationValidation
|
||||
$search = $this->findExistingAccount($validTypes, $array);
|
||||
if (null === $search) {
|
||||
$this->sourceError = (string) trans('validation.reconciliation_source_bad_data', ['id' => $accountId, 'name' => $accountName]);
|
||||
Log::warning('Not a valid source. Cant find it.', $validTypes);
|
||||
app('log')->warning('Not a valid source. Cant find it.', $validTypes);
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -103,7 +103,7 @@ trait TransferValidation
|
||||
// if both values are NULL we return false,
|
||||
// because the source of a withdrawal can't be created.
|
||||
$this->sourceError = (string) trans('validation.transfer_source_need_data');
|
||||
Log::warning('Not a valid source, need more data.');
|
||||
app('log')->warning('Not a valid source, need more data.');
|
||||
|
||||
return false;
|
||||
}
|
||||
@@ -112,7 +112,7 @@ trait TransferValidation
|
||||
$search = $this->findExistingAccount($validTypes, $array);
|
||||
if (null === $search) {
|
||||
$this->sourceError = (string) trans('validation.transfer_source_bad_data', ['id' => $accountId, 'name' => $accountName]);
|
||||
Log::warning('Not a valid source, cant find it.', $validTypes);
|
||||
app('log')->warning('Not a valid source, cant find it.', $validTypes);
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -63,7 +63,7 @@ trait WithdrawalValidation
|
||||
// if both values are NULL we return TRUE
|
||||
// because we assume the user doesnt want to submit / change anything.
|
||||
$this->sourceError = (string) trans('validation.withdrawal_source_need_data');
|
||||
Log::warning('[a] Not a valid source. Need more data.');
|
||||
app('log')->warning('[a] Not a valid source. Need more data.');
|
||||
|
||||
return false;
|
||||
}
|
||||
@@ -72,7 +72,7 @@ trait WithdrawalValidation
|
||||
$search = $this->findExistingAccount($validTypes, $array);
|
||||
if (null === $search) {
|
||||
$this->sourceError = (string) trans('validation.withdrawal_source_bad_data', ['id' => $accountId, 'name' => $accountName]);
|
||||
Log::warning('Not a valid source. Cant find it.', $validTypes);
|
||||
app('log')->warning('Not a valid source. Cant find it.', $validTypes);
|
||||
|
||||
return false;
|
||||
}
|
||||
@@ -137,7 +137,7 @@ trait WithdrawalValidation
|
||||
// if both values are NULL we return false,
|
||||
// because the source of a withdrawal can't be created.
|
||||
$this->sourceError = (string) trans('validation.withdrawal_source_need_data');
|
||||
Log::warning('[b] Not a valid source. Need more data.');
|
||||
app('log')->warning('[b] Not a valid source. Need more data.');
|
||||
|
||||
return false;
|
||||
}
|
||||
@@ -146,7 +146,7 @@ trait WithdrawalValidation
|
||||
$search = $this->findExistingAccount($validTypes, $array);
|
||||
if (null === $search) {
|
||||
$this->sourceError = (string) trans('validation.withdrawal_source_bad_data', ['id' => $accountId, 'name' => $accountName]);
|
||||
Log::warning('Not a valid source. Cant find it.', $validTypes);
|
||||
app('log')->warning('Not a valid source. Cant find it.', $validTypes);
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -609,7 +609,7 @@ class FireflyValidator extends Validator
|
||||
}
|
||||
$type = $this->data['objectType'] ?? 'unknown';
|
||||
if ('expense' !== $type && 'revenue' !== $type) {
|
||||
Log::warning(sprintf('Account number "%s" is not unique and account type "%s" cannot share its account number.', $value, $type));
|
||||
app('log')->warning(sprintf('Account number "%s" is not unique and account type "%s" cannot share its account number.', $value, $type));
|
||||
return false;
|
||||
}
|
||||
Log::debug(sprintf('Account number "%s" is not unique but account type "%s" may share its account number.', $value, $type));
|
||||
|
||||
@@ -167,8 +167,8 @@ trait GroupValidation
|
||||
}
|
||||
$count = $transactionGroup->transactionJournals()->where('transaction_journals.id', $journalId)->count();
|
||||
if (null === $journalId || 0 === $count) {
|
||||
Log::warning(sprintf('Transaction group #%d has %d journals with ID %d', $transactionGroup->id, $count, $journalId));
|
||||
Log::warning('Invalid submission: Each split must have transaction_journal_id (either valid ID or 0).');
|
||||
app('log')->warning(sprintf('Transaction group #%d has %d journals with ID %d', $transactionGroup->id, $count, $journalId));
|
||||
app('log')->warning('Invalid submission: Each split must have transaction_journal_id (either valid ID or 0).');
|
||||
$validator->errors()->add(sprintf('transactions.%d.source_name', $index), (string) trans('validation.need_id_in_edit'));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -66,7 +66,7 @@ trait RecurrenceValidation
|
||||
Log::debug(sprintf('Determined type to be %s.', $transactionType));
|
||||
}
|
||||
if (null === $first) {
|
||||
Log::warning('Just going to assume type is a withdrawal.');
|
||||
app('log')->warning('Just going to assume type is a withdrawal.');
|
||||
$transactionType = 'withdrawal';
|
||||
}
|
||||
}
|
||||
|
||||
@@ -230,7 +230,7 @@ trait TransactionValidation
|
||||
|
||||
// do something with result:
|
||||
if (false === $validSource) {
|
||||
Log::warning('Looks like the source account is not valid so complain to the user about it.');
|
||||
app('log')->warning('Looks like the source account is not valid so complain to the user about it.');
|
||||
$validator->errors()->add(sprintf('transactions.%d.source_id', $index), $accountValidator->sourceError);
|
||||
$validator->errors()->add(sprintf('transactions.%d.source_name', $index), $accountValidator->sourceError);
|
||||
|
||||
@@ -258,7 +258,7 @@ trait TransactionValidation
|
||||
$validDestination = $accountValidator->validateDestination($array);
|
||||
// do something with result:
|
||||
if (false === $validDestination) {
|
||||
Log::warning('Looks like the destination account is not valid so complain to the user about it.');
|
||||
app('log')->warning('Looks like the destination account is not valid so complain to the user about it.');
|
||||
$validator->errors()->add(sprintf('transactions.%d.destination_id', $index), $accountValidator->destError);
|
||||
$validator->errors()->add(sprintf('transactions.%d.destination_name', $index), $accountValidator->destError);
|
||||
}
|
||||
@@ -395,7 +395,7 @@ trait TransactionValidation
|
||||
}
|
||||
$unique = array_unique($types);
|
||||
if (count($unique) > 1) {
|
||||
Log::warning('Add error for mismatch transaction types.');
|
||||
app('log')->warning('Add error for mismatch transaction types.');
|
||||
$validator->errors()->add('transactions.0.type', (string) trans('validation.transaction_types_equal'));
|
||||
|
||||
return;
|
||||
@@ -498,7 +498,7 @@ trait TransactionValidation
|
||||
$validator->errors()->add('transactions.0.source_id', (string) trans('validation.all_accounts_equal'));
|
||||
$validator->errors()->add('transactions.0.destination_id', (string) trans('validation.all_accounts_equal'));
|
||||
}
|
||||
Log::warning('Add error about equal accounts.');
|
||||
app('log')->warning('Add error about equal accounts.');
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user