From 027d4b35063de1dc2ab4e89d8a2c7832b7ceb371 Mon Sep 17 00:00:00 2001 From: Joshua Ramon Enslin Date: Thu, 26 May 2022 18:02:05 +0200 Subject: [PATCH] Throw a dedicated exception for fully empty actor descriptions in NodaValidationHelper --- src/NodaValidationHelper.php | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/NodaValidationHelper.php b/src/NodaValidationHelper.php index 9a88ba5..9205719 100644 --- a/src/NodaValidationHelper.php +++ b/src/NodaValidationHelper.php @@ -27,6 +27,13 @@ final class NodaValidationHelper { */ public static function validateActorDescription(string $description, array $names = []):void { + // For nodac, empty actor descriptions are to be allowed. Thus, a + // dedicated check for fully empty ones with a dedicated exception + // is needed. + if (empty($description)) { + throw new MDInvalidEmptyInputException("No author name is provided"); + } + // Throw error on descriptions that are too short if (\mb_strlen($description) < 10) { throw new MDgenericInvalidInputsException("Author description is too short");