mirror of
https://github.com/barryvdh/laravel-ide-helper.git
synced 2026-08-18 10:07:12 +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
@@ -8,6 +8,7 @@ All notable changes to this project will be documented in this file.
|
|||||||
### Fixes
|
### Fixes
|
||||||
- Fix return type of methods provided by `SoftDeletes` [#1345 / KentarouTakeda](https://github.com/barryvdh/laravel-ide-helper/pull/1345)
|
- Fix return type of methods provided by `SoftDeletes` [#1345 / KentarouTakeda](https://github.com/barryvdh/laravel-ide-helper/pull/1345)
|
||||||
- Handle PHP 8.1 deprecation warnings when passing `null` to `new \ReflectionClass` [#1351 / mfn](https://github.com/barryvdh/laravel-ide-helper/pull/1351)
|
- Handle PHP 8.1 deprecation warnings when passing `null` to `new \ReflectionClass` [#1351 / mfn](https://github.com/barryvdh/laravel-ide-helper/pull/1351)
|
||||||
|
- Fix issue where \Eloquent is not included when using write_mixin [#1352 / Jefemy](https://github.com/barryvdh/laravel-ide-helper/pull/1352)
|
||||||
- Fix model factory method arguments for Laravel >= 9 [#1361 / wimski](https://github.com/barryvdh/laravel-ide-helper/pull/1361)
|
- Fix model factory method arguments for Laravel >= 9 [#1361 / wimski](https://github.com/barryvdh/laravel-ide-helper/pull/1361)
|
||||||
|
|
||||||
2022-03-06, 2.12.3
|
2022-03-06, 2.12.3
|
||||||
|
|||||||
@@ -926,10 +926,19 @@ class ModelsCommand extends Command
|
|||||||
$phpdoc->appendTag($tag);
|
$phpdoc->appendTag($tag);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($this->write && !$phpdoc->getTagsByName('mixin')) {
|
if ($this->write) {
|
||||||
$eloquentClassNameInModel = $this->getClassNameInDestinationFile($reflection, 'Eloquent');
|
$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));
|
$phpdoc->appendTag(Tag::createInstance('@mixin ' . $eloquentClassNameInModel, $phpdoc));
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($this->phpstorm_noinspections) {
|
if ($this->phpstorm_noinspections) {
|
||||||
/**
|
/**
|
||||||
* Facades, Eloquent API
|
* Facades, Eloquent API
|
||||||
|
|||||||
@@ -9,6 +9,7 @@ use Illuminate\Database\Eloquent\Model;
|
|||||||
/**
|
/**
|
||||||
* @property $someProp
|
* @property $someProp
|
||||||
* @method someMethod(string $method)
|
* @method someMethod(string $method)
|
||||||
|
* @mixin IdeHelperPost
|
||||||
*/
|
*/
|
||||||
class Post extends Model
|
class Post extends Model
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user