Skip to content

Commit

Permalink
Check if returnType from docblock is not null (#1658)
Browse files Browse the repository at this point in the history
  • Loading branch information
barryvdh authored Jan 14, 2025
1 parent 299a81b commit 980a87e
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/Console/ModelsCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down

0 comments on commit 980a87e

Please sign in to comment.