mirror of
https://github.com/barryvdh/laravel-ide-helper.git
synced 2026-08-18 01:57:13 +00:00
Fix issue where \Eloquent is not included when using write_mixin (#1352)
* Check for exact mixin name when writing * changelog * add mixin to test class Co-authored-by: Barry vd. Heuvel <[email protected]>
This commit is contained in:
co-authored by
Barry vd. Heuvel
parent
07f5eaea73
commit
c8f0f914e3
@@ -926,10 +926,19 @@ class ModelsCommand extends Command
|
||||
$phpdoc->appendTag($tag);
|
||||
}
|
||||
|
||||
if ($this->write && !$phpdoc->getTagsByName('mixin')) {
|
||||
if ($this->write) {
|
||||
$eloquentClassNameInModel = $this->getClassNameInDestinationFile($reflection, 'Eloquent');
|
||||
|
||||
// remove the already existing tag to prevent duplicates
|
||||
foreach ($phpdoc->getTagsByName('mixin') as $tag) {
|
||||
if($tag->getContent() === $eloquentClassNameInModel) {
|
||||
$phpdoc->deleteTag($tag);
|
||||
}
|
||||
}
|
||||
|
||||
$phpdoc->appendTag(Tag::createInstance('@mixin ' . $eloquentClassNameInModel, $phpdoc));
|
||||
}
|
||||
|
||||
if ($this->phpstorm_noinspections) {
|
||||
/**
|
||||
* Facades, Eloquent API
|
||||
|
||||
Reference in New Issue
Block a user