From 6f20800eef08db1d6da7aafd383309fcfafc651a Mon Sep 17 00:00:00 2001 From: Gabriel Langer Date: Sat, 20 Jun 2020 12:53:36 +0200 Subject: [PATCH] [Model] Simplify full namespaces for already included resources (#954) * Fixed #565 by using the imported class name if present. Fixed a bug where cast type was not properly added when the return type was found via phpdoc. * Fixed errors with phpdocumentor/type-resolver:1.0 --- composer.json | 1 + src/Console/ModelsCommand.php | 124 +++++++-- .../ModelsCommand/CustomCollection/Test.php | 14 +- .../Console/ModelsCommand/CustomDate/Test.php | 10 +- .../GenerateBasicPhpdoc/Test.php | 152 +++++------ .../GenerateBasicPhpdocCamel/Test.php | 152 +++++------ .../GeneratePhpdocWithFqn/Casts/CastType.php | 10 + .../GeneratePhpdocWithFqn/Models/Post.php | 34 +++ .../GeneratePhpdocWithFqn/Test.php | 257 ++++++++++++++++++ .../ModelsCommand/Getter/Models/Simple.php | 2 +- tests/Console/ModelsCommand/Getter/Test.php | 12 +- tests/Console/ModelsCommand/Ignored/Test.php | 6 +- .../Console/ModelsCommand/Interfaces/Test.php | 6 +- .../CustomCasterWithDocblockReturnFqn.php | 25 ++ .../LaravelCustomCasts/Models/CustomCast.php | 2 + .../ModelsCommand/LaravelCustomCasts/Test.php | 24 +- .../PHPStormNoInspection/Test.php | 16 +- .../Console/ModelsCommand/Relations/Test.php | 34 +-- .../ModelsCommand/ResetAndSmartReset/Test.php | 24 +- .../ModelsCommand/SoftDeletes/Test.php | 14 +- .../migrations/____custom_casts_table.php | 1 + 21 files changed, 668 insertions(+), 252 deletions(-) create mode 100644 tests/Console/ModelsCommand/GeneratePhpdocWithFqn/Casts/CastType.php create mode 100644 tests/Console/ModelsCommand/GeneratePhpdocWithFqn/Models/Post.php create mode 100644 tests/Console/ModelsCommand/GeneratePhpdocWithFqn/Test.php create mode 100644 tests/Console/ModelsCommand/LaravelCustomCasts/Casts/CustomCasterWithDocblockReturnFqn.php diff --git a/composer.json b/composer.json index 4c62d57..e233069 100644 --- a/composer.json +++ b/composer.json @@ -15,6 +15,7 @@ "illuminate/console": "^5.5|^6|^7", "illuminate/filesystem": "^5.5|^6|^7", "barryvdh/reflection-docblock": "^2.0.6", + "phpdocumentor/type-resolver": "^1.1.0", "composer/composer": "^1.6", "doctrine/dbal": "~2.3" }, diff --git a/src/Console/ModelsCommand.php b/src/Console/ModelsCommand.php index 51dc649..e1c7a55 100644 --- a/src/Console/ModelsCommand.php +++ b/src/Console/ModelsCommand.php @@ -17,10 +17,13 @@ use Barryvdh\Reflection\DocBlock\Tag; use Composer\Autoload\ClassMapGenerator; use Illuminate\Console\Command; use Illuminate\Contracts\Database\Eloquent\CastsAttributes; +use Illuminate\Database\Eloquent\Model; use Illuminate\Database\Eloquent\Relations\Relation; use Illuminate\Filesystem\Filesystem; use Illuminate\Support\Str; +use phpDocumentor\Reflection\Types\ContextFactory; use ReflectionClass; +use ReflectionObject; use Symfony\Component\Console\Input\InputArgument; use Symfony\Component\Console\Input\InputOption; use Symfony\Component\Console\Output\OutputInterface; @@ -327,8 +330,8 @@ class ModelsCommand extends Command continue; } else { $realType = $this->checkForCustomLaravelCasts($realType); - - $this->properties[$name]['type'] = $this->getTypeOverride($realType); + $realType = $this->getTypeOverride($realType); + $this->properties[$name]['type'] = $this->getTypeInModel($model, $realType); if (isset($this->nullableColumns[$name])) { $this->properties[$name]['type'] .= '|null'; @@ -341,7 +344,7 @@ class ModelsCommand extends Command * Returns the overide type for the give type. * * @param string $type - * @return string + * @return string|null */ protected function getTypeOverride($type) { @@ -422,11 +425,20 @@ class ModelsCommand extends Command if (!$column->getNotnull()) { $this->nullableColumns[$name] = true; } - $this->setProperty($name, $type, true, true, $comment, !$column->getNotnull()); + $this->setProperty( + $name, + $this->getTypeInModel($model, $type), + true, + true, + $comment, + !$column->getNotnull() + ); if ($this->write_model_magic_where) { $this->setMethod( Str::camel("where_" . $name), - '\Illuminate\Database\Eloquent\Builder|\\' . get_class($model), + $this->getClassNameInModel($model, \Illuminate\Database\Eloquent\Builder::class) + . '|' + . $this->getClassNameInModel($model, get_class($model)), array('$value') ); } @@ -453,6 +465,7 @@ class ModelsCommand extends Command if (!empty($name)) { $reflection = new \ReflectionMethod($model, $method); $type = $this->getReturnType($reflection); + $type = $this->getTypeInModel($model, $type); $this->setProperty($name, $type, true, null); } } elseif (Str::startsWith($method, 'set') && Str::endsWith( @@ -473,14 +486,20 @@ class ModelsCommand extends Command $args = $this->getParameters($reflection); //Remove the first ($query) argument array_shift($args); - $this->setMethod($name, '\Illuminate\Database\Eloquent\Builder|\\' . $reflection->class, $args); + $builder = $this->getClassNameInModel( + $reflection->getDeclaringClass(), + \Illuminate\Database\Eloquent\Builder::class + ); + $modelName = $this->getClassNameInModel( + $reflection->getDeclaringClass(), + $reflection->getDeclaringClass()->getName() + ); + $this->setMethod($name, $builder . '|' . $modelName, $args); } } elseif (in_array($method, ['query', 'newQuery', 'newModelQuery'])) { - $reflection = new \ReflectionClass($model); + $builder = $this->getClassNameInModel($model, get_class($model->newModelQuery())); - $builder = get_class($model->newModelQuery()); - - $this->setMethod($method, "\\{$builder}|\\" . $reflection->getName()); + $this->setMethod($method, $builder . "|" . $this->getClassNameInModel($model, get_class($model))); } elseif (!method_exists('Illuminate\Database\Eloquent\Model', $method) && !Str::startsWith($method, 'get') ) { @@ -537,7 +556,10 @@ class ModelsCommand extends Command }); if ($relationObj instanceof Relation) { - $relatedModel = '\\' . get_class($relationObj->getRelated()); + $relatedModel = $this->getClassNameInModel( + $model, + get_class($relationObj->getRelated()) + ); $relations = [ 'hasManyThrough', @@ -549,9 +571,12 @@ class ModelsCommand extends Command ]; if (strpos(get_class($relationObj), 'Many') !== false) { //Collection or array of models (because Collection is Arrayable) + $relatedClass = '\\' . get_class($relationObj->getRelated()); + $collectionClass = $this->getCollectionClass($relatedClass); + $collectionClassNameInModel = $this->getClassNameInModel($model, $collectionClass); $this->setProperty( $method, - $this->getCollectionClass($relatedModel) . '|' . $relatedModel . '[]', + $collectionClassNameInModel . '|' . $relatedModel . '[]', true, null ); @@ -565,7 +590,7 @@ class ModelsCommand extends Command // Model isn't specified because relation is polymorphic $this->setProperty( $method, - '\Illuminate\Database\Eloquent\Model|\Eloquent', + $this->getClassNameInModel($model, Model::class) . '|\Eloquent', true, null ); @@ -598,7 +623,7 @@ class ModelsCommand extends Command */ protected function isRelationNullable(string $relation, Relation $relationObj): bool { - $reflectionObj = new \ReflectionObject($relationObj); + $reflectionObj = new ReflectionObject($relationObj); if (in_array($relation, ['hasOne', 'hasOneThrough', 'morphOne'], true)) { $defaultProp = $reflectionObj->getProperty('withDefault'); @@ -738,7 +763,8 @@ class ModelsCommand extends Command } if ($this->write && ! $phpdoc->getTagsByName('mixin')) { - $phpdoc->appendTag(Tag::createInstance("@mixin \\Eloquent", $phpdoc)); + $eloquentClassNameInModel = $this->getClassNameInModel($reflection, 'Eloquent'); + $phpdoc->appendTag(Tag::createInstance("@mixin " . $eloquentClassNameInModel, $phpdoc)); } if ($this->phpstorm_noinspections) { /** @@ -870,8 +896,13 @@ class ModelsCommand extends Command */ protected function getReturnTypeFromDocBlock(\ReflectionMethod $reflection) { + $phpDocContext = (new ContextFactory())->createFromReflector($reflection); + $context = new Context( + $phpDocContext->getNamespace(), + $phpDocContext->getNamespaceAliases() + ); $type = null; - $phpdoc = new DocBlock($reflection); + $phpdoc = new DocBlock($reflection, $context); if ($phpdoc->hasTag('return')) { $type = $phpdoc->getTagsByName('return')[0]->getType(); @@ -911,9 +942,11 @@ class ModelsCommand extends Command { $traits = class_uses(get_class($model), true); if (in_array('Illuminate\\Database\\Eloquent\\SoftDeletes', $traits)) { - $this->setMethod('withTrashed', '\Illuminate\Database\Query\Builder|\\' . get_class($model), []); - $this->setMethod('withoutTrashed', '\Illuminate\Database\Query\Builder|\\' . get_class($model), []); - $this->setMethod('onlyTrashed', '\Illuminate\Database\Query\Builder|\\' . get_class($model), []); + $modelName = $this->getClassNameInModel($model, get_class($model)); + $builder = $this->getClassNameInModel($model, \Illuminate\Database\Query\Builder::class); + $this->setMethod('withTrashed', $builder . '|' . $modelName, []); + $this->setMethod('withoutTrashed', $builder . '|' . $modelName, []); + $this->setMethod('onlyTrashed', $builder . '|' . $modelName, []); } } @@ -926,8 +959,10 @@ class ModelsCommand extends Command $collectionClass = $this->getCollectionClass(get_class($model)); if ($collectionClass !== '\\' . \Illuminate\Database\Eloquent\Collection::class) { - $this->setMethod('get', $collectionClass . '|static[]', ['$columns = [\'*\']']); - $this->setMethod('all', $collectionClass . '|static[]', ['$columns = [\'*\']']); + $collectionClassInModel = $this->getClassNameInModel($model, $collectionClass); + + $this->setMethod('get', $collectionClassInModel . '|static[]', ['$columns = [\'*\']']); + $this->setMethod('all', $collectionClassInModel . '|static[]', ['$columns = [\'*\']']); } } @@ -975,4 +1010,51 @@ class ModelsCommand extends Command return $type; } + + /** + * @param object|ReflectionClass $model + * @param string $type + * @return string + */ + protected function getTypeInModel(object $model, ?string $type): ?string + { + if ($type === null) { + return null; + } + + if (class_exists($type)) { + $type = $this->getClassNameInModel($model, $type); + } + + return $type; + } + + /** + * @param object|ReflectionClass $model + * @param string $className + * @return string + */ + protected function getClassNameInModel(object $model, string $className): string + { + $className = trim($className, '\\'); + $usedClassNames = $this->getUsedClassNames($model); + return $usedClassNames[$className] ?? ('\\' . $className); + } + + /** + * @param object|ReflectionClass $model + * @return string[] + */ + protected function getUsedClassNames(object $model): array + { + $reflection = $model instanceof ReflectionClass + ? $model + : new ReflectionObject($model) + ; + + $namespaceAliases = array_flip((new ContextFactory())->createFromReflector($reflection)->getNamespaceAliases()); + $namespaceAliases[$reflection->getName()] = $reflection->getShortName(); + + return $namespaceAliases; + } } diff --git a/tests/Console/ModelsCommand/CustomCollection/Test.php b/tests/Console/ModelsCommand/CustomCollection/Test.php index f4999f1..d67e75c 100644 --- a/tests/Console/ModelsCommand/CustomCollection/Test.php +++ b/tests/Console/ModelsCommand/CustomCollection/Test.php @@ -64,14 +64,14 @@ use Illuminate\Database\Eloquent\Relations\HasMany; * Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\CustomCollection\Models\Simple * * @property integer $id - * @property-read \Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\CustomCollection\Collections\SimpleCollection|\Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\CustomCollection\Models\Simple[] $relationHasMany + * @property-read SimpleCollection|Simple[] $relationHasMany * @property-read int|null $relation_has_many_count - * @method static \Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\CustomCollection\Collections\SimpleCollection|static[] all($columns = ['*']) - * @method static \Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\CustomCollection\Collections\SimpleCollection|static[] get($columns = ['*']) - * @method static \Illuminate\Database\Eloquent\Builder|\Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\CustomCollection\Models\Simple newModelQuery() - * @method static \Illuminate\Database\Eloquent\Builder|\Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\CustomCollection\Models\Simple newQuery() - * @method static \Illuminate\Database\Eloquent\Builder|\Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\CustomCollection\Models\Simple query() - * @method static \Illuminate\Database\Eloquent\Builder|\Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\CustomCollection\Models\Simple whereId($value) + * @method static SimpleCollection|static[] all($columns = ['*']) + * @method static SimpleCollection|static[] get($columns = ['*']) + * @method static \Illuminate\Database\Eloquent\Builder|Simple newModelQuery() + * @method static \Illuminate\Database\Eloquent\Builder|Simple newQuery() + * @method static \Illuminate\Database\Eloquent\Builder|Simple query() + * @method static \Illuminate\Database\Eloquent\Builder|Simple whereId($value) * @mixin \Eloquent */ class Simple extends Model diff --git a/tests/Console/ModelsCommand/CustomDate/Test.php b/tests/Console/ModelsCommand/CustomDate/Test.php index 59e064e..370a445 100644 --- a/tests/Console/ModelsCommand/CustomDate/Test.php +++ b/tests/Console/ModelsCommand/CustomDate/Test.php @@ -79,11 +79,11 @@ use Illuminate\Database\Eloquent\Model; * * @property \Carbon\CarbonImmutable|null $created_at * @property \Carbon\CarbonImmutable|null $updated_at - * @method static \Illuminate\Database\Eloquent\Builder|\Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\CustomDate\Models\CustomDate newModelQuery() - * @method static \Illuminate\Database\Eloquent\Builder|\Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\CustomDate\Models\CustomDate newQuery() - * @method static \Illuminate\Database\Eloquent\Builder|\Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\CustomDate\Models\CustomDate query() - * @method static \Illuminate\Database\Eloquent\Builder|\Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\CustomDate\Models\CustomDate whereCreatedAt($value) - * @method static \Illuminate\Database\Eloquent\Builder|\Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\CustomDate\Models\CustomDate whereUpdatedAt($value) + * @method static \Illuminate\Database\Eloquent\Builder|CustomDate newModelQuery() + * @method static \Illuminate\Database\Eloquent\Builder|CustomDate newQuery() + * @method static \Illuminate\Database\Eloquent\Builder|CustomDate query() + * @method static \Illuminate\Database\Eloquent\Builder|CustomDate whereCreatedAt($value) + * @method static \Illuminate\Database\Eloquent\Builder|CustomDate whereUpdatedAt($value) * @mixin \Eloquent */ class CustomDate extends Model diff --git a/tests/Console/ModelsCommand/GenerateBasicPhpdoc/Test.php b/tests/Console/ModelsCommand/GenerateBasicPhpdoc/Test.php index 9ab1a02..59f8320 100644 --- a/tests/Console/ModelsCommand/GenerateBasicPhpdoc/Test.php +++ b/tests/Console/ModelsCommand/GenerateBasicPhpdoc/Test.php @@ -133,82 +133,82 @@ use Illuminate\Database\Eloquent\Model; * @property string $macaddress_not_nullable * @property \Illuminate\Support\Carbon|null $created_at * @property \Illuminate\Support\Carbon|null $updated_at - * @method static \Illuminate\Database\Eloquent\Builder|\Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GenerateBasicPhpdoc\Models\Post newModelQuery() - * @method static \Illuminate\Database\Eloquent\Builder|\Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GenerateBasicPhpdoc\Models\Post newQuery() - * @method static \Illuminate\Database\Eloquent\Builder|\Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GenerateBasicPhpdoc\Models\Post query() - * @method static \Illuminate\Database\Eloquent\Builder|\Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GenerateBasicPhpdoc\Models\Post whereBigIntegerNotNullable($value) - * @method static \Illuminate\Database\Eloquent\Builder|\Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GenerateBasicPhpdoc\Models\Post whereBigIntegerNullable($value) - * @method static \Illuminate\Database\Eloquent\Builder|\Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GenerateBasicPhpdoc\Models\Post whereBinaryNotNullable($value) - * @method static \Illuminate\Database\Eloquent\Builder|\Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GenerateBasicPhpdoc\Models\Post whereBinaryNullable($value) - * @method static \Illuminate\Database\Eloquent\Builder|\Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GenerateBasicPhpdoc\Models\Post whereBooleanNotNullable($value) - * @method static \Illuminate\Database\Eloquent\Builder|\Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GenerateBasicPhpdoc\Models\Post whereBooleanNullable($value) - * @method static \Illuminate\Database\Eloquent\Builder|\Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GenerateBasicPhpdoc\Models\Post whereCharNotNullable($value) - * @method static \Illuminate\Database\Eloquent\Builder|\Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GenerateBasicPhpdoc\Models\Post whereCharNullable($value) - * @method static \Illuminate\Database\Eloquent\Builder|\Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GenerateBasicPhpdoc\Models\Post whereCreatedAt($value) - * @method static \Illuminate\Database\Eloquent\Builder|\Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GenerateBasicPhpdoc\Models\Post whereDateNotNullable($value) - * @method static \Illuminate\Database\Eloquent\Builder|\Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GenerateBasicPhpdoc\Models\Post whereDateNullable($value) - * @method static \Illuminate\Database\Eloquent\Builder|\Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GenerateBasicPhpdoc\Models\Post whereDatetimeNotNullable($value) - * @method static \Illuminate\Database\Eloquent\Builder|\Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GenerateBasicPhpdoc\Models\Post whereDatetimeNullable($value) - * @method static \Illuminate\Database\Eloquent\Builder|\Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GenerateBasicPhpdoc\Models\Post whereDatetimetzNotNullable($value) - * @method static \Illuminate\Database\Eloquent\Builder|\Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GenerateBasicPhpdoc\Models\Post whereDatetimetzNullable($value) - * @method static \Illuminate\Database\Eloquent\Builder|\Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GenerateBasicPhpdoc\Models\Post whereDecimalNotNullable($value) - * @method static \Illuminate\Database\Eloquent\Builder|\Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GenerateBasicPhpdoc\Models\Post whereDecimalNullable($value) - * @method static \Illuminate\Database\Eloquent\Builder|\Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GenerateBasicPhpdoc\Models\Post whereDoubleNotNullable($value) - * @method static \Illuminate\Database\Eloquent\Builder|\Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GenerateBasicPhpdoc\Models\Post whereDoubleNullable($value) - * @method static \Illuminate\Database\Eloquent\Builder|\Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GenerateBasicPhpdoc\Models\Post whereEnumNotNullable($value) - * @method static \Illuminate\Database\Eloquent\Builder|\Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GenerateBasicPhpdoc\Models\Post whereEnumNullable($value) - * @method static \Illuminate\Database\Eloquent\Builder|\Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GenerateBasicPhpdoc\Models\Post whereFloatNotNullable($value) - * @method static \Illuminate\Database\Eloquent\Builder|\Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GenerateBasicPhpdoc\Models\Post whereFloatNullable($value) - * @method static \Illuminate\Database\Eloquent\Builder|\Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GenerateBasicPhpdoc\Models\Post whereId($value) - * @method static \Illuminate\Database\Eloquent\Builder|\Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GenerateBasicPhpdoc\Models\Post whereIntegerNotNullable($value) - * @method static \Illuminate\Database\Eloquent\Builder|\Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GenerateBasicPhpdoc\Models\Post whereIntegerNullable($value) - * @method static \Illuminate\Database\Eloquent\Builder|\Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GenerateBasicPhpdoc\Models\Post whereIpaddressNotNullable($value) - * @method static \Illuminate\Database\Eloquent\Builder|\Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GenerateBasicPhpdoc\Models\Post whereIpaddressNullable($value) - * @method static \Illuminate\Database\Eloquent\Builder|\Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GenerateBasicPhpdoc\Models\Post whereJsonNotNullable($value) - * @method static \Illuminate\Database\Eloquent\Builder|\Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GenerateBasicPhpdoc\Models\Post whereJsonNullable($value) - * @method static \Illuminate\Database\Eloquent\Builder|\Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GenerateBasicPhpdoc\Models\Post whereJsonbNotNullable($value) - * @method static \Illuminate\Database\Eloquent\Builder|\Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GenerateBasicPhpdoc\Models\Post whereJsonbNullable($value) - * @method static \Illuminate\Database\Eloquent\Builder|\Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GenerateBasicPhpdoc\Models\Post whereLongTextNotNullable($value) - * @method static \Illuminate\Database\Eloquent\Builder|\Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GenerateBasicPhpdoc\Models\Post whereLongTextNullable($value) - * @method static \Illuminate\Database\Eloquent\Builder|\Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GenerateBasicPhpdoc\Models\Post whereMacaddressNotNullable($value) - * @method static \Illuminate\Database\Eloquent\Builder|\Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GenerateBasicPhpdoc\Models\Post whereMacaddressNullable($value) - * @method static \Illuminate\Database\Eloquent\Builder|\Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GenerateBasicPhpdoc\Models\Post whereMediumIntegerNotNullable($value) - * @method static \Illuminate\Database\Eloquent\Builder|\Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GenerateBasicPhpdoc\Models\Post whereMediumIntegerNullable($value) - * @method static \Illuminate\Database\Eloquent\Builder|\Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GenerateBasicPhpdoc\Models\Post whereMediumTextNotNullable($value) - * @method static \Illuminate\Database\Eloquent\Builder|\Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GenerateBasicPhpdoc\Models\Post whereMediumTextNullable($value) - * @method static \Illuminate\Database\Eloquent\Builder|\Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GenerateBasicPhpdoc\Models\Post whereSmallIntegerNotNullable($value) - * @method static \Illuminate\Database\Eloquent\Builder|\Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GenerateBasicPhpdoc\Models\Post whereSmallIntegerNullable($value) - * @method static \Illuminate\Database\Eloquent\Builder|\Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GenerateBasicPhpdoc\Models\Post whereStringNotNullable($value) - * @method static \Illuminate\Database\Eloquent\Builder|\Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GenerateBasicPhpdoc\Models\Post whereStringNullable($value) - * @method static \Illuminate\Database\Eloquent\Builder|\Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GenerateBasicPhpdoc\Models\Post whereTextNotNullable($value) - * @method static \Illuminate\Database\Eloquent\Builder|\Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GenerateBasicPhpdoc\Models\Post whereTextNullable($value) - * @method static \Illuminate\Database\Eloquent\Builder|\Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GenerateBasicPhpdoc\Models\Post whereTimeNotNullable($value) - * @method static \Illuminate\Database\Eloquent\Builder|\Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GenerateBasicPhpdoc\Models\Post whereTimeNullable($value) - * @method static \Illuminate\Database\Eloquent\Builder|\Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GenerateBasicPhpdoc\Models\Post whereTimestampNotNullable($value) - * @method static \Illuminate\Database\Eloquent\Builder|\Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GenerateBasicPhpdoc\Models\Post whereTimestampNullable($value) - * @method static \Illuminate\Database\Eloquent\Builder|\Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GenerateBasicPhpdoc\Models\Post whereTimestamptzNotNullable($value) - * @method static \Illuminate\Database\Eloquent\Builder|\Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GenerateBasicPhpdoc\Models\Post whereTimestamptzNullable($value) - * @method static \Illuminate\Database\Eloquent\Builder|\Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GenerateBasicPhpdoc\Models\Post whereTimetzNotNullable($value) - * @method static \Illuminate\Database\Eloquent\Builder|\Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GenerateBasicPhpdoc\Models\Post whereTimetzNullable($value) - * @method static \Illuminate\Database\Eloquent\Builder|\Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GenerateBasicPhpdoc\Models\Post whereTinyIntegerNotNullable($value) - * @method static \Illuminate\Database\Eloquent\Builder|\Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GenerateBasicPhpdoc\Models\Post whereTinyIntegerNullable($value) - * @method static \Illuminate\Database\Eloquent\Builder|\Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GenerateBasicPhpdoc\Models\Post whereUnsignedBigIntegerNotNullable($value) - * @method static \Illuminate\Database\Eloquent\Builder|\Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GenerateBasicPhpdoc\Models\Post whereUnsignedBigIntegerNullable($value) - * @method static \Illuminate\Database\Eloquent\Builder|\Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GenerateBasicPhpdoc\Models\Post whereUnsignedDecimalNotNullable($value) - * @method static \Illuminate\Database\Eloquent\Builder|\Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GenerateBasicPhpdoc\Models\Post whereUnsignedDecimalNullable($value) - * @method static \Illuminate\Database\Eloquent\Builder|\Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GenerateBasicPhpdoc\Models\Post whereUnsignedIntegerNotNullable($value) - * @method static \Illuminate\Database\Eloquent\Builder|\Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GenerateBasicPhpdoc\Models\Post whereUnsignedIntegerNullable($value) - * @method static \Illuminate\Database\Eloquent\Builder|\Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GenerateBasicPhpdoc\Models\Post whereUnsignedMediumIntegerNotNullable($value) - * @method static \Illuminate\Database\Eloquent\Builder|\Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GenerateBasicPhpdoc\Models\Post whereUnsignedMediumIntegerNullable($value) - * @method static \Illuminate\Database\Eloquent\Builder|\Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GenerateBasicPhpdoc\Models\Post whereUnsignedSmallIntegerNotNullable($value) - * @method static \Illuminate\Database\Eloquent\Builder|\Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GenerateBasicPhpdoc\Models\Post whereUnsignedSmallIntegerNullable($value) - * @method static \Illuminate\Database\Eloquent\Builder|\Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GenerateBasicPhpdoc\Models\Post whereUnsignedTinyIntegerNotNullable($value) - * @method static \Illuminate\Database\Eloquent\Builder|\Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GenerateBasicPhpdoc\Models\Post whereUnsignedTinyIntegerNullable($value) - * @method static \Illuminate\Database\Eloquent\Builder|\Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GenerateBasicPhpdoc\Models\Post whereUpdatedAt($value) - * @method static \Illuminate\Database\Eloquent\Builder|\Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GenerateBasicPhpdoc\Models\Post whereUuidNotNullable($value) - * @method static \Illuminate\Database\Eloquent\Builder|\Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GenerateBasicPhpdoc\Models\Post whereUuidNullable($value) - * @method static \Illuminate\Database\Eloquent\Builder|\Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GenerateBasicPhpdoc\Models\Post whereYearNotNullable($value) - * @method static \Illuminate\Database\Eloquent\Builder|\Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GenerateBasicPhpdoc\Models\Post whereYearNullable($value) + * @method static \Illuminate\Database\Eloquent\Builder|Post newModelQuery() + * @method static \Illuminate\Database\Eloquent\Builder|Post newQuery() + * @method static \Illuminate\Database\Eloquent\Builder|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) * @mixin \Eloquent */ class Post extends Model diff --git a/tests/Console/ModelsCommand/GenerateBasicPhpdocCamel/Test.php b/tests/Console/ModelsCommand/GenerateBasicPhpdocCamel/Test.php index d97ed67..bf0a64b 100644 --- a/tests/Console/ModelsCommand/GenerateBasicPhpdocCamel/Test.php +++ b/tests/Console/ModelsCommand/GenerateBasicPhpdocCamel/Test.php @@ -135,82 +135,82 @@ use Illuminate\Database\Eloquent\Model; * @property string $macaddressNotNullable * @property \Illuminate\Support\Carbon|null $createdAt * @property \Illuminate\Support\Carbon|null $updatedAt - * @method static \Illuminate\Database\Eloquent\Builder|\Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GenerateBasicPhpdocCamel\Models\Post newModelQuery() - * @method static \Illuminate\Database\Eloquent\Builder|\Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GenerateBasicPhpdocCamel\Models\Post newQuery() - * @method static \Illuminate\Database\Eloquent\Builder|\Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GenerateBasicPhpdocCamel\Models\Post query() - * @method static \Illuminate\Database\Eloquent\Builder|\Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GenerateBasicPhpdocCamel\Models\Post whereBigIntegerNotNullable($value) - * @method static \Illuminate\Database\Eloquent\Builder|\Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GenerateBasicPhpdocCamel\Models\Post whereBigIntegerNullable($value) - * @method static \Illuminate\Database\Eloquent\Builder|\Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GenerateBasicPhpdocCamel\Models\Post whereBinaryNotNullable($value) - * @method static \Illuminate\Database\Eloquent\Builder|\Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GenerateBasicPhpdocCamel\Models\Post whereBinaryNullable($value) - * @method static \Illuminate\Database\Eloquent\Builder|\Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GenerateBasicPhpdocCamel\Models\Post whereBooleanNotNullable($value) - * @method static \Illuminate\Database\Eloquent\Builder|\Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GenerateBasicPhpdocCamel\Models\Post whereBooleanNullable($value) - * @method static \Illuminate\Database\Eloquent\Builder|\Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GenerateBasicPhpdocCamel\Models\Post whereCharNotNullable($value) - * @method static \Illuminate\Database\Eloquent\Builder|\Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GenerateBasicPhpdocCamel\Models\Post whereCharNullable($value) - * @method static \Illuminate\Database\Eloquent\Builder|\Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GenerateBasicPhpdocCamel\Models\Post whereCreatedAt($value) - * @method static \Illuminate\Database\Eloquent\Builder|\Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GenerateBasicPhpdocCamel\Models\Post whereDateNotNullable($value) - * @method static \Illuminate\Database\Eloquent\Builder|\Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GenerateBasicPhpdocCamel\Models\Post whereDateNullable($value) - * @method static \Illuminate\Database\Eloquent\Builder|\Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GenerateBasicPhpdocCamel\Models\Post whereDatetimeNotNullable($value) - * @method static \Illuminate\Database\Eloquent\Builder|\Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GenerateBasicPhpdocCamel\Models\Post whereDatetimeNullable($value) - * @method static \Illuminate\Database\Eloquent\Builder|\Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GenerateBasicPhpdocCamel\Models\Post whereDatetimetzNotNullable($value) - * @method static \Illuminate\Database\Eloquent\Builder|\Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GenerateBasicPhpdocCamel\Models\Post whereDatetimetzNullable($value) - * @method static \Illuminate\Database\Eloquent\Builder|\Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GenerateBasicPhpdocCamel\Models\Post whereDecimalNotNullable($value) - * @method static \Illuminate\Database\Eloquent\Builder|\Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GenerateBasicPhpdocCamel\Models\Post whereDecimalNullable($value) - * @method static \Illuminate\Database\Eloquent\Builder|\Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GenerateBasicPhpdocCamel\Models\Post whereDoubleNotNullable($value) - * @method static \Illuminate\Database\Eloquent\Builder|\Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GenerateBasicPhpdocCamel\Models\Post whereDoubleNullable($value) - * @method static \Illuminate\Database\Eloquent\Builder|\Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GenerateBasicPhpdocCamel\Models\Post whereEnumNotNullable($value) - * @method static \Illuminate\Database\Eloquent\Builder|\Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GenerateBasicPhpdocCamel\Models\Post whereEnumNullable($value) - * @method static \Illuminate\Database\Eloquent\Builder|\Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GenerateBasicPhpdocCamel\Models\Post whereFloatNotNullable($value) - * @method static \Illuminate\Database\Eloquent\Builder|\Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GenerateBasicPhpdocCamel\Models\Post whereFloatNullable($value) - * @method static \Illuminate\Database\Eloquent\Builder|\Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GenerateBasicPhpdocCamel\Models\Post whereId($value) - * @method static \Illuminate\Database\Eloquent\Builder|\Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GenerateBasicPhpdocCamel\Models\Post whereIntegerNotNullable($value) - * @method static \Illuminate\Database\Eloquent\Builder|\Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GenerateBasicPhpdocCamel\Models\Post whereIntegerNullable($value) - * @method static \Illuminate\Database\Eloquent\Builder|\Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GenerateBasicPhpdocCamel\Models\Post whereIpaddressNotNullable($value) - * @method static \Illuminate\Database\Eloquent\Builder|\Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GenerateBasicPhpdocCamel\Models\Post whereIpaddressNullable($value) - * @method static \Illuminate\Database\Eloquent\Builder|\Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GenerateBasicPhpdocCamel\Models\Post whereJsonNotNullable($value) - * @method static \Illuminate\Database\Eloquent\Builder|\Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GenerateBasicPhpdocCamel\Models\Post whereJsonNullable($value) - * @method static \Illuminate\Database\Eloquent\Builder|\Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GenerateBasicPhpdocCamel\Models\Post whereJsonbNotNullable($value) - * @method static \Illuminate\Database\Eloquent\Builder|\Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GenerateBasicPhpdocCamel\Models\Post whereJsonbNullable($value) - * @method static \Illuminate\Database\Eloquent\Builder|\Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GenerateBasicPhpdocCamel\Models\Post whereLongTextNotNullable($value) - * @method static \Illuminate\Database\Eloquent\Builder|\Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GenerateBasicPhpdocCamel\Models\Post whereLongTextNullable($value) - * @method static \Illuminate\Database\Eloquent\Builder|\Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GenerateBasicPhpdocCamel\Models\Post whereMacaddressNotNullable($value) - * @method static \Illuminate\Database\Eloquent\Builder|\Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GenerateBasicPhpdocCamel\Models\Post whereMacaddressNullable($value) - * @method static \Illuminate\Database\Eloquent\Builder|\Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GenerateBasicPhpdocCamel\Models\Post whereMediumIntegerNotNullable($value) - * @method static \Illuminate\Database\Eloquent\Builder|\Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GenerateBasicPhpdocCamel\Models\Post whereMediumIntegerNullable($value) - * @method static \Illuminate\Database\Eloquent\Builder|\Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GenerateBasicPhpdocCamel\Models\Post whereMediumTextNotNullable($value) - * @method static \Illuminate\Database\Eloquent\Builder|\Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GenerateBasicPhpdocCamel\Models\Post whereMediumTextNullable($value) - * @method static \Illuminate\Database\Eloquent\Builder|\Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GenerateBasicPhpdocCamel\Models\Post whereSmallIntegerNotNullable($value) - * @method static \Illuminate\Database\Eloquent\Builder|\Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GenerateBasicPhpdocCamel\Models\Post whereSmallIntegerNullable($value) - * @method static \Illuminate\Database\Eloquent\Builder|\Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GenerateBasicPhpdocCamel\Models\Post whereStringNotNullable($value) - * @method static \Illuminate\Database\Eloquent\Builder|\Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GenerateBasicPhpdocCamel\Models\Post whereStringNullable($value) - * @method static \Illuminate\Database\Eloquent\Builder|\Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GenerateBasicPhpdocCamel\Models\Post whereTextNotNullable($value) - * @method static \Illuminate\Database\Eloquent\Builder|\Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GenerateBasicPhpdocCamel\Models\Post whereTextNullable($value) - * @method static \Illuminate\Database\Eloquent\Builder|\Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GenerateBasicPhpdocCamel\Models\Post whereTimeNotNullable($value) - * @method static \Illuminate\Database\Eloquent\Builder|\Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GenerateBasicPhpdocCamel\Models\Post whereTimeNullable($value) - * @method static \Illuminate\Database\Eloquent\Builder|\Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GenerateBasicPhpdocCamel\Models\Post whereTimestampNotNullable($value) - * @method static \Illuminate\Database\Eloquent\Builder|\Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GenerateBasicPhpdocCamel\Models\Post whereTimestampNullable($value) - * @method static \Illuminate\Database\Eloquent\Builder|\Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GenerateBasicPhpdocCamel\Models\Post whereTimestamptzNotNullable($value) - * @method static \Illuminate\Database\Eloquent\Builder|\Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GenerateBasicPhpdocCamel\Models\Post whereTimestamptzNullable($value) - * @method static \Illuminate\Database\Eloquent\Builder|\Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GenerateBasicPhpdocCamel\Models\Post whereTimetzNotNullable($value) - * @method static \Illuminate\Database\Eloquent\Builder|\Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GenerateBasicPhpdocCamel\Models\Post whereTimetzNullable($value) - * @method static \Illuminate\Database\Eloquent\Builder|\Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GenerateBasicPhpdocCamel\Models\Post whereTinyIntegerNotNullable($value) - * @method static \Illuminate\Database\Eloquent\Builder|\Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GenerateBasicPhpdocCamel\Models\Post whereTinyIntegerNullable($value) - * @method static \Illuminate\Database\Eloquent\Builder|\Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GenerateBasicPhpdocCamel\Models\Post whereUnsignedBigIntegerNotNullable($value) - * @method static \Illuminate\Database\Eloquent\Builder|\Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GenerateBasicPhpdocCamel\Models\Post whereUnsignedBigIntegerNullable($value) - * @method static \Illuminate\Database\Eloquent\Builder|\Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GenerateBasicPhpdocCamel\Models\Post whereUnsignedDecimalNotNullable($value) - * @method static \Illuminate\Database\Eloquent\Builder|\Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GenerateBasicPhpdocCamel\Models\Post whereUnsignedDecimalNullable($value) - * @method static \Illuminate\Database\Eloquent\Builder|\Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GenerateBasicPhpdocCamel\Models\Post whereUnsignedIntegerNotNullable($value) - * @method static \Illuminate\Database\Eloquent\Builder|\Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GenerateBasicPhpdocCamel\Models\Post whereUnsignedIntegerNullable($value) - * @method static \Illuminate\Database\Eloquent\Builder|\Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GenerateBasicPhpdocCamel\Models\Post whereUnsignedMediumIntegerNotNullable($value) - * @method static \Illuminate\Database\Eloquent\Builder|\Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GenerateBasicPhpdocCamel\Models\Post whereUnsignedMediumIntegerNullable($value) - * @method static \Illuminate\Database\Eloquent\Builder|\Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GenerateBasicPhpdocCamel\Models\Post whereUnsignedSmallIntegerNotNullable($value) - * @method static \Illuminate\Database\Eloquent\Builder|\Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GenerateBasicPhpdocCamel\Models\Post whereUnsignedSmallIntegerNullable($value) - * @method static \Illuminate\Database\Eloquent\Builder|\Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GenerateBasicPhpdocCamel\Models\Post whereUnsignedTinyIntegerNotNullable($value) - * @method static \Illuminate\Database\Eloquent\Builder|\Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GenerateBasicPhpdocCamel\Models\Post whereUnsignedTinyIntegerNullable($value) - * @method static \Illuminate\Database\Eloquent\Builder|\Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GenerateBasicPhpdocCamel\Models\Post whereUpdatedAt($value) - * @method static \Illuminate\Database\Eloquent\Builder|\Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GenerateBasicPhpdocCamel\Models\Post whereUuidNotNullable($value) - * @method static \Illuminate\Database\Eloquent\Builder|\Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GenerateBasicPhpdocCamel\Models\Post whereUuidNullable($value) - * @method static \Illuminate\Database\Eloquent\Builder|\Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GenerateBasicPhpdocCamel\Models\Post whereYearNotNullable($value) - * @method static \Illuminate\Database\Eloquent\Builder|\Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GenerateBasicPhpdocCamel\Models\Post whereYearNullable($value) + * @method static \Illuminate\Database\Eloquent\Builder|Post newModelQuery() + * @method static \Illuminate\Database\Eloquent\Builder|Post newQuery() + * @method static \Illuminate\Database\Eloquent\Builder|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) * @mixin \Eloquent */ class Post extends Model diff --git a/tests/Console/ModelsCommand/GeneratePhpdocWithFqn/Casts/CastType.php b/tests/Console/ModelsCommand/GeneratePhpdocWithFqn/Casts/CastType.php new file mode 100644 index 0000000..f401943 --- /dev/null +++ b/tests/Console/ModelsCommand/GeneratePhpdocWithFqn/Casts/CastType.php @@ -0,0 +1,10 @@ + CastType::class, + ]; + + public function posts(): HasMany + { + return $this->hasMany(Post::class); + } + + public function scopeNull($query, string $unusedParam) + { + return $query; + } +} diff --git a/tests/Console/ModelsCommand/GeneratePhpdocWithFqn/Test.php b/tests/Console/ModelsCommand/GeneratePhpdocWithFqn/Test.php new file mode 100644 index 0000000..3f3ed78 --- /dev/null +++ b/tests/Console/ModelsCommand/GeneratePhpdocWithFqn/Test.php @@ -0,0 +1,257 @@ +set('ide-helper', [ + 'model_locations' => [ + // This is calculated from the base_path() which points to + // vendor/orchestra/testbench-core/laravel + '/../../../../tests/Console/ModelsCommand/GeneratePhpdocWithFqn/Models', + ], + ]); + } + + public function test(): void + { + $actualContent = null; + $mockFilesystem = Mockery::mock(Filesystem::class); + $mockFilesystem + ->shouldReceive('get') + ->andReturn(file_get_contents(__DIR__ . '/Models/Post.php')) + ->once(); + $mockFilesystem + ->shouldReceive('put') + ->with( + Mockery::any(), + Mockery::capture($actualContent) + ) + ->andReturn(1) // Simulate we wrote _something_ to the file + ->once(); + + $this->instance(Filesystem::class, $mockFilesystem); + + $command = $this->app->make(ModelsCommand::class); + + $tester = $this->runCommand($command, [ + '--write' => true, + ]); + + $this->assertSame(0, $tester->getStatusCode()); + $this->assertEmpty($tester->getDisplay()); + + $expectedContent = <<<'PHP' + CastType::class, + ]; + + public function posts(): HasMany + { + return $this->hasMany(Post::class); + } + + public function scopeNull($query, string $unusedParam) + { + return $query; + } +} + +PHP; + + $this->assertSame($expectedContent, $actualContent); + } +} diff --git a/tests/Console/ModelsCommand/Getter/Models/Simple.php b/tests/Console/ModelsCommand/Getter/Models/Simple.php index 23d6e91..28906aa 100644 --- a/tests/Console/ModelsCommand/Getter/Models/Simple.php +++ b/tests/Console/ModelsCommand/Getter/Models/Simple.php @@ -37,7 +37,7 @@ class Simple extends Model } /** - * @return what|ever|we-write/here + * @return \what|\ever|\we-write/here */ public function getAttributeTakesPhpdocLiteralAttribute() { diff --git a/tests/Console/ModelsCommand/Getter/Test.php b/tests/Console/ModelsCommand/Getter/Test.php index 3bf60ba..a4553ac 100644 --- a/tests/Console/ModelsCommand/Getter/Test.php +++ b/tests/Console/ModelsCommand/Getter/Test.php @@ -68,7 +68,7 @@ use Illuminate\Database\Eloquent\Model; * @property-read callable $attribute_returns_callable * @property-read bool $attribute_returns_float * @property-read \Illuminate\Support\Facades\Date $attribute_returns_fqn_class - * @property-read \DateTime $attribute_returns_imported_class + * @property-read DateTime $attribute_returns_imported_class * @property-read array|null $attribute_returns_nullable_array * @property-read bool|null $attribute_returns_nullable_bool * @property-read callable|null $attribute_returns_nullable_callable @@ -82,10 +82,10 @@ use Illuminate\Database\Eloquent\Model; * @property-read int $attribute_with_int_return_type_and_phpdoc * @property-read int $attribute_with_int_return_type * @property-read mixed $attribute_without_type - * @method static \Illuminate\Database\Eloquent\Builder|\Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\Getter\Models\Simple newModelQuery() - * @method static \Illuminate\Database\Eloquent\Builder|\Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\Getter\Models\Simple newQuery() - * @method static \Illuminate\Database\Eloquent\Builder|\Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\Getter\Models\Simple query() - * @method static \Illuminate\Database\Eloquent\Builder|\Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\Getter\Models\Simple whereId($value) + * @method static \Illuminate\Database\Eloquent\Builder|Simple newModelQuery() + * @method static \Illuminate\Database\Eloquent\Builder|Simple newQuery() + * @method static \Illuminate\Database\Eloquent\Builder|Simple query() + * @method static \Illuminate\Database\Eloquent\Builder|Simple whereId($value) * @mixin \Eloquent */ class Simple extends Model @@ -120,7 +120,7 @@ class Simple extends Model } /** - * @return what|ever|we-write/here + * @return \what|\ever|\we-write/here */ public function getAttributeTakesPhpdocLiteralAttribute() { diff --git a/tests/Console/ModelsCommand/Ignored/Test.php b/tests/Console/ModelsCommand/Ignored/Test.php index 95d916d..d8b43ce 100644 --- a/tests/Console/ModelsCommand/Ignored/Test.php +++ b/tests/Console/ModelsCommand/Ignored/Test.php @@ -65,9 +65,9 @@ use Illuminate\Database\Eloquent\Model; /** * Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\Ignored\Models\NotIgnored * - * @method static \Illuminate\Database\Eloquent\Builder|\Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\Ignored\Models\NotIgnored newModelQuery() - * @method static \Illuminate\Database\Eloquent\Builder|\Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\Ignored\Models\NotIgnored newQuery() - * @method static \Illuminate\Database\Eloquent\Builder|\Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\Ignored\Models\NotIgnored query() + * @method static \Illuminate\Database\Eloquent\Builder|NotIgnored newModelQuery() + * @method static \Illuminate\Database\Eloquent\Builder|NotIgnored newQuery() + * @method static \Illuminate\Database\Eloquent\Builder|NotIgnored query() * @mixin \Eloquent */ class NotIgnored extends Model diff --git a/tests/Console/ModelsCommand/Interfaces/Test.php b/tests/Console/ModelsCommand/Interfaces/Test.php index 7c3cfb3..93987d9 100644 --- a/tests/Console/ModelsCommand/Interfaces/Test.php +++ b/tests/Console/ModelsCommand/Interfaces/Test.php @@ -64,9 +64,9 @@ namespace Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\Interfaces\Model /** * Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\Interfaces\Models\User * - * @method static \Illuminate\Database\Eloquent\Builder|\Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\Interfaces\Models\User newModelQuery() - * @method static \Illuminate\Database\Eloquent\Builder|\Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\Interfaces\Models\User newQuery() - * @method static \Illuminate\Database\Eloquent\Builder|\Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\Interfaces\Models\User query() + * @method static \Illuminate\Database\Eloquent\Builder|User newModelQuery() + * @method static \Illuminate\Database\Eloquent\Builder|User newQuery() + * @method static \Illuminate\Database\Eloquent\Builder|User query() */ class User extends \Eloquent implements \Illuminate\Contracts\Auth\Authenticatable {} } diff --git a/tests/Console/ModelsCommand/LaravelCustomCasts/Casts/CustomCasterWithDocblockReturnFqn.php b/tests/Console/ModelsCommand/LaravelCustomCasts/Casts/CustomCasterWithDocblockReturnFqn.php new file mode 100644 index 0000000..ecd0fbd --- /dev/null +++ b/tests/Console/ModelsCommand/LaravelCustomCasts/Casts/CustomCasterWithDocblockReturnFqn.php @@ -0,0 +1,25 @@ + CustomCasterWithReturnType::class, 'casted_property_with_return_docblock' => CustomCasterWithDocblockReturn::class, + 'casted_property_with_return_docblock_fqn' => CustomCasterWithDocblockReturnFqn::class, 'casted_property_with_return_primitive' => CustomCasterWithPrimitiveReturn::class, 'casted_property_with_return_primitive_docblock' => CustomCasterWithPrimitiveDocblockReturn::class, 'casted_property_with_return_nullable_primitive' => CustomCasterWithNullablePrimitiveReturn::class, diff --git a/tests/Console/ModelsCommand/LaravelCustomCasts/Test.php b/tests/Console/ModelsCommand/LaravelCustomCasts/Test.php index 1ebacf9..002d578 100644 --- a/tests/Console/ModelsCommand/LaravelCustomCasts/Test.php +++ b/tests/Console/ModelsCommand/LaravelCustomCasts/Test.php @@ -67,6 +67,7 @@ class Test extends AbstractModelsCommand namespace Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\LaravelCustomCasts\Models; use Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\LaravelCustomCasts\Casts\CustomCasterWithDocblockReturn; +use Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\LaravelCustomCasts\Casts\CustomCasterWithDocblockReturnFqn; use Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\LaravelCustomCasts\Casts\CustomCasterWithNullablePrimitiveReturn; use Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\LaravelCustomCasts\Casts\CustomCasterWithoutReturnType; use Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\LaravelCustomCasts\Casts\CustomCasterWithPrimitiveDocblockReturn; @@ -78,20 +79,22 @@ use Illuminate\Database\Eloquent\Model; * Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\LaravelCustomCasts\Models\CustomCast * * @property \Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\LaravelCustomCasts\Casts\CastedProperty $casted_property_with_return_type - * @property \CastedProperty $casted_property_with_return_docblock + * @property \Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\LaravelCustomCasts\Casts\CastedProperty $casted_property_with_return_docblock + * @property \Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\LaravelCustomCasts\Casts\CastedProperty $casted_property_with_return_docblock_fqn * @property array $casted_property_with_return_primitive * @property array|null $casted_property_with_return_primitive_docblock * @property array|null $casted_property_with_return_nullable_primitive * @property $casted_property_without_return - * @method static \Illuminate\Database\Eloquent\Builder|\Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\LaravelCustomCasts\Models\CustomCast newModelQuery() - * @method static \Illuminate\Database\Eloquent\Builder|\Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\LaravelCustomCasts\Models\CustomCast newQuery() - * @method static \Illuminate\Database\Eloquent\Builder|\Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\LaravelCustomCasts\Models\CustomCast query() - * @method static \Illuminate\Database\Eloquent\Builder|\Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\LaravelCustomCasts\Models\CustomCast whereCastedPropertyWithReturnDocblock($value) - * @method static \Illuminate\Database\Eloquent\Builder|\Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\LaravelCustomCasts\Models\CustomCast whereCastedPropertyWithReturnNullablePrimitive($value) - * @method static \Illuminate\Database\Eloquent\Builder|\Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\LaravelCustomCasts\Models\CustomCast whereCastedPropertyWithReturnPrimitive($value) - * @method static \Illuminate\Database\Eloquent\Builder|\Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\LaravelCustomCasts\Models\CustomCast whereCastedPropertyWithReturnPrimitiveDocblock($value) - * @method static \Illuminate\Database\Eloquent\Builder|\Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\LaravelCustomCasts\Models\CustomCast whereCastedPropertyWithReturnType($value) - * @method static \Illuminate\Database\Eloquent\Builder|\Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\LaravelCustomCasts\Models\CustomCast whereCastedPropertyWithoutReturn($value) + * @method static \Illuminate\Database\Eloquent\Builder|CustomCast newModelQuery() + * @method static \Illuminate\Database\Eloquent\Builder|CustomCast newQuery() + * @method static \Illuminate\Database\Eloquent\Builder|CustomCast query() + * @method static \Illuminate\Database\Eloquent\Builder|CustomCast whereCastedPropertyWithReturnDocblock($value) + * @method static \Illuminate\Database\Eloquent\Builder|CustomCast whereCastedPropertyWithReturnDocblockFqn($value) + * @method static \Illuminate\Database\Eloquent\Builder|CustomCast whereCastedPropertyWithReturnNullablePrimitive($value) + * @method static \Illuminate\Database\Eloquent\Builder|CustomCast whereCastedPropertyWithReturnPrimitive($value) + * @method static \Illuminate\Database\Eloquent\Builder|CustomCast whereCastedPropertyWithReturnPrimitiveDocblock($value) + * @method static \Illuminate\Database\Eloquent\Builder|CustomCast whereCastedPropertyWithReturnType($value) + * @method static \Illuminate\Database\Eloquent\Builder|CustomCast whereCastedPropertyWithoutReturn($value) * @mixin \Eloquent */ class CustomCast extends Model @@ -99,6 +102,7 @@ class CustomCast extends Model protected $casts = [ 'casted_property_with_return_type' => CustomCasterWithReturnType::class, 'casted_property_with_return_docblock' => CustomCasterWithDocblockReturn::class, + 'casted_property_with_return_docblock_fqn' => CustomCasterWithDocblockReturnFqn::class, 'casted_property_with_return_primitive' => CustomCasterWithPrimitiveReturn::class, 'casted_property_with_return_primitive_docblock' => CustomCasterWithPrimitiveDocblockReturn::class, 'casted_property_with_return_nullable_primitive' => CustomCasterWithNullablePrimitiveReturn::class, diff --git a/tests/Console/ModelsCommand/PHPStormNoInspection/Test.php b/tests/Console/ModelsCommand/PHPStormNoInspection/Test.php index 3a95dc7..06eb817 100644 --- a/tests/Console/ModelsCommand/PHPStormNoInspection/Test.php +++ b/tests/Console/ModelsCommand/PHPStormNoInspection/Test.php @@ -62,10 +62,10 @@ use Illuminate\Database\Eloquent\Model; * Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\PHPStormNoInspection\Models\Simple * * @property integer $id - * @method static \Illuminate\Database\Eloquent\Builder|\Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\PHPStormNoInspection\Models\Simple newModelQuery() - * @method static \Illuminate\Database\Eloquent\Builder|\Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\PHPStormNoInspection\Models\Simple newQuery() - * @method static \Illuminate\Database\Eloquent\Builder|\Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\PHPStormNoInspection\Models\Simple query() - * @method static \Illuminate\Database\Eloquent\Builder|\Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\PHPStormNoInspection\Models\Simple whereId($value) + * @method static \Illuminate\Database\Eloquent\Builder|Simple newModelQuery() + * @method static \Illuminate\Database\Eloquent\Builder|Simple newQuery() + * @method static \Illuminate\Database\Eloquent\Builder|Simple query() + * @method static \Illuminate\Database\Eloquent\Builder|Simple whereId($value) * @mixin \Eloquent */ class Simple extends Model @@ -117,10 +117,10 @@ use Illuminate\Database\Eloquent\Model; * Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\PHPStormNoInspection\Models\Simple * * @property integer $id - * @method static \Illuminate\Database\Eloquent\Builder|\Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\PHPStormNoInspection\Models\Simple newModelQuery() - * @method static \Illuminate\Database\Eloquent\Builder|\Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\PHPStormNoInspection\Models\Simple newQuery() - * @method static \Illuminate\Database\Eloquent\Builder|\Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\PHPStormNoInspection\Models\Simple query() - * @method static \Illuminate\Database\Eloquent\Builder|\Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\PHPStormNoInspection\Models\Simple whereId($value) + * @method static \Illuminate\Database\Eloquent\Builder|Simple newModelQuery() + * @method static \Illuminate\Database\Eloquent\Builder|Simple newQuery() + * @method static \Illuminate\Database\Eloquent\Builder|Simple query() + * @method static \Illuminate\Database\Eloquent\Builder|Simple whereId($value) * @mixin \Eloquent * @noinspection PhpFullyQualifiedNameUsageInspection * @noinspection PhpUnnecessaryFullyQualifiedNameInspection diff --git a/tests/Console/ModelsCommand/Relations/Test.php b/tests/Console/ModelsCommand/Relations/Test.php index 9fa97a7..d67b5a6 100644 --- a/tests/Console/ModelsCommand/Relations/Test.php +++ b/tests/Console/ModelsCommand/Relations/Test.php @@ -70,29 +70,29 @@ use Illuminate\Database\Eloquent\Relations\MorphToMany; * Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\Relations\Models\Simple * * @property integer $id - * @property-read \Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\Relations\Models\Simple $relationBelongsTo - * @property-read \Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\Relations\ModelsOtherNamespace\AnotherModel $relationBelongsToInAnotherNamespace - * @property-read \Illuminate\Database\Eloquent\Collection|\Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\Relations\Models\Simple[] $relationBelongsToMany + * @property-read Simple $relationBelongsTo + * @property-read AnotherModel $relationBelongsToInAnotherNamespace + * @property-read \Illuminate\Database\Eloquent\Collection|Simple[] $relationBelongsToMany * @property-read int|null $relation_belongs_to_many_count - * @property-read \Illuminate\Database\Eloquent\Collection|\Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\Relations\Models\Simple[] $relationBelongsToManyWithSub + * @property-read \Illuminate\Database\Eloquent\Collection|Simple[] $relationBelongsToManyWithSub * @property-read int|null $relation_belongs_to_many_with_sub_count - * @property-read \Illuminate\Database\Eloquent\Collection|\Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\Relations\Models\Simple[] $relationBelongsToManyWithSubAnother + * @property-read \Illuminate\Database\Eloquent\Collection|Simple[] $relationBelongsToManyWithSubAnother * @property-read int|null $relation_belongs_to_many_with_sub_another_count - * @property-read \Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\Relations\ModelsOtherNamespace\AnotherModel $relationBelongsToSameNameAsColumn - * @property-read \Illuminate\Database\Eloquent\Collection|\Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\Relations\Models\Simple[] $relationHasMany + * @property-read AnotherModel $relationBelongsToSameNameAsColumn + * @property-read \Illuminate\Database\Eloquent\Collection|Simple[] $relationHasMany * @property-read int|null $relation_has_many_count - * @property-read \Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\Relations\Models\Simple|null $relationHasOne - * @property-read \Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\Relations\Models\Simple $relationHasOneWithDefault - * @property-read \Illuminate\Database\Eloquent\Collection|\Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\Relations\Models\Simple[] $relationMorphMany + * @property-read Simple|null $relationHasOne + * @property-read Simple $relationHasOneWithDefault + * @property-read \Illuminate\Database\Eloquent\Collection|Simple[] $relationMorphMany * @property-read int|null $relation_morph_many_count - * @property-read \Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\Relations\Models\Simple|null $relationMorphOne - * @property-read \Illuminate\Database\Eloquent\Model|\Eloquent $relationMorphTo - * @property-read \Illuminate\Database\Eloquent\Collection|\Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\Relations\Models\Simple[] $relationMorphedByMany + * @property-read Simple|null $relationMorphOne + * @property-read Model|\Eloquent $relationMorphTo + * @property-read \Illuminate\Database\Eloquent\Collection|Simple[] $relationMorphedByMany * @property-read int|null $relation_morphed_by_many_count - * @method static \Illuminate\Database\Eloquent\Builder|\Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\Relations\Models\Simple newModelQuery() - * @method static \Illuminate\Database\Eloquent\Builder|\Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\Relations\Models\Simple newQuery() - * @method static \Illuminate\Database\Eloquent\Builder|\Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\Relations\Models\Simple query() - * @method static \Illuminate\Database\Eloquent\Builder|\Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\Relations\Models\Simple whereId($value) + * @method static \Illuminate\Database\Eloquent\Builder|Simple newModelQuery() + * @method static \Illuminate\Database\Eloquent\Builder|Simple newQuery() + * @method static \Illuminate\Database\Eloquent\Builder|Simple query() + * @method static \Illuminate\Database\Eloquent\Builder|Simple whereId($value) * @mixin \Eloquent */ class Simple extends Model diff --git a/tests/Console/ModelsCommand/ResetAndSmartReset/Test.php b/tests/Console/ModelsCommand/ResetAndSmartReset/Test.php index 36c7f58..da3bd55 100644 --- a/tests/Console/ModelsCommand/ResetAndSmartReset/Test.php +++ b/tests/Console/ModelsCommand/ResetAndSmartReset/Test.php @@ -62,10 +62,10 @@ use Illuminate\Database\Eloquent\Model; * * @property string $foo * @property integer $id - * @method static \Illuminate\Database\Eloquent\Builder|\Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\ResetAndSmartReset\Models\Simple newModelQuery() - * @method static \Illuminate\Database\Eloquent\Builder|\Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\ResetAndSmartReset\Models\Simple newQuery() - * @method static \Illuminate\Database\Eloquent\Builder|\Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\ResetAndSmartReset\Models\Simple query() - * @method static \Illuminate\Database\Eloquent\Builder|\Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\ResetAndSmartReset\Models\Simple whereId($value) + * @method static \Illuminate\Database\Eloquent\Builder|Simple newModelQuery() + * @method static \Illuminate\Database\Eloquent\Builder|Simple newQuery() + * @method static \Illuminate\Database\Eloquent\Builder|Simple query() + * @method static \Illuminate\Database\Eloquent\Builder|Simple whereId($value) * @mixin \Eloquent */ class Simple extends Model @@ -117,10 +117,10 @@ use Illuminate\Database\Eloquent\Model; * Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\ResetAndSmartReset\Models\Simple * * @property integer $id - * @method static \Illuminate\Database\Eloquent\Builder|\Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\ResetAndSmartReset\Models\Simple newModelQuery() - * @method static \Illuminate\Database\Eloquent\Builder|\Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\ResetAndSmartReset\Models\Simple newQuery() - * @method static \Illuminate\Database\Eloquent\Builder|\Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\ResetAndSmartReset\Models\Simple query() - * @method static \Illuminate\Database\Eloquent\Builder|\Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\ResetAndSmartReset\Models\Simple whereId($value) + * @method static \Illuminate\Database\Eloquent\Builder|Simple newModelQuery() + * @method static \Illuminate\Database\Eloquent\Builder|Simple newQuery() + * @method static \Illuminate\Database\Eloquent\Builder|Simple query() + * @method static \Illuminate\Database\Eloquent\Builder|Simple whereId($value) * @mixin \Eloquent */ class Simple extends Model @@ -172,10 +172,10 @@ use Illuminate\Database\Eloquent\Model; * Text of existing phpdoc * * @property integer $id - * @method static \Illuminate\Database\Eloquent\Builder|\Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\ResetAndSmartReset\Models\Simple newModelQuery() - * @method static \Illuminate\Database\Eloquent\Builder|\Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\ResetAndSmartReset\Models\Simple newQuery() - * @method static \Illuminate\Database\Eloquent\Builder|\Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\ResetAndSmartReset\Models\Simple query() - * @method static \Illuminate\Database\Eloquent\Builder|\Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\ResetAndSmartReset\Models\Simple whereId($value) + * @method static \Illuminate\Database\Eloquent\Builder|Simple newModelQuery() + * @method static \Illuminate\Database\Eloquent\Builder|Simple newQuery() + * @method static \Illuminate\Database\Eloquent\Builder|Simple query() + * @method static \Illuminate\Database\Eloquent\Builder|Simple whereId($value) * @mixin \Eloquent */ class Simple extends Model diff --git a/tests/Console/ModelsCommand/SoftDeletes/Test.php b/tests/Console/ModelsCommand/SoftDeletes/Test.php index 86dbcc1..7d8996f 100644 --- a/tests/Console/ModelsCommand/SoftDeletes/Test.php +++ b/tests/Console/ModelsCommand/SoftDeletes/Test.php @@ -62,13 +62,13 @@ use Illuminate\Database\Eloquent\SoftDeletes; * Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\SoftDeletes\Models\Simple * * @property integer $id - * @method static \Illuminate\Database\Eloquent\Builder|\Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\SoftDeletes\Models\Simple newModelQuery() - * @method static \Illuminate\Database\Eloquent\Builder|\Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\SoftDeletes\Models\Simple newQuery() - * @method static \Illuminate\Database\Query\Builder|\Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\SoftDeletes\Models\Simple onlyTrashed() - * @method static \Illuminate\Database\Eloquent\Builder|\Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\SoftDeletes\Models\Simple query() - * @method static \Illuminate\Database\Eloquent\Builder|\Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\SoftDeletes\Models\Simple whereId($value) - * @method static \Illuminate\Database\Query\Builder|\Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\SoftDeletes\Models\Simple withTrashed() - * @method static \Illuminate\Database\Query\Builder|\Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\SoftDeletes\Models\Simple withoutTrashed() + * @method static \Illuminate\Database\Eloquent\Builder|Simple newModelQuery() + * @method static \Illuminate\Database\Eloquent\Builder|Simple newQuery() + * @method static \Illuminate\Database\Query\Builder|Simple onlyTrashed() + * @method static \Illuminate\Database\Eloquent\Builder|Simple query() + * @method static \Illuminate\Database\Eloquent\Builder|Simple whereId($value) + * @method static \Illuminate\Database\Query\Builder|Simple withTrashed() + * @method static \Illuminate\Database\Query\Builder|Simple withoutTrashed() * @mixin \Eloquent */ class Simple extends Model diff --git a/tests/Console/ModelsCommand/migrations/____custom_casts_table.php b/tests/Console/ModelsCommand/migrations/____custom_casts_table.php index 173b765..9a45d8e 100644 --- a/tests/Console/ModelsCommand/migrations/____custom_casts_table.php +++ b/tests/Console/ModelsCommand/migrations/____custom_casts_table.php @@ -11,6 +11,7 @@ class CustomCastsTable extends Migration Schema::create('custom_casts', static function (Blueprint $table) { $table->string('casted_property_with_return_type'); $table->string('casted_property_with_return_docblock'); + $table->string('casted_property_with_return_docblock_fqn'); $table->string('casted_property_with_return_primitive'); $table->string('casted_property_with_return_primitive_docblock'); $table->string('casted_property_with_return_nullable_primitive');