Skip to content

Commit 980a87e

Browse files
authoredJan 14, 2025··
Check if returnType from docblock is not null (#1658)
1 parent 299a81b commit 980a87e

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed
 

‎src/Console/ModelsCommand.php

+3-1
Original file line numberDiff line numberDiff line change
@@ -821,7 +821,9 @@ public function getPropertiesFromMethods($model)
821821
) {
822822
$matches = [];
823823
$returnType = $this->getReturnTypeFromDocBlock($reflection);
824-
preg_match('/MorphTo<(.+?)(?:,|>)/i', $returnType, $matches);
824+
if ($returnType !== null) {
825+
preg_match('/MorphTo<(.+?)(?:,|>)/i', $returnType, $matches);
826+
}
825827

826828
// Model isn't specified because relation is polymorphic
827829
$this->setProperty(

0 commit comments

Comments
 (0)
Please sign in to comment.