From bc2612862075556ec633e24017673ae3bb58f482 Mon Sep 17 00:00:00 2001 From: Steve Boyd Date: Wed, 2 Oct 2024 16:01:43 +1300 Subject: [PATCH] API Update validation methods --- src/File.php | 7 ++----- src/Storage/DBFile.php | 4 ++-- 2 files changed, 4 insertions(+), 7 deletions(-) diff --git a/src/File.php b/src/File.php index 03fca21b..53583b8f 100644 --- a/src/File.php +++ b/src/File.php @@ -1174,13 +1174,10 @@ public function getAbsoluteSize() return $this->File->getAbsoluteSize(); } - /** - * @return ValidationResult - */ - public function validate() + public function validate(): ValidationResult { $result = ValidationResult::create(); - $this->File->validate($result, $this->Name); + $this->File->validateFilename($result, $this->Name); $this->extend('updateValidate', $result); return $result; } diff --git a/src/Storage/DBFile.php b/src/Storage/DBFile.php index 26d758a4..335c8bf1 100644 --- a/src/Storage/DBFile.php +++ b/src/Storage/DBFile.php @@ -454,7 +454,7 @@ protected function isValidFilename(string $filename): bool protected function assertFilenameValid(string $filename): void { $result = new ValidationResult(); - $this->validate($result, $filename); + $this->validateFilename($result, $filename); if (!$result->isValid()) { throw new ValidationException($result); } @@ -466,7 +466,7 @@ protected function assertFilenameValid(string $filename): void * * @param null|string $filename Optional filename to validate. If omitted, the current value is validated. */ - public function validate(ValidationResult $result, ?string $filename = null): bool + public function validateFilename(ValidationResult $result, ?string $filename = null): bool { if (empty($filename)) { $filename = $this->getFilename();