mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-10-12 15:35:15 +00:00
Various code cleanup.
This commit is contained in:
@@ -26,7 +26,6 @@ namespace FireflyIII\Rules;
|
||||
|
||||
use Carbon\Carbon;
|
||||
use Carbon\Exceptions\InvalidDateException;
|
||||
use Exception;
|
||||
use Illuminate\Contracts\Validation\Rule;
|
||||
use Log;
|
||||
|
||||
@@ -65,7 +64,7 @@ class IsDateOrTime implements Rule
|
||||
// probably a date format.
|
||||
try {
|
||||
Carbon::createFromFormat('Y-m-d', $value);
|
||||
} catch (InvalidDateException | Exception $e) {
|
||||
} catch (InvalidDateException $e) {
|
||||
Log::error(sprintf('"%s" is not a valid date: %s', $value, $e->getMessage()));
|
||||
|
||||
return false;
|
||||
@@ -76,7 +75,7 @@ class IsDateOrTime implements Rule
|
||||
// is an atom string, I hope?
|
||||
try {
|
||||
Carbon::parse($value);
|
||||
} catch (InvalidDateException | Exception $e) {
|
||||
} catch (InvalidDateException $e) {
|
||||
Log::error(sprintf('"%s" is not a valid date or time: %s', $value, $e->getMessage()));
|
||||
|
||||
return false;
|
||||
|
@@ -110,7 +110,7 @@ class IsValidAttachmentModel implements Rule
|
||||
Transaction::class => 'validateTransaction',
|
||||
TransactionJournal::class => 'validateJournal',
|
||||
];
|
||||
if (!isset($methods[$this->model])) {
|
||||
if (!array_key_exists($this->model, $methods)) {
|
||||
Log::error(sprintf('Cannot validate model "%s" in %s.', $this->model, __METHOD__));
|
||||
|
||||
return false;
|
||||
|
Reference in New Issue
Block a user