Check if returnType from docblock is not null (#1658)

This commit is contained in:
Barry vd. Heuvel
2025-01-14 10:07:00 +01:00
committed by GitHub
parent 299a81b9bb
commit 980a87e250
+3 -1
View File
@@ -821,7 +821,9 @@ class ModelsCommand extends Command
) { ) {
$matches = []; $matches = [];
$returnType = $this->getReturnTypeFromDocBlock($reflection); $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 // Model isn't specified because relation is polymorphic
$this->setProperty( $this->setProperty(