Replace phpstan suggestions

This commit is contained in:
James Cole
2022-10-30 14:44:49 +01:00
parent c032ffd4f9
commit 33f370359c
45 changed files with 99 additions and 87 deletions

View File

@@ -93,14 +93,14 @@ class StoreController extends Controller
try {
$transactionGroup = $this->groupRepository->store($data);
} catch (DuplicateTransactionException $e) {
Log::warning('Caught a duplicate transaction. Return error message.');
app('log')->warning('Caught a duplicate transaction. Return error message.');
$validator = Validator::make(
['transactions' => [['description' => $e->getMessage()]]],
['transactions.0.description' => new IsDuplicateTransaction()]
);
throw new ValidationException($validator, 0, $e);
} catch (FireflyException $e) {
Log::warning('Caught an exception. Return error message.');
app('log')->warning('Caught an exception. Return error message.');
Log::error($e->getMessage());
$message = sprintf('Internal exception: %s', $e->getMessage());
$validator = Validator::make(['transactions' => [['description' => $message]]], ['transactions.0.description' => new IsDuplicateTransaction()]);