From f736c20e3bccd093f728b53a8a56289181e1e120 Mon Sep 17 00:00:00 2001 From: Mike Colagrosso Date: Sun, 21 Apr 2024 23:50:57 -0600 Subject: [PATCH] Fix error found by PHPStan PHPStan doesn't think that Identifier can be null: ``` 549 Strict comparison using === between string and null will always evaluate to false. ``` --- lib/Ebook.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/Ebook.php b/lib/Ebook.php index 50208fd3..f4b58026 100644 --- a/lib/Ebook.php +++ b/lib/Ebook.php @@ -583,11 +583,11 @@ class Ebook{ public function Validate(): void{ $error = new Exceptions\ValidationException(); - if($this->Identifier === null || $this->Identifier == ''){ + if($this->Identifier == ''){ $error->Add(new Exceptions\EbookIdentifierRequiredException()); } - if($this->Identifier !== null && strlen($this->Identifier) > EBOOKS_MAX_STRING_LENGTH){ + if(strlen($this->Identifier) > EBOOKS_MAX_STRING_LENGTH){ $error->Add(new Exceptions\StringTooLongException('Ebook Identifier')); }