From 558e9e85f67819b32bfb2dc6df5ea585e6b7e8b4 Mon Sep 17 00:00:00 2001 From: kevin olson Date: Thu, 17 Mar 2022 15:19:19 -0500 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9B=20fix=20for=20multiline=20relation?= =?UTF-8?q?=20assessment?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/ModelInterface.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/ModelInterface.php b/src/ModelInterface.php index 433dfe2..04471d0 100644 --- a/src/ModelInterface.php +++ b/src/ModelInterface.php @@ -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]) {