From 21364df33fedc9bb1128321243ab2868d5123244 Mon Sep 17 00:00:00 2001 From: USAMI Kenta Date: Wed, 19 Apr 2023 21:08:05 +0900 Subject: [PATCH] Return the false returned by parent::getLastErrors() as default errors array --- src/Traits/FactoryTrait.php | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/Traits/FactoryTrait.php b/src/Traits/FactoryTrait.php index b962c6af..7fe1b78c 100644 --- a/src/Traits/FactoryTrait.php +++ b/src/Traits/FactoryTrait.php @@ -358,7 +358,12 @@ protected static function safeCreateDateTimeZone($object): DateTimeZone public static function getLastErrors(): array { if (empty(static::$_lastErrors)) { - return parent::getLastErrors(); + return parent::getLastErrors() ?: [ + 'warning_count' => 0, + 'warnings' => [], + 'error_count' => 0, + 'errors' => [], + ]; } return static::$_lastErrors;