From d54db4d9fb4ce5637cc595804cb78430ecabd76c Mon Sep 17 00:00:00 2001 From: KyleKatarn Date: Sat, 9 May 2020 22:29:33 +0200 Subject: [PATCH] Handle inner PHPDoc blocks --- src/Types/Generator.php | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/src/Types/Generator.php b/src/Types/Generator.php index 330ddc7..a433d4c 100644 --- a/src/Types/Generator.php +++ b/src/Types/Generator.php @@ -91,6 +91,21 @@ protected function getMethodsDefinitions($boot, $source, $defaultClass) $length = $method->getEndLine() - 1; $lines = $files[$methodFile]; + + if ($length > 3 && preg_match('/^\s*\*+\/\s*$/', $lines[$length - 2])) { + $doc = ''; + + for ($i = $length - 2; $i >= max(0, $length - 42); $i--) { + $doc = $lines[$i].$doc; + + if (preg_match('/\s*\/\*{2,}\s*/', $lines[$i])) { + $methodDocBlock = trim($doc); + + break; + } + } + } + $code = array_slice($lines, 0, $length); for ($i = $length - 1; $i >= 0; $i--) {