Merge pull request #920 from mr-feek/include-interfaces

if a model implements interfaces, include them in the stub
This commit is contained in:
Barry vd. Heuvel
2020-04-21 21:15:37 +02:00
committed by GitHub
3 changed files with 130 additions and 2 deletions
+12 -2
View File
@@ -660,6 +660,10 @@ class ModelsCommand extends Command
$classname = $reflection->getShortName();
$originalDoc = $reflection->getDocComment();
$keyword = $this->getClassKeyword($reflection);
$interfaceNames = array_diff_key(
$reflection->getInterfaceNames(),
$reflection->getParentClass()->getInterfaceNames()
);
if ($this->reset) {
$phpdoc = new DocBlock('', new Context($namespace));
@@ -748,8 +752,14 @@ class ModelsCommand extends Command
}
}
$output = "namespace {$namespace}{\n{$docComment}\n\t{$keyword}class {$classname} extends \Eloquent {}\n}\n\n";
return $output;
$output = "namespace {$namespace}{\n{$docComment}\n\t{$keyword}class {$classname} extends \Eloquent ";
if ($interfaceNames) {
$interfaces = implode(', \\', $interfaceNames);
$output .= "implements \\{$interfaces} ";
}
return $output . "{}\n}\n\n";
}
/**