From 2fc239623bf62503e81a2d6f8ec1b64537adb25a Mon Sep 17 00:00:00 2001 From: Ajay Dwivedi <68941581+ajay-mm@users.noreply.github.com> Date: Wed, 4 Aug 2021 14:56:51 +0530 Subject: [PATCH] Fix #1173 Use FQN for write-mixin (#1174) * Fix #1173 Use FQN for write-mixin * Fix #1173 Use FQN for write-mixin: Update Test cases --- src/Console/ModelsCommand.php | 2 +- .../ModelsCommand/GeneratePhpdocWithMixin/Models/Post.php | 1 + .../GeneratePhpdocWithMixin/__snapshots__/Test__test__1.php | 1 + 3 files changed, 3 insertions(+), 1 deletion(-) diff --git a/src/Console/ModelsCommand.php b/src/Console/ModelsCommand.php index c6fe186..c117310 100644 --- a/src/Console/ModelsCommand.php +++ b/src/Console/ModelsCommand.php @@ -1225,7 +1225,7 @@ class ModelsCommand extends Command ; $className = trim($className, '\\'); - $writingToExternalFile = !$this->write; + $writingToExternalFile = !$this->write || $this->write_mixin; $classIsNotInExternalFile = $reflection->getName() !== $className; $forceFQCN = $this->laravel['config']->get('ide-helper.force_fqn', false); diff --git a/tests/Console/ModelsCommand/GeneratePhpdocWithMixin/Models/Post.php b/tests/Console/ModelsCommand/GeneratePhpdocWithMixin/Models/Post.php index 24d6981..7817bed 100644 --- a/tests/Console/ModelsCommand/GeneratePhpdocWithMixin/Models/Post.php +++ b/tests/Console/ModelsCommand/GeneratePhpdocWithMixin/Models/Post.php @@ -5,6 +5,7 @@ declare(strict_types=1); namespace Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GeneratePhpdocWithMixin\Models; use Illuminate\Database\Eloquent\Model; +use Illuminate\Database\Eloquent\Builder; /** * @property $someProp diff --git a/tests/Console/ModelsCommand/GeneratePhpdocWithMixin/__snapshots__/Test__test__1.php b/tests/Console/ModelsCommand/GeneratePhpdocWithMixin/__snapshots__/Test__test__1.php index 872469a..ac0fea8 100644 --- a/tests/Console/ModelsCommand/GeneratePhpdocWithMixin/__snapshots__/Test__test__1.php +++ b/tests/Console/ModelsCommand/GeneratePhpdocWithMixin/__snapshots__/Test__test__1.php @@ -5,6 +5,7 @@ declare(strict_types=1); namespace Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GeneratePhpdocWithMixin\Models; use Illuminate\Database\Eloquent\Model; +use Illuminate\Database\Eloquent\Builder; /** * @property $someProp