Skip to content

Commit

Permalink
🐛 fix for multiline relation assessment
Browse files Browse the repository at this point in the history
  • Loading branch information
acidjazz committed Mar 17, 2022
1 parent 4a69c9e commit 558e9e8
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/ModelInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,10 @@ public function getRelations(Model $model): array
}
}
$type = (string) $reflection->getReturnType();
$code = file($reflection->getFileName())[$reflection->getEndLine()-2];
$code = '';
for ($i = $reflection->getStartLine(); $i <= $reflection->getEndLine(); $i++) {
$code .= file($reflection->getFileName())[$i];
}
preg_match('/\((.*?)::class/', $code, $matches);
if ($matches && $matches[1]) {

Expand Down

0 comments on commit 558e9e8

Please sign in to comment.