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(