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

@@ -103,7 +103,7 @@ abstract class Controller extends BaseController
$obj = Carbon::parse($date);
} catch (InvalidDateException | InvalidFormatException $e) {
// don't care
Log::warning(sprintf('Ignored invalid date "%s" in API controller parameter check: %s', $date, $e->getMessage()));
app('log')->warning(sprintf('Ignored invalid date "%s" in API controller parameter check: %s', $date, $e->getMessage()));
}
}
$bag->set($field, $obj);

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()]);