mirror of
https://github.com/barryvdh/laravel-ide-helper.git
synced 2026-08-18 01:57:13 +00:00
Fix inline doc-block for final models (#955)
* fix final model classes doc-block generation * add phpunit tests
This commit is contained in:
@@ -766,11 +766,10 @@ class ModelsCommand extends Command
|
||||
if ($originalDoc) {
|
||||
$contents = str_replace($originalDoc, $docComment, $contents);
|
||||
} else {
|
||||
$needle = "class {$classname}";
|
||||
$replace = "{$docComment}\nclass {$classname}";
|
||||
$pos = strpos($contents, $needle);
|
||||
$replace = "{$docComment}\n";
|
||||
$pos = strpos($contents, "final class {$classname}") ?: strpos($contents, "class {$classname}");
|
||||
if ($pos !== false) {
|
||||
$contents = substr_replace($contents, $replace, $pos, strlen($needle));
|
||||
$contents = substr_replace($contents, $replace, $pos, 0);
|
||||
}
|
||||
}
|
||||
if ($this->files->put($filename, $contents)) {
|
||||
|
||||
Reference in New Issue
Block a user