From 91d9ea9b9759a48b400d322095dcaa782215ede6 Mon Sep 17 00:00:00 2001 From: "Barry vd. Heuvel" Date: Tue, 14 Jan 2025 10:04:47 +0100 Subject: [PATCH] Check if returnType from docblock is not null --- src/Console/ModelsCommand.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/Console/ModelsCommand.php b/src/Console/ModelsCommand.php index 1c643c6dc..9b1f2c3c2 100644 --- a/src/Console/ModelsCommand.php +++ b/src/Console/ModelsCommand.php @@ -821,7 +821,9 @@ public function getPropertiesFromMethods($model) ) { $matches = []; $returnType = $this->getReturnTypeFromDocBlock($reflection); - preg_match('/MorphTo<(.+?)(?:,|>)/i', $returnType, $matches); + if ($returnType !== null) { + preg_match('/MorphTo<(.+?)(?:,|>)/i', $returnType, $matches); + } // Model isn't specified because relation is polymorphic $this->setProperty(