mirror of
https://github.com/brufdev/many-notes.git
synced 2026-05-24 20:28:47 -05:00
Refactor validate function
This commit is contained in:
@@ -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),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user