Fix various phpstan issues.

This commit is contained in:
James Cole
2023-11-04 07:18:03 +01:00
parent dc45131f73
commit ef428a0226
42 changed files with 104 additions and 174 deletions

View File

@@ -54,12 +54,12 @@ class IsDateOrTime implements ValidationRule
// probably a date format.
try {
Carbon::createFromFormat('Y-m-d', $value);
} catch (InvalidDateException $e) {
} catch (InvalidDateException $e) { // @phpstan-ignore-line
app('log')->error(sprintf('"%s" is not a valid date: %s', $value, $e->getMessage()));
$fail('validation.date_or_time')->translate();;
return;
} catch (InvalidFormatException $e) {
} catch (InvalidFormatException $e) { // @phpstan-ignore-line
app('log')->error(sprintf('"%s" is of an invalid format: %s', $value, $e->getMessage()));
$fail('validation.date_or_time')->translate();;
@@ -71,7 +71,7 @@ class IsDateOrTime implements ValidationRule
// is an atom string, I hope?
try {
Carbon::parse($value);
} catch (InvalidDateException $e) {
} catch (InvalidDateException $e) { // @phpstan-ignore-line
app('log')->error(sprintf('"%s" is not a valid date or time: %s', $value, $e->getMessage()));
$fail('validation.date_or_time')->translate();;