Skip to content

Commit

Permalink
fix: cant auto complete method chaining
Browse files Browse the repository at this point in the history
  • Loading branch information
SocolaDaiCa committed Feb 20, 2024
1 parent 8eab699 commit 5fdd7dd
Showing 1 changed file with 29 additions and 1 deletion.
30 changes: 29 additions & 1 deletion src/Console/ModelsCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -932,7 +932,35 @@ protected function createPhpDocs($class)
continue;
}
$arguments = implode(', ', $method['arguments']);
$tagLine = "@method static {$method['type']} {$name}({$arguments})";

$staticMethodNames = [
'newQuery',
'query',
'newModelQuery',
];

if (in_array($name, $staticMethodNames)) {
$tagLine = "@method static {$method['type']} {$name}({$arguments})";
} else {
$tagLine = "@method {$method['type']} {$name}({$arguments})";
}

if ($method['comment'] !== '') {
$tagLine .= " {$method['comment']}";
}
$tag = Tag::createInstance($tagLine, $phpdoc);
$phpdoc->appendTag($tag);
}

foreach ($this->methods as $name => $method) {
if (in_array($name, $methods)) {
continue;
}
$arguments = implode(', ', $method['arguments']);



$tagLine = "@method {$method['type']} {$name}({$arguments})";
if ($method['comment'] !== '') {
$tagLine .= " {$method['comment']}";
}
Expand Down

0 comments on commit 5fdd7dd

Please sign in to comment.