From 5515cabea39b9cf55f98980d0f269dc9d85cfcca Mon Sep 17 00:00:00 2001 From: Kaloqn <32775332+KaloyanYosifov@users.noreply.github.com> Date: Sun, 6 Dec 2020 10:55:05 +0200 Subject: [PATCH] FQCN bugfix when writing external eloquent builder methods inside models. (#1113) * Fix code that was causing the test to break and fix bug with not built in types * Run cs fixer * Remove fetching the doc block type and the putting it as a type hint as a php doc block is sufficient * Revert doc block type hinting * Enchance doc block type hinting * Combine replacements * Use the full builder class instead of the parsed one after the getClassName function and remove in array check * Get the builder from the model itself instead of passing a string directly the function * Use the full builder class to get the builder methods and reflection, but use the parsed builder class after setting its method in the doc * Add test for fqn support on external eloquent builder * Use the external builder if necessary when building the magic wheres * Use the default eloquent builder if the user has disabled the external builder option --- src/Console/ModelsCommand.php | 29 ++- .../__snapshots__/Test__test__1.php | 146 +++++++------- .../Builders/PostExternalQueryBuilder.php | 109 +++++++++++ .../Models/Post.php | 16 ++ .../Test.php | 24 +++ .../__snapshots__/Test__test__1.php | 184 ++++++++++++++++++ .../__snapshots__/Test__test__1.php | 146 +++++++------- 7 files changed, 498 insertions(+), 156 deletions(-) create mode 100644 tests/Console/ModelsCommand/GeneratePhpdocWithExternalEloquentBuilderWithFqn/Builders/PostExternalQueryBuilder.php create mode 100644 tests/Console/ModelsCommand/GeneratePhpdocWithExternalEloquentBuilderWithFqn/Models/Post.php create mode 100644 tests/Console/ModelsCommand/GeneratePhpdocWithExternalEloquentBuilderWithFqn/Test.php create mode 100644 tests/Console/ModelsCommand/GeneratePhpdocWithExternalEloquentBuilderWithFqn/__snapshots__/Test__test__1.php diff --git a/src/Console/ModelsCommand.php b/src/Console/ModelsCommand.php index 69c95b9..8b15c2b 100644 --- a/src/Console/ModelsCommand.php +++ b/src/Console/ModelsCommand.php @@ -490,9 +490,13 @@ class ModelsCommand extends Command !$column->getNotnull() ); if ($this->write_model_magic_where) { + $builderClass = $this->write_model_external_builder_methods + ? get_class($model->newModelQuery()) + : '\Illuminate\Database\Eloquent\Builder'; + $this->setMethod( Str::camel('where_' . $name), - $this->getClassNameInDestinationFile($model, \Illuminate\Database\Eloquent\Builder::class) + $this->getClassNameInDestinationFile($model, $builderClass) . '|' . $this->getClassNameInDestinationFile($model, get_class($model)), ['$value'] @@ -562,7 +566,7 @@ class ModelsCommand extends Command ); if ($this->write_model_external_builder_methods) { - $this->writeModelExternalBuilderMethods($builder, $model); + $this->writeModelExternalBuilderMethods($model); } } elseif ( !method_exists('Illuminate\Database\Eloquent\Model', $method) @@ -1149,26 +1153,31 @@ class ModelsCommand extends Command return $namespaceAliases; } - protected function writeModelExternalBuilderMethods(string $builder, Model $model): void + protected function writeModelExternalBuilderMethods(Model $model): void { - if (in_array($builder, ['\Illuminate\Database\Eloquent\Builder', 'EloquentBuilder'])) { - return; - } - - $newBuilderMethods = get_class_methods($builder); + $fullBuilderClass = '\\' . get_class($model->newModelQuery()); + $newBuilderMethods = get_class_methods($fullBuilderClass); $originalBuilderMethods = get_class_methods('\Illuminate\Database\Eloquent\Builder'); // diff the methods between the new builder and original one // and create helpers for the ones that are new $newMethodsFromNewBuilder = array_diff($newBuilderMethods, $originalBuilderMethods); + if (!$newMethodsFromNewBuilder) { + return; + } + + // after we have retrieved the builder's methods + // get the class of the builder based on the FQCN option + $builderClassBasedOnFQCNOption = $this->getClassNameInDestinationFile($model, get_class($model->newModelQuery())); + foreach ($newMethodsFromNewBuilder as $builderMethod) { - $reflection = new \ReflectionMethod($builder, $builderMethod); + $reflection = new \ReflectionMethod($fullBuilderClass, $builderMethod); $args = $this->getParameters($reflection); $this->setMethod( $builderMethod, - $builder . '|' . $this->getClassNameInDestinationFile($model, get_class($model)), + $builderClassBasedOnFQCNOption . '|' . $this->getClassNameInDestinationFile($model, get_class($model)), $args ); } diff --git a/tests/Console/ModelsCommand/GeneratePhpdocWithExternalEloquentBuilder/__snapshots__/Test__test__1.php b/tests/Console/ModelsCommand/GeneratePhpdocWithExternalEloquentBuilder/__snapshots__/Test__test__1.php index 68d935d..0dd210e 100644 --- a/tests/Console/ModelsCommand/GeneratePhpdocWithExternalEloquentBuilder/__snapshots__/Test__test__1.php +++ b/tests/Console/ModelsCommand/GeneratePhpdocWithExternalEloquentBuilder/__snapshots__/Test__test__1.php @@ -93,79 +93,79 @@ namespace Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GeneratePhpdocWi * @method static \Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GeneratePhpdocWithExternalEloquentBuilder\Builders\PostExternalQueryBuilder|Post newModelQuery() * @method static \Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GeneratePhpdocWithExternalEloquentBuilder\Builders\PostExternalQueryBuilder|Post newQuery() * @method static \Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GeneratePhpdocWithExternalEloquentBuilder\Builders\PostExternalQueryBuilder|Post query() - * @method static \Illuminate\Database\Eloquent\Builder|Post whereBigIntegerNotNullable($value) - * @method static \Illuminate\Database\Eloquent\Builder|Post whereBigIntegerNullable($value) - * @method static \Illuminate\Database\Eloquent\Builder|Post whereBinaryNotNullable($value) - * @method static \Illuminate\Database\Eloquent\Builder|Post whereBinaryNullable($value) - * @method static \Illuminate\Database\Eloquent\Builder|Post whereBooleanNotNullable($value) - * @method static \Illuminate\Database\Eloquent\Builder|Post whereBooleanNullable($value) - * @method static \Illuminate\Database\Eloquent\Builder|Post whereCharNotNullable($value) - * @method static \Illuminate\Database\Eloquent\Builder|Post whereCharNullable($value) - * @method static \Illuminate\Database\Eloquent\Builder|Post whereCreatedAt($value) - * @method static \Illuminate\Database\Eloquent\Builder|Post whereDateNotNullable($value) - * @method static \Illuminate\Database\Eloquent\Builder|Post whereDateNullable($value) - * @method static \Illuminate\Database\Eloquent\Builder|Post whereDatetimeNotNullable($value) - * @method static \Illuminate\Database\Eloquent\Builder|Post whereDatetimeNullable($value) - * @method static \Illuminate\Database\Eloquent\Builder|Post whereDatetimetzNotNullable($value) - * @method static \Illuminate\Database\Eloquent\Builder|Post whereDatetimetzNullable($value) - * @method static \Illuminate\Database\Eloquent\Builder|Post whereDecimalNotNullable($value) - * @method static \Illuminate\Database\Eloquent\Builder|Post whereDecimalNullable($value) - * @method static \Illuminate\Database\Eloquent\Builder|Post whereDoubleNotNullable($value) - * @method static \Illuminate\Database\Eloquent\Builder|Post whereDoubleNullable($value) - * @method static \Illuminate\Database\Eloquent\Builder|Post whereEnumNotNullable($value) - * @method static \Illuminate\Database\Eloquent\Builder|Post whereEnumNullable($value) - * @method static \Illuminate\Database\Eloquent\Builder|Post whereFloatNotNullable($value) - * @method static \Illuminate\Database\Eloquent\Builder|Post whereFloatNullable($value) - * @method static \Illuminate\Database\Eloquent\Builder|Post whereId($value) - * @method static \Illuminate\Database\Eloquent\Builder|Post whereIntegerNotNullable($value) - * @method static \Illuminate\Database\Eloquent\Builder|Post whereIntegerNullable($value) - * @method static \Illuminate\Database\Eloquent\Builder|Post whereIpaddressNotNullable($value) - * @method static \Illuminate\Database\Eloquent\Builder|Post whereIpaddressNullable($value) - * @method static \Illuminate\Database\Eloquent\Builder|Post whereJsonNotNullable($value) - * @method static \Illuminate\Database\Eloquent\Builder|Post whereJsonNullable($value) - * @method static \Illuminate\Database\Eloquent\Builder|Post whereJsonbNotNullable($value) - * @method static \Illuminate\Database\Eloquent\Builder|Post whereJsonbNullable($value) - * @method static \Illuminate\Database\Eloquent\Builder|Post whereLongTextNotNullable($value) - * @method static \Illuminate\Database\Eloquent\Builder|Post whereLongTextNullable($value) - * @method static \Illuminate\Database\Eloquent\Builder|Post whereMacaddressNotNullable($value) - * @method static \Illuminate\Database\Eloquent\Builder|Post whereMacaddressNullable($value) - * @method static \Illuminate\Database\Eloquent\Builder|Post whereMediumIntegerNotNullable($value) - * @method static \Illuminate\Database\Eloquent\Builder|Post whereMediumIntegerNullable($value) - * @method static \Illuminate\Database\Eloquent\Builder|Post whereMediumTextNotNullable($value) - * @method static \Illuminate\Database\Eloquent\Builder|Post whereMediumTextNullable($value) - * @method static \Illuminate\Database\Eloquent\Builder|Post whereSmallIntegerNotNullable($value) - * @method static \Illuminate\Database\Eloquent\Builder|Post whereSmallIntegerNullable($value) - * @method static \Illuminate\Database\Eloquent\Builder|Post whereStringNotNullable($value) - * @method static \Illuminate\Database\Eloquent\Builder|Post whereStringNullable($value) - * @method static \Illuminate\Database\Eloquent\Builder|Post whereTextNotNullable($value) - * @method static \Illuminate\Database\Eloquent\Builder|Post whereTextNullable($value) - * @method static \Illuminate\Database\Eloquent\Builder|Post whereTimeNotNullable($value) - * @method static \Illuminate\Database\Eloquent\Builder|Post whereTimeNullable($value) - * @method static \Illuminate\Database\Eloquent\Builder|Post whereTimestampNotNullable($value) - * @method static \Illuminate\Database\Eloquent\Builder|Post whereTimestampNullable($value) - * @method static \Illuminate\Database\Eloquent\Builder|Post whereTimestamptzNotNullable($value) - * @method static \Illuminate\Database\Eloquent\Builder|Post whereTimestamptzNullable($value) - * @method static \Illuminate\Database\Eloquent\Builder|Post whereTimetzNotNullable($value) - * @method static \Illuminate\Database\Eloquent\Builder|Post whereTimetzNullable($value) - * @method static \Illuminate\Database\Eloquent\Builder|Post whereTinyIntegerNotNullable($value) - * @method static \Illuminate\Database\Eloquent\Builder|Post whereTinyIntegerNullable($value) - * @method static \Illuminate\Database\Eloquent\Builder|Post whereUnsignedBigIntegerNotNullable($value) - * @method static \Illuminate\Database\Eloquent\Builder|Post whereUnsignedBigIntegerNullable($value) - * @method static \Illuminate\Database\Eloquent\Builder|Post whereUnsignedDecimalNotNullable($value) - * @method static \Illuminate\Database\Eloquent\Builder|Post whereUnsignedDecimalNullable($value) - * @method static \Illuminate\Database\Eloquent\Builder|Post whereUnsignedIntegerNotNullable($value) - * @method static \Illuminate\Database\Eloquent\Builder|Post whereUnsignedIntegerNullable($value) - * @method static \Illuminate\Database\Eloquent\Builder|Post whereUnsignedMediumIntegerNotNullable($value) - * @method static \Illuminate\Database\Eloquent\Builder|Post whereUnsignedMediumIntegerNullable($value) - * @method static \Illuminate\Database\Eloquent\Builder|Post whereUnsignedSmallIntegerNotNullable($value) - * @method static \Illuminate\Database\Eloquent\Builder|Post whereUnsignedSmallIntegerNullable($value) - * @method static \Illuminate\Database\Eloquent\Builder|Post whereUnsignedTinyIntegerNotNullable($value) - * @method static \Illuminate\Database\Eloquent\Builder|Post whereUnsignedTinyIntegerNullable($value) - * @method static \Illuminate\Database\Eloquent\Builder|Post whereUpdatedAt($value) - * @method static \Illuminate\Database\Eloquent\Builder|Post whereUuidNotNullable($value) - * @method static \Illuminate\Database\Eloquent\Builder|Post whereUuidNullable($value) - * @method static \Illuminate\Database\Eloquent\Builder|Post whereYearNotNullable($value) - * @method static \Illuminate\Database\Eloquent\Builder|Post whereYearNullable($value) + * @method static \Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GeneratePhpdocWithExternalEloquentBuilder\Builders\PostExternalQueryBuilder|Post whereBigIntegerNotNullable($value) + * @method static \Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GeneratePhpdocWithExternalEloquentBuilder\Builders\PostExternalQueryBuilder|Post whereBigIntegerNullable($value) + * @method static \Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GeneratePhpdocWithExternalEloquentBuilder\Builders\PostExternalQueryBuilder|Post whereBinaryNotNullable($value) + * @method static \Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GeneratePhpdocWithExternalEloquentBuilder\Builders\PostExternalQueryBuilder|Post whereBinaryNullable($value) + * @method static \Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GeneratePhpdocWithExternalEloquentBuilder\Builders\PostExternalQueryBuilder|Post whereBooleanNotNullable($value) + * @method static \Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GeneratePhpdocWithExternalEloquentBuilder\Builders\PostExternalQueryBuilder|Post whereBooleanNullable($value) + * @method static \Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GeneratePhpdocWithExternalEloquentBuilder\Builders\PostExternalQueryBuilder|Post whereCharNotNullable($value) + * @method static \Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GeneratePhpdocWithExternalEloquentBuilder\Builders\PostExternalQueryBuilder|Post whereCharNullable($value) + * @method static \Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GeneratePhpdocWithExternalEloquentBuilder\Builders\PostExternalQueryBuilder|Post whereCreatedAt($value) + * @method static \Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GeneratePhpdocWithExternalEloquentBuilder\Builders\PostExternalQueryBuilder|Post whereDateNotNullable($value) + * @method static \Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GeneratePhpdocWithExternalEloquentBuilder\Builders\PostExternalQueryBuilder|Post whereDateNullable($value) + * @method static \Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GeneratePhpdocWithExternalEloquentBuilder\Builders\PostExternalQueryBuilder|Post whereDatetimeNotNullable($value) + * @method static \Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GeneratePhpdocWithExternalEloquentBuilder\Builders\PostExternalQueryBuilder|Post whereDatetimeNullable($value) + * @method static \Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GeneratePhpdocWithExternalEloquentBuilder\Builders\PostExternalQueryBuilder|Post whereDatetimetzNotNullable($value) + * @method static \Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GeneratePhpdocWithExternalEloquentBuilder\Builders\PostExternalQueryBuilder|Post whereDatetimetzNullable($value) + * @method static \Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GeneratePhpdocWithExternalEloquentBuilder\Builders\PostExternalQueryBuilder|Post whereDecimalNotNullable($value) + * @method static \Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GeneratePhpdocWithExternalEloquentBuilder\Builders\PostExternalQueryBuilder|Post whereDecimalNullable($value) + * @method static \Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GeneratePhpdocWithExternalEloquentBuilder\Builders\PostExternalQueryBuilder|Post whereDoubleNotNullable($value) + * @method static \Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GeneratePhpdocWithExternalEloquentBuilder\Builders\PostExternalQueryBuilder|Post whereDoubleNullable($value) + * @method static \Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GeneratePhpdocWithExternalEloquentBuilder\Builders\PostExternalQueryBuilder|Post whereEnumNotNullable($value) + * @method static \Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GeneratePhpdocWithExternalEloquentBuilder\Builders\PostExternalQueryBuilder|Post whereEnumNullable($value) + * @method static \Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GeneratePhpdocWithExternalEloquentBuilder\Builders\PostExternalQueryBuilder|Post whereFloatNotNullable($value) + * @method static \Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GeneratePhpdocWithExternalEloquentBuilder\Builders\PostExternalQueryBuilder|Post whereFloatNullable($value) + * @method static \Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GeneratePhpdocWithExternalEloquentBuilder\Builders\PostExternalQueryBuilder|Post whereId($value) + * @method static \Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GeneratePhpdocWithExternalEloquentBuilder\Builders\PostExternalQueryBuilder|Post whereIntegerNotNullable($value) + * @method static \Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GeneratePhpdocWithExternalEloquentBuilder\Builders\PostExternalQueryBuilder|Post whereIntegerNullable($value) + * @method static \Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GeneratePhpdocWithExternalEloquentBuilder\Builders\PostExternalQueryBuilder|Post whereIpaddressNotNullable($value) + * @method static \Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GeneratePhpdocWithExternalEloquentBuilder\Builders\PostExternalQueryBuilder|Post whereIpaddressNullable($value) + * @method static \Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GeneratePhpdocWithExternalEloquentBuilder\Builders\PostExternalQueryBuilder|Post whereJsonNotNullable($value) + * @method static \Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GeneratePhpdocWithExternalEloquentBuilder\Builders\PostExternalQueryBuilder|Post whereJsonNullable($value) + * @method static \Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GeneratePhpdocWithExternalEloquentBuilder\Builders\PostExternalQueryBuilder|Post whereJsonbNotNullable($value) + * @method static \Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GeneratePhpdocWithExternalEloquentBuilder\Builders\PostExternalQueryBuilder|Post whereJsonbNullable($value) + * @method static \Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GeneratePhpdocWithExternalEloquentBuilder\Builders\PostExternalQueryBuilder|Post whereLongTextNotNullable($value) + * @method static \Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GeneratePhpdocWithExternalEloquentBuilder\Builders\PostExternalQueryBuilder|Post whereLongTextNullable($value) + * @method static \Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GeneratePhpdocWithExternalEloquentBuilder\Builders\PostExternalQueryBuilder|Post whereMacaddressNotNullable($value) + * @method static \Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GeneratePhpdocWithExternalEloquentBuilder\Builders\PostExternalQueryBuilder|Post whereMacaddressNullable($value) + * @method static \Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GeneratePhpdocWithExternalEloquentBuilder\Builders\PostExternalQueryBuilder|Post whereMediumIntegerNotNullable($value) + * @method static \Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GeneratePhpdocWithExternalEloquentBuilder\Builders\PostExternalQueryBuilder|Post whereMediumIntegerNullable($value) + * @method static \Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GeneratePhpdocWithExternalEloquentBuilder\Builders\PostExternalQueryBuilder|Post whereMediumTextNotNullable($value) + * @method static \Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GeneratePhpdocWithExternalEloquentBuilder\Builders\PostExternalQueryBuilder|Post whereMediumTextNullable($value) + * @method static \Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GeneratePhpdocWithExternalEloquentBuilder\Builders\PostExternalQueryBuilder|Post whereSmallIntegerNotNullable($value) + * @method static \Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GeneratePhpdocWithExternalEloquentBuilder\Builders\PostExternalQueryBuilder|Post whereSmallIntegerNullable($value) + * @method static \Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GeneratePhpdocWithExternalEloquentBuilder\Builders\PostExternalQueryBuilder|Post whereStringNotNullable($value) + * @method static \Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GeneratePhpdocWithExternalEloquentBuilder\Builders\PostExternalQueryBuilder|Post whereStringNullable($value) + * @method static \Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GeneratePhpdocWithExternalEloquentBuilder\Builders\PostExternalQueryBuilder|Post whereTextNotNullable($value) + * @method static \Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GeneratePhpdocWithExternalEloquentBuilder\Builders\PostExternalQueryBuilder|Post whereTextNullable($value) + * @method static \Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GeneratePhpdocWithExternalEloquentBuilder\Builders\PostExternalQueryBuilder|Post whereTimeNotNullable($value) + * @method static \Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GeneratePhpdocWithExternalEloquentBuilder\Builders\PostExternalQueryBuilder|Post whereTimeNullable($value) + * @method static \Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GeneratePhpdocWithExternalEloquentBuilder\Builders\PostExternalQueryBuilder|Post whereTimestampNotNullable($value) + * @method static \Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GeneratePhpdocWithExternalEloquentBuilder\Builders\PostExternalQueryBuilder|Post whereTimestampNullable($value) + * @method static \Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GeneratePhpdocWithExternalEloquentBuilder\Builders\PostExternalQueryBuilder|Post whereTimestamptzNotNullable($value) + * @method static \Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GeneratePhpdocWithExternalEloquentBuilder\Builders\PostExternalQueryBuilder|Post whereTimestamptzNullable($value) + * @method static \Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GeneratePhpdocWithExternalEloquentBuilder\Builders\PostExternalQueryBuilder|Post whereTimetzNotNullable($value) + * @method static \Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GeneratePhpdocWithExternalEloquentBuilder\Builders\PostExternalQueryBuilder|Post whereTimetzNullable($value) + * @method static \Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GeneratePhpdocWithExternalEloquentBuilder\Builders\PostExternalQueryBuilder|Post whereTinyIntegerNotNullable($value) + * @method static \Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GeneratePhpdocWithExternalEloquentBuilder\Builders\PostExternalQueryBuilder|Post whereTinyIntegerNullable($value) + * @method static \Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GeneratePhpdocWithExternalEloquentBuilder\Builders\PostExternalQueryBuilder|Post whereUnsignedBigIntegerNotNullable($value) + * @method static \Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GeneratePhpdocWithExternalEloquentBuilder\Builders\PostExternalQueryBuilder|Post whereUnsignedBigIntegerNullable($value) + * @method static \Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GeneratePhpdocWithExternalEloquentBuilder\Builders\PostExternalQueryBuilder|Post whereUnsignedDecimalNotNullable($value) + * @method static \Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GeneratePhpdocWithExternalEloquentBuilder\Builders\PostExternalQueryBuilder|Post whereUnsignedDecimalNullable($value) + * @method static \Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GeneratePhpdocWithExternalEloquentBuilder\Builders\PostExternalQueryBuilder|Post whereUnsignedIntegerNotNullable($value) + * @method static \Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GeneratePhpdocWithExternalEloquentBuilder\Builders\PostExternalQueryBuilder|Post whereUnsignedIntegerNullable($value) + * @method static \Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GeneratePhpdocWithExternalEloquentBuilder\Builders\PostExternalQueryBuilder|Post whereUnsignedMediumIntegerNotNullable($value) + * @method static \Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GeneratePhpdocWithExternalEloquentBuilder\Builders\PostExternalQueryBuilder|Post whereUnsignedMediumIntegerNullable($value) + * @method static \Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GeneratePhpdocWithExternalEloquentBuilder\Builders\PostExternalQueryBuilder|Post whereUnsignedSmallIntegerNotNullable($value) + * @method static \Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GeneratePhpdocWithExternalEloquentBuilder\Builders\PostExternalQueryBuilder|Post whereUnsignedSmallIntegerNullable($value) + * @method static \Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GeneratePhpdocWithExternalEloquentBuilder\Builders\PostExternalQueryBuilder|Post whereUnsignedTinyIntegerNotNullable($value) + * @method static \Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GeneratePhpdocWithExternalEloquentBuilder\Builders\PostExternalQueryBuilder|Post whereUnsignedTinyIntegerNullable($value) + * @method static \Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GeneratePhpdocWithExternalEloquentBuilder\Builders\PostExternalQueryBuilder|Post whereUpdatedAt($value) + * @method static \Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GeneratePhpdocWithExternalEloquentBuilder\Builders\PostExternalQueryBuilder|Post whereUuidNotNullable($value) + * @method static \Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GeneratePhpdocWithExternalEloquentBuilder\Builders\PostExternalQueryBuilder|Post whereUuidNullable($value) + * @method static \Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GeneratePhpdocWithExternalEloquentBuilder\Builders\PostExternalQueryBuilder|Post whereYearNotNullable($value) + * @method static \Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GeneratePhpdocWithExternalEloquentBuilder\Builders\PostExternalQueryBuilder|Post whereYearNullable($value) * @method static \Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GeneratePhpdocWithExternalEloquentBuilder\Builders\PostExternalQueryBuilder|Post withBool(?bool $booleanVar) * @method static \Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GeneratePhpdocWithExternalEloquentBuilder\Builders\PostExternalQueryBuilder|Post withBoolDifferently(?bool $booleanVar) * @method static \Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GeneratePhpdocWithExternalEloquentBuilder\Builders\PostExternalQueryBuilder|Post withBoolTypeHinted(bool $booleanVar) diff --git a/tests/Console/ModelsCommand/GeneratePhpdocWithExternalEloquentBuilderWithFqn/Builders/PostExternalQueryBuilder.php b/tests/Console/ModelsCommand/GeneratePhpdocWithExternalEloquentBuilderWithFqn/Builders/PostExternalQueryBuilder.php new file mode 100644 index 0000000..07f002c --- /dev/null +++ b/tests/Console/ModelsCommand/GeneratePhpdocWithExternalEloquentBuilderWithFqn/Builders/PostExternalQueryBuilder.php @@ -0,0 +1,109 @@ +app->make(ModelsCommand::class); + + $tester = $this->runCommand($command, [ + '--write' => true, + ]); + + $this->assertSame(0, $tester->getStatusCode()); + $this->assertStringContainsString('Written new phpDocBlock to', $tester->getDisplay()); + $this->assertMatchesMockedSnapshot(); + } +} diff --git a/tests/Console/ModelsCommand/GeneratePhpdocWithExternalEloquentBuilderWithFqn/__snapshots__/Test__test__1.php b/tests/Console/ModelsCommand/GeneratePhpdocWithExternalEloquentBuilderWithFqn/__snapshots__/Test__test__1.php new file mode 100644 index 0000000..c634636 --- /dev/null +++ b/tests/Console/ModelsCommand/GeneratePhpdocWithExternalEloquentBuilderWithFqn/__snapshots__/Test__test__1.php @@ -0,0 +1,184 @@ +