Refactor validate function

This commit is contained in:
brufdev
2025-08-30 13:56:35 +01:00
parent 1c1063da28
commit 219c66eed6
+4 -7
View File
@@ -45,12 +45,9 @@ final class VaultFile
*/
public static function validate(string $extension, string $mimeType): bool
{
foreach (self::$fileTypes as $type) {
if ($type::validate($extension, $mimeType)) {
return true;
}
}
return false;
return array_any(
self::$fileTypes,
fn(string $typeClass): bool => $typeClass::validate($extension, $mimeType),
);
}
}