File tree Expand file tree Collapse file tree 3 files changed +12
-1
lines changed
tests/Console/ModelsCommand/GeneratePhpdocWithMixin/Models Expand file tree Collapse file tree 3 files changed +12
-1
lines changed Original file line number Diff line number Diff line change @@ -8,6 +8,7 @@ All notable changes to this project will be documented in this file.
88### Fixes
99- Fix return type of methods provided by ` SoftDeletes ` [ #1345 / KentarouTakeda] ( https://github.com/barryvdh/laravel-ide-helper/pull/1345 )
1010- Handle PHP 8.1 deprecation warnings when passing ` null ` to ` new \ReflectionClass ` [ #1351 / mfn] ( https://github.com/barryvdh/laravel-ide-helper/pull/1351 )
11+ - Fix issue where \Eloquent is not included when using write_mixin [ #1352 / Jefemy] ( https://github.com/barryvdh/laravel-ide-helper/pull/1352 )
1112- Fix model factory method arguments for Laravel >= 9 [ #1361 / wimski] ( https://github.com/barryvdh/laravel-ide-helper/pull/1361 )
1213
13142022-03-06, 2.12.3
Original file line number Diff line number Diff line change @@ -926,10 +926,19 @@ protected function createPhpDocs($class)
926926 $ phpdoc ->appendTag ($ tag );
927927 }
928928
929- if ($ this ->write && ! $ phpdoc -> getTagsByName ( ' mixin ' ) ) {
929+ if ($ this ->write ) {
930930 $ eloquentClassNameInModel = $ this ->getClassNameInDestinationFile ($ reflection , 'Eloquent ' );
931+
932+ // remove the already existing tag to prevent duplicates
933+ foreach ($ phpdoc ->getTagsByName ('mixin ' ) as $ tag ) {
934+ if ($ tag ->getContent () === $ eloquentClassNameInModel ) {
935+ $ phpdoc ->deleteTag ($ tag );
936+ }
937+ }
938+
931939 $ phpdoc ->appendTag (Tag::createInstance ('@mixin ' . $ eloquentClassNameInModel , $ phpdoc ));
932940 }
941+
933942 if ($ this ->phpstorm_noinspections ) {
934943 /**
935944 * Facades, Eloquent API
Original file line number Diff line number Diff line change 99/**
1010 * @property $someProp
1111 * @method someMethod(string $method)
12+ * @mixin IdeHelperPost
1213 */
1314class Post extends Model
1415{
You can’t perform that action at this time.
0 commit comments