Skip to content

Commit 8f3ba7a

Browse files
committed
fix(validation): satisfy Psalm for strict invalid input handling
Signed-off-by: memleakd <121398829+memleakd@users.noreply.github.com>
1 parent 7997dc5 commit 8f3ba7a

1 file changed

Lines changed: 8 additions & 8 deletions

File tree

system/Validation/ValidatedInput.php

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ public function date(
4343
}
4444

4545
if (! is_string($value) || $value === '') {
46-
return $this->invalidValue($key, 'date', null);
46+
$this->invalidValue($key, 'date', null);
4747
}
4848

4949
try {
@@ -53,7 +53,7 @@ public function date(
5353

5454
return Time::createFromFormat($format, $value, $timezone);
5555
} catch (Exception) {
56-
return $this->invalidValue($key, 'date', null);
56+
$this->invalidValue($key, 'date', null);
5757
}
5858
}
5959

@@ -76,7 +76,7 @@ public function enum(string $key, string $enumClass, ?UnitEnum $default = null):
7676
}
7777

7878
if ($default instanceof UnitEnum && ! $default instanceof $enumClass) {
79-
return $this->invalidValue($key, $enumClass, $default);
79+
$this->invalidValue($key, $enumClass, $default);
8080
}
8181

8282
$value = $this->get($key, $default);
@@ -90,7 +90,7 @@ public function enum(string $key, string $enumClass, ?UnitEnum $default = null):
9090
return $value;
9191
}
9292

93-
return $this->invalidValue($key, $enumClass, $default);
93+
$this->invalidValue($key, $enumClass, $default);
9494
}
9595

9696
$reflection = new ReflectionEnum($enumClass);
@@ -107,7 +107,7 @@ public function enum(string $key, string $enumClass, ?UnitEnum $default = null):
107107
}
108108
}
109109

110-
return $this->invalidValue($key, $enumClass, $default);
110+
$this->invalidValue($key, $enumClass, $default);
111111
}
112112

113113
private function backedEnum(string $key, string $enumClass, ReflectionEnum $reflection, mixed $value): UnitEnum
@@ -120,10 +120,10 @@ private function backedEnum(string $key, string $enumClass, ReflectionEnum $refl
120120
}
121121

122122
if (! is_int($value)) {
123-
return $this->invalidValue($key, $enumClass, null);
123+
$this->invalidValue($key, $enumClass, null);
124124
}
125125
} elseif (! is_int($value) && ! is_string($value)) {
126-
return $this->invalidValue($key, $enumClass, null);
126+
$this->invalidValue($key, $enumClass, null);
127127
}
128128

129129
if ($backingType === 'string') {
@@ -133,7 +133,7 @@ private function backedEnum(string $key, string $enumClass, ReflectionEnum $refl
133133
$enum = $enumClass::tryFrom($value);
134134

135135
if ($enum === null) {
136-
return $this->invalidValue($key, $enumClass, null);
136+
$this->invalidValue($key, $enumClass, null);
137137
}
138138

139139
return $enum;

0 commit comments

Comments
 (0)