Check if returnType from docblock is not null

This commit is contained in:
Barry vd. Heuvel
2025-01-14 10:04:47 +01:00
parent 299a81b9bb
commit 91d9ea9b97
+3 -1
View File
@@ -821,7 +821,9 @@ class ModelsCommand extends Command
) {
$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(