Compare commits

..
Author SHA1 Message Date
Markus Podar f0c315e4fc composer fix-style 2024-06-12 07:17:36 +02:00
sforward 6338abb2d7 Fix return value of scopes from parent class (#1366) 2024-04-01 08:43:59 +02:00
dev2a ac7e186270 Add pivot class property (#1518)
* Add pivot class property

* Add test for pivot class properties

* Fix failed test for pivot class properties

* Update CHANGELOG.md

* Fix failed test
2024-03-11 14:37:15 +01:00
Barry vd. Heuvel bc1d67f01c Prepare 3.0 release (#1530)
* Prepare 3.0 release

* Update CHANGELOG.md

* Update CHANGELOG.md
2024-03-01 13:53:18 +01:00
Markus Podar 8eab699835 phpunit --migrate-configuration (#1526) 2024-02-19 20:52:29 +01:00
Markus PodarandBarry vd. Heuvel 49ac75d805 Remove --smart-reset completely (#1525)
* Remove `--smart-reset` completely

See https://github.com/barryvdh/laravel-ide-helper/pull/1523#issuecomment-1952313183

* Update CHANGELOG.md

---------

Co-authored-by: Barry vd. Heuvel <[email protected]>
2024-02-19 14:03:16 +01:00
55 changed files with 748 additions and 414 deletions
+11 -2
View File
@@ -2,16 +2,25 @@
All notable changes to this project will be documented in this file. All notable changes to this project will be documented in this file.
[Next release](https://github.com/barryvdh/laravel-ide-helper/compare/v2.15.0...master) [Next release](https://github.com/barryvdh/laravel-ide-helper/compare/v3.0.0...master)
-------------- --------------
### Fixed ### Fixed
- Fix return value of query scopes from parent class [#1366 / sforward](https://github.com/barryvdh/laravel-ide-helper/pull/1366)
### Changed
### Added
- Add type to pivot when using a custom pivot class [#1518 / d3v2a](https://github.com/barryvdh/laravel-ide-helper/pull/1518)
2024-03-01, 3.0.0
------------------
### Added ### Added
- Support for Laravel 11 [#1520 / KentarouTakeda](https://github.com/barryvdh/laravel-ide-helper/pull/1520) - Support for Laravel 11 [#1520 / KentarouTakeda](https://github.com/barryvdh/laravel-ide-helper/pull/1520)
### Changed ### Changed
- Merge --reset and --smart-reset, to always keep the text. Always skipp the classname [#1523 / barryvdh](https://github.com/barryvdh/laravel-ide-helper/pull/1523) - Make `--reset` always keep the text and remove `--smart-reset`. Always skip the classname [#1523 / barryvdh](https://github.com/barryvdh/laravel-ide-helper/pull/1523) & [#1525 / mfn](https://github.com/barryvdh/laravel-ide-helper/pull/1525)
- Use short types (`int` and `bool` instead of `integer` and `boolean`) [#1524 / barryvdh](https://github.com/barryvdh/laravel-ide-helper/pull/1524) - Use short types (`int` and `bool` instead of `integer` and `boolean`) [#1524 / barryvdh](https://github.com/barryvdh/laravel-ide-helper/pull/1524)
### Removed ### Removed
+1 -1
View File
@@ -151,7 +151,7 @@ The class name will be different from the model, avoiding the IDE duplicate anno
Writing to the models should keep the existing comments and only append new properties/methods. It will not update changed properties/methods. Writing to the models should keep the existing comments and only append new properties/methods. It will not update changed properties/methods.
With the `--reset (-R)` option, the whole existing PHPDoc is replaced, including any comments that have been made. The `--smart-reset` option will instead keep the 'text' part of the phpdoc comment, and just replace all the property/method defininitions. With the `--reset (-R)` option, the whole existing PHPDoc is replaced, including any comments that have been made.
```bash ```bash
php artisan ide-helper:models "App\Models\Post" php artisan ide-helper:models "App\Models\Post"
-1
View File
@@ -29,7 +29,6 @@
"illuminate/filesystem": "^10 || ^11", "illuminate/filesystem": "^10 || ^11",
"illuminate/support": "^10 || ^11", "illuminate/support": "^10 || ^11",
"nikic/php-parser": "^4.18 || ^5", "nikic/php-parser": "^4.18 || ^5",
"phpdocumentor/reflection-docblock": "^5.3",
"phpdocumentor/type-resolver": "^1.1.0" "phpdocumentor/type-resolver": "^1.1.0"
}, },
"require-dev": { "require-dev": {
+7 -14
View File
@@ -1,24 +1,17 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" <phpunit
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/9.3/phpunit.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
bootstrap="vendor/autoload.php" xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/10.5/phpunit.xsd"
backupGlobals="false" cacheDirectory=".phpunit.result.cache"
backupStaticAttributes="false" >
colors="true"
verbose="true"
convertErrorsToExceptions="true"
convertNoticesToExceptions="true"
convertWarningsToExceptions="true"
processIsolation="false"
stopOnFailure="false">
<testsuites> <testsuites>
<testsuite name="Unit Tests"> <testsuite name="Unit Tests">
<directory>tests</directory> <directory>tests</directory>
</testsuite> </testsuite>
</testsuites> </testsuites>
<coverage> <source>
<include> <include>
<directory suffix=".php">src/</directory> <directory suffix=".php">src/</directory>
</include> </include>
</coverage> </source>
</phpunit> </phpunit>
+12 -16
View File
@@ -11,15 +11,14 @@
namespace Barryvdh\LaravelIdeHelper; namespace Barryvdh\LaravelIdeHelper;
use Barryvdh\LaravelIdeHelper\DocBlock\DocBlockBuilder; use Barryvdh\Reflection\DocBlock;
use Barryvdh\Reflection\DocBlock\Context;
use Barryvdh\Reflection\DocBlock\Serializer as DocBlockSerializer;
use Barryvdh\Reflection\DocBlock\Tag\MethodTag;
use Closure; use Closure;
use Illuminate\Config\Repository as ConfigRepository; use Illuminate\Config\Repository as ConfigRepository;
use Illuminate\Database\Eloquent\Builder as EloquentBuilder; use Illuminate\Database\Eloquent\Builder as EloquentBuilder;
use Illuminate\Support\Facades\Facade; use Illuminate\Support\Facades\Facade;
use phpDocumentor\Reflection\DocBlock;
use phpDocumentor\Reflection\DocBlock\Serializer;
use phpDocumentor\Reflection\DocBlock\Tags\Method as MethodTag;
use phpDocumentor\Reflection\Types\Context;
use ReflectionClass; use ReflectionClass;
use Throwable; use Throwable;
@@ -42,7 +41,6 @@ class Alias
protected $magicMethods = []; protected $magicMethods = [];
protected $interfaces = []; protected $interfaces = [];
protected $phpdoc = null; protected $phpdoc = null;
protected $phpdocContext = null;
protected $classAliases = []; protected $classAliases = [];
/** @var ConfigRepository */ /** @var ConfigRepository */
@@ -84,11 +82,8 @@ class Alias
if (!empty($this->namespace)) { if (!empty($this->namespace)) {
$this->classAliases = (new UsesResolver())->loadFromClass($this->root); $this->classAliases = (new UsesResolver())->loadFromClass($this->root);
//Create a DocBlock //Create a DocBlock and serializer instance
$this->phpdocContext = new Context($this->namespace, $this->classAliases); $this->phpdoc = new DocBlock(new ReflectionClass($alias), new Context($this->namespace, $this->classAliases));
$reflector = new ReflectionClass($alias);
$this->phpdoc = DocBlockBuilder::createFromReflector($reflector, $this->phpdocContext);
} }
if ($facade === '\Illuminate\Database\Eloquent\Model') { if ($facade === '\Illuminate\Database\Eloquent\Model') {
@@ -427,7 +422,8 @@ class Alias
*/ */
public function getDocComment($prefix = "\t\t") public function getDocComment($prefix = "\t\t")
{ {
$serializer = new Serializer(1, $prefix); $serializer = new DocBlockSerializer(1, $prefix);
if (!$this->phpdoc) { if (!$this->phpdoc) {
return ''; return '';
} }
@@ -437,13 +433,13 @@ class Alias
// we can perform reflection on the class and // we can perform reflection on the class and
// add in the original class DocBlock // add in the original class DocBlock
if (count($this->phpdoc->getTags()) === 0) { if (count($this->phpdoc->getTags()) === 0) {
$reflector = new ReflectionClass($this->root); $class = new ReflectionClass($this->root);
$this->phpdoc = DocBlockBuilder::createFromReflector($reflector, $this->phpdocContext); $this->phpdoc = new DocBlock($class->getDocComment());
} }
} }
$this->removeDuplicateMethodsFromPhpDoc(); $this->removeDuplicateMethodsFromPhpDoc();
return $serializer->getDocComment($this->phpdoc->getDocBlock()); return $serializer->getDocComment($this->phpdoc);
} }
/** /**
@@ -460,7 +456,7 @@ class Alias
foreach ($this->phpdoc->getTags() as $tag) { foreach ($this->phpdoc->getTags() as $tag) {
if ($tag instanceof MethodTag && in_array($tag->getMethodName(), $methodNames)) { if ($tag instanceof MethodTag && in_array($tag->getMethodName(), $methodNames)) {
$this->phpdoc->removeTag($tag); $this->phpdoc->deleteTag($tag);
} }
} }
} }
+80 -54
View File
@@ -12,7 +12,10 @@
namespace Barryvdh\LaravelIdeHelper\Console; namespace Barryvdh\LaravelIdeHelper\Console;
use Barryvdh\LaravelIdeHelper\Contracts\ModelHookInterface; use Barryvdh\LaravelIdeHelper\Contracts\ModelHookInterface;
use Barryvdh\LaravelIdeHelper\DocBlock\DocBlockBuilder; use Barryvdh\Reflection\DocBlock;
use Barryvdh\Reflection\DocBlock\Context;
use Barryvdh\Reflection\DocBlock\Serializer as DocBlockSerializer;
use Barryvdh\Reflection\DocBlock\Tag;
use Composer\ClassMapGenerator\ClassMapGenerator; use Composer\ClassMapGenerator\ClassMapGenerator;
use Illuminate\Console\Command; use Illuminate\Console\Command;
use Illuminate\Contracts\Database\Eloquent\Castable; use Illuminate\Contracts\Database\Eloquent\Castable;
@@ -31,18 +34,16 @@ use Illuminate\Database\Eloquent\Relations\HasOne;
use Illuminate\Database\Eloquent\Relations\HasOneThrough; use Illuminate\Database\Eloquent\Relations\HasOneThrough;
use Illuminate\Database\Eloquent\Relations\MorphMany; use Illuminate\Database\Eloquent\Relations\MorphMany;
use Illuminate\Database\Eloquent\Relations\MorphOne; use Illuminate\Database\Eloquent\Relations\MorphOne;
use Illuminate\Database\Eloquent\Relations\MorphPivot;
use Illuminate\Database\Eloquent\Relations\MorphTo; use Illuminate\Database\Eloquent\Relations\MorphTo;
use Illuminate\Database\Eloquent\Relations\MorphToMany; use Illuminate\Database\Eloquent\Relations\MorphToMany;
use Illuminate\Database\Eloquent\Relations\Pivot;
use Illuminate\Database\Eloquent\Relations\Relation; use Illuminate\Database\Eloquent\Relations\Relation;
use Illuminate\Database\Schema\Builder; use Illuminate\Database\Schema\Builder;
use Illuminate\Filesystem\Filesystem; use Illuminate\Filesystem\Filesystem;
use Illuminate\Support\Arr; use Illuminate\Support\Arr;
use Illuminate\Support\Collection; use Illuminate\Support\Collection;
use Illuminate\Support\Str; use Illuminate\Support\Str;
use phpDocumentor\Reflection\DocBlock\Serializer;
use phpDocumentor\Reflection\DocBlock\Tag;
use phpDocumentor\Reflection\DocBlock\Tags\BaseTag;
use phpDocumentor\Reflection\DocBlockFactory;
use phpDocumentor\Reflection\Types\ContextFactory; use phpDocumentor\Reflection\Types\ContextFactory;
use ReflectionClass; use ReflectionClass;
use ReflectionNamedType; use ReflectionNamedType;
@@ -151,7 +152,7 @@ class ModelsCommand extends Command
); );
$model = $this->argument('model'); $model = $this->argument('model');
$ignore = $this->option('ignore'); $ignore = $this->option('ignore');
$this->reset = $this->option('reset') || $this->option('smart-reset'); $this->reset = $this->option('reset');
$this->phpstorm_noinspections = $this->option('phpstorm-noinspections'); $this->phpstorm_noinspections = $this->option('phpstorm-noinspections');
$this->write_model_magic_where = $this->laravel['config']->get('ide-helper.write_model_magic_where', true); $this->write_model_magic_where = $this->laravel['config']->get('ide-helper.write_model_magic_where', true);
$this->write_model_external_builder_methods = $this->laravel['config']->get('ide-helper.write_model_external_builder_methods', true); $this->write_model_external_builder_methods = $this->laravel['config']->get('ide-helper.write_model_external_builder_methods', true);
@@ -216,7 +217,6 @@ class ModelsCommand extends Command
], ],
['nowrite', 'N', InputOption::VALUE_NONE, 'Don\'t write to Model file'], ['nowrite', 'N', InputOption::VALUE_NONE, 'Don\'t write to Model file'],
['reset', 'R', InputOption::VALUE_NONE, 'Refresh the properties/methods list, but keep the text'], ['reset', 'R', InputOption::VALUE_NONE, 'Refresh the properties/methods list, but keep the text'],
['smart-reset', 'r', InputOption::VALUE_NONE, 'Deprecated: same as --reset'],
['phpstorm-noinspections', 'p', InputOption::VALUE_NONE, ['phpstorm-noinspections', 'p', InputOption::VALUE_NONE,
'Add PhpFullyQualifiedNameUsageInspection and PhpUnnecessaryFullyQualifiedNameInspection PHPStorm ' . 'Add PhpFullyQualifiedNameUsageInspection and PhpUnnecessaryFullyQualifiedNameInspection PHPStorm ' .
'noinspection tags', 'noinspection tags',
@@ -616,7 +616,7 @@ class ModelsCommand extends Command
$this->setProperty($name, null, null, true, $comment); $this->setProperty($name, null, null, true, $comment);
} }
} elseif (Str::startsWith($method, 'scope') && $method !== 'scopeQuery' && $method !== 'scope' && $method !== 'scopes') { } elseif (Str::startsWith($method, 'scope') && $method !== 'scopeQuery' && $method !== 'scope' && $method !== 'scopes') {
//Magic set<name>Attribute //Magic scope<name>Attribute
$name = Str::camel(substr($method, 5)); $name = Str::camel(substr($method, 5));
if (!empty($name)) { if (!empty($name)) {
$comment = $this->getCommentFromDocBlock($reflection); $comment = $this->getCommentFromDocBlock($reflection);
@@ -628,8 +628,8 @@ class ModelsCommand extends Command
get_class($model->newModelQuery()) get_class($model->newModelQuery())
); );
$modelName = $this->getClassNameInDestinationFile( $modelName = $this->getClassNameInDestinationFile(
$reflection->getDeclaringClass(), new ReflectionClass($model),
$reflection->getDeclaringClass()->getName() get_class($model)
); );
$this->setMethod($name, $builder . '|' . $modelName, $args, $comment); $this->setMethod($name, $builder . '|' . $modelName, $args, $comment);
} }
@@ -710,6 +710,17 @@ class ModelsCommand extends Command
strpos(get_class($relationObj), 'Many') !== false strpos(get_class($relationObj), 'Many') !== false
) )
) { ) {
if ($relationObj instanceof BelongsToMany) {
$pivot = get_class($relationObj->newPivot());
if (!in_array($pivot, [Pivot::class, MorphPivot::class])) {
$this->setProperty(
$relationObj->getPivotAccessor(),
$this->getClassNameInDestinationFile($model, $pivot),
true,
false
);
}
}
//Collection or array of models (because Collection is Arrayable) //Collection or array of models (because Collection is Arrayable)
$relatedClass = '\\' . get_class($relationObj->getRelated()); $relatedClass = '\\' . get_class($relationObj->getRelated());
$collectionClass = $this->getCollectionClass($relatedClass); $collectionClass = $this->getCollectionClass($relatedClass);
@@ -883,14 +894,16 @@ class ModelsCommand extends Command
$reflection->getInterfaceNames(), $reflection->getInterfaceNames(),
$reflection->getParentClass()->getInterfaceNames() $reflection->getParentClass()->getInterfaceNames()
); );
$phpDocContext = (new ContextFactory())->createFromReflector($reflection);
$phpdoc = DocBlockBuilder::createFromReflector($reflection, $phpDocContext);
if ($this->reset) { if ($this->reset) {
$phpdoc->clearTags(); $phpdoc = new DocBlock('', new Context($namespace));
$phpdoc->setText(
(new DocBlock($reflection, new Context($namespace)))->getText()
);
} else {
$phpdoc = new DocBlock($reflection, new Context($namespace));
} }
$existingTags = $phpdoc->getTags();
$properties = []; $properties = [];
$methods = []; $methods = [];
foreach ($phpdoc->getTags() as $tag) { foreach ($phpdoc->getTags() as $tag) {
@@ -921,8 +934,8 @@ class ModelsCommand extends Command
} }
$tagLine = trim("@{$attr} {$property['type']} {$name} {$property['comment']}"); $tagLine = trim("@{$attr} {$property['type']} {$name} {$property['comment']}");
$tag = Tag::createInstance($tagLine, $phpdoc);
$phpdoc->appendTagline($tagLine); $phpdoc->appendTag($tag);
} }
ksort($this->methods); ksort($this->methods);
@@ -936,14 +949,21 @@ class ModelsCommand extends Command
if ($method['comment'] !== '') { if ($method['comment'] !== '') {
$tagLine .= " {$method['comment']}"; $tagLine .= " {$method['comment']}";
} }
$tag = Tag::createInstance($tagLine, $phpdoc);
$phpdoc->appendTagline($tagLine); $phpdoc->appendTag($tag);
} }
if ($this->write) { if ($this->write) {
$eloquentClassNameInModel = $this->getClassNameInDestinationFile($reflection, 'Eloquent'); $eloquentClassNameInModel = $this->getClassNameInDestinationFile($reflection, 'Eloquent');
$phpdoc->appendTagline('@mixin ' . $eloquentClassNameInModel); // remove the already existing tag to prevent duplicates
foreach ($phpdoc->getTagsByName('mixin') as $tag) {
if ($tag->getContent() === $eloquentClassNameInModel) {
$phpdoc->deleteTag($tag);
}
}
$phpdoc->appendTag(Tag::createInstance('@mixin ' . $eloquentClassNameInModel, $phpdoc));
} }
if ($this->phpstorm_noinspections) { if ($this->phpstorm_noinspections) {
@@ -951,40 +971,43 @@ class ModelsCommand extends Command
* Facades, Eloquent API * Facades, Eloquent API
* @see https://www.jetbrains.com/help/phpstorm/php-fully-qualified-name-usage.html * @see https://www.jetbrains.com/help/phpstorm/php-fully-qualified-name-usage.html
*/ */
$phpdoc->appendTagline('@noinspection PhpFullyQualifiedNameUsageInspection'); $phpdoc->appendTag(Tag::createInstance('@noinspection PhpFullyQualifiedNameUsageInspection', $phpdoc));
/** /**
* Relations, other models in the same namespace * Relations, other models in the same namespace
* @see https://www.jetbrains.com/help/phpstorm/php-unnecessary-fully-qualified-name.html * @see https://www.jetbrains.com/help/phpstorm/php-unnecessary-fully-qualified-name.html
*/ */
$phpdoc->appendTagline('@noinspection PhpUnnecessaryFullyQualifiedNameInspection'); $phpdoc->appendTag(
Tag::createInstance('@noinspection PhpUnnecessaryFullyQualifiedNameInspection', $phpdoc)
);
} }
$serializer = new Serializer(); $serializer = new DocBlockSerializer();
$docComment = $serializer->getDocComment($phpdoc);
if ($this->write_mixin) { if ($this->write_mixin) {
$phpdocMixin = new DocBlock($reflection, new Context($namespace));
// remove all mixin tags prefixed with IdeHelper // remove all mixin tags prefixed with IdeHelper
$mixinTags = array_filter($existingTags, function (Tag $tag) { foreach ($phpdocMixin->getTagsByName('mixin') as $tag) {
return !($tag instanceof BaseTag) || !Str::startsWith($tag->getDescription(), 'IdeHelper'); if (Str::startsWith($tag->getContent(), 'IdeHelper')) {
}); $phpdocMixin->deleteTag($tag);
$phpdocMixin = DocBlockBuilder::create($phpdoc->getSummary(), $phpdoc->getDescription(), $mixinTags, $phpDocContext);
$mixinClassName = "IdeHelper{$classname}";
$phpdocMixin->appendTagline("@mixin {$mixinClassName}");
foreach ($phpdoc->getTags() as $tag) {
if ($tag instanceof BaseTag && Str::startsWith($tag->getDescription(), 'IdeHelper')) {
$phpdoc->removeTag($tag);
} }
} }
$mixinDocComment = $serializer->getDocComment($phpdocMixin->getDocBlock()); $mixinClassName = "IdeHelper{$classname}";
$phpdocMixin->appendTag(Tag::createInstance("@mixin {$mixinClassName}", $phpdocMixin));
$mixinDocComment = $serializer->getDocComment($phpdocMixin);
// remove blank lines if there's no text // remove blank lines if there's no text
if (!$phpdocMixin->getSummary()) { if (!$phpdocMixin->getText()) {
$mixinDocComment = preg_replace("/\s\*\s*\n/", '', $mixinDocComment); $mixinDocComment = preg_replace("/\s\*\s*\n/", '', $mixinDocComment);
} }
}
$docComment = $serializer->getDocComment($phpdoc->getDocBlock()); foreach ($phpdoc->getTagsByName('mixin') as $tag) {
if (Str::startsWith($tag->getContent(), 'IdeHelper')) {
$phpdoc->deleteTag($tag);
}
}
$docComment = $serializer->getDocComment($phpdoc);
}
if ($this->write) { if ($this->write) {
$modelDocComment = $this->write_mixin ? $mixinDocComment : $docComment; $modelDocComment = $this->write_mixin ? $mixinDocComment : $docComment;
@@ -1191,20 +1214,21 @@ class ModelsCommand extends Command
* *
* @return null|string * @return null|string
*/ */
protected function getCommentFromDocBlock(\ReflectionMethod $reflection): ?string protected function getCommentFromDocBlock(\ReflectionMethod $reflection)
{ {
if (!$reflection->getDocComment()) {
return '';
}
$phpDocContext = (new ContextFactory())->createFromReflector($reflection); $phpDocContext = (new ContextFactory())->createFromReflector($reflection);
$phpdoc = (DocBlockFactory::createInstance())->create($reflection, $phpDocContext); $context = new Context(
$phpDocContext->getNamespace(),
$phpDocContext->getNamespaceAliases()
);
$comment = '';
$phpdoc = new DocBlock($reflection, $context);
foreach ($phpdoc->getTagsByName('comment') as $tag) { if ($phpdoc->hasTag('comment')) {
return $tag; $comment = $phpdoc->getTagsByName('comment')[0]->getContent();
} }
return ''; return $comment;
} }
/** /**
@@ -1214,19 +1238,21 @@ class ModelsCommand extends Command
* *
* @return null|string * @return null|string
*/ */
protected function getReturnTypeFromDocBlock(\ReflectionMethod $reflection, \Reflector $reflectorForContext = null): ?string protected function getReturnTypeFromDocBlock(\ReflectionMethod $reflection, \Reflector $reflectorForContext = null)
{ {
if (!$reflection->getDocComment()) {
return null;
}
$phpDocContext = (new ContextFactory())->createFromReflector($reflectorForContext ?? $reflection); $phpDocContext = (new ContextFactory())->createFromReflector($reflectorForContext ?? $reflection);
$phpdoc = (DocBlockFactory::createInstance())->create($reflection, $phpDocContext); $context = new Context(
$phpDocContext->getNamespace(),
$phpDocContext->getNamespaceAliases()
);
$type = null;
$phpdoc = new DocBlock($reflection, $context);
foreach ($phpdoc->getTagsByName('return') as $tag) { if ($phpdoc->hasTag('return')) {
return $tag; $type = $phpdoc->getTagsByName('return')[0]->getType();
} }
return null; return $type;
} }
protected function getReturnTypeFromReflection(\ReflectionMethod $reflection): ?string protected function getReturnTypeFromReflection(\ReflectionMethod $reflection): ?string
-162
View File
@@ -1,162 +0,0 @@
<?php
namespace Barryvdh\LaravelIdeHelper\DocBlock;
use phpDocumentor\Reflection\DocBlock;
use phpDocumentor\Reflection\DocBlock\DescriptionFactory;
use phpDocumentor\Reflection\DocBlock\StandardTagFactory;
use phpDocumentor\Reflection\DocBlock\Tag;
use phpDocumentor\Reflection\DocBlock\TagFactory;
use phpDocumentor\Reflection\DocBlockFactory;
use phpDocumentor\Reflection\TypeResolver;
use phpDocumentor\Reflection\Types\Context;
class DocBlockBuilder
{
/** @var $tagFactory TagFactory */
private $tagFactory = null;
private function __construct(
protected string $summary = '',
protected ?DocBlock\Description $description = null,
protected array $tags = [],
protected ?Context $context = null
) {
}
public static function createFromReflector(\Reflector $reflector, ?Context $context = null): static
{
if ($doc = $reflector->getDocComment()) {
$docblock = DocBlockFactory::createInstance()->create($doc, $context);
return new static(
$docblock->getSummary(),
$docblock->getDescription(),
$docblock->getTags(),
$docblock->getContext()
);
}
return static::create('', null, [], $context);
}
public static function create(
string $summary = '',
?DocBlock\Description $description = null,
array $tags = null,
?Context $context = null
): static {
return new static($summary, $description, $tags, $context);
}
public function getDocBlock(): DocBlock
{
$tags = collect($this->tags)->unique(function (Tag $tag) {
if (method_exists($tag, 'getVariableName')) {
return $tag->getName() . ' ' . $tag->getVariableName();
}
return (string) $tag;
})->toArray();
return new DocBlock($this->summary, $this->description, $tags, $this->context);
}
public function getSummary(): ?string
{
return $this->summary;
}
public function setSummary(string $summary)
{
$this->summary = $summary;
}
public function getDescription(): ?DocBlock\Description
{
return $this->description;
}
public function setDescription(?DocBlock\Description $description)
{
$this->description = $description;
}
public function getContext()
{
return $this->context;
}
public function getTags()
{
return $this->tags;
}
public function appendTagline(string $tagline)
{
$tag = $this->getTagFactory()->create($tagline, $this->context);
$this->appendTag($tag);
}
public function hasTag(string $name): bool
{
/** @var Tag $tag */
foreach ($this->tags as $tag) {
if ($tag->getName() === $name) {
return true;
}
}
return false;
}
public function getTagsByName($name)
{
$result = [];
/** @var Tag $tag */
foreach ($this->tags as $tag) {
if ($tag->getName() != $name) {
continue;
}
$result[] = $tag;
}
return $result;
}
public function appendTag(Tag $tag)
{
$this->tags[] = $tag;
}
public function removeTag(Tag $tagToRemove)
{
foreach ($this->tags as $i => $tag) {
if ($tag === $tagToRemove) {
unset($this->tags[$i]);
break;
}
}
}
public function clearTags()
{
$this->tags = [];
}
private function getTagFactory(): TagFactory
{
if ($this->tagFactory === null) {
$fqsenResolver = new LocalFsqenResolver();
$tagFactory = new StandardTagFactory($fqsenResolver);
$descriptionFactory = new DescriptionFactory($tagFactory);
$tagFactory->addService($descriptionFactory);
$tagFactory->addService(new TypeResolver($fqsenResolver));
$this->tagFactory = $tagFactory;
}
return $this->tagFactory;
}
}
-15
View File
@@ -1,15 +0,0 @@
<?php
namespace Barryvdh\LaravelIdeHelper\DocBlock;
use phpDocumentor\Reflection\Fqsen;
use phpDocumentor\Reflection\FqsenResolver;
use phpDocumentor\Reflection\Types\Context;
class LocalFsqenResolver extends FqsenResolver
{
public function resolve(string $fqsen, ?Context $context = null): Fqsen
{
return new Fqsen($fqsen);
}
}
+7 -7
View File
@@ -2,8 +2,8 @@
namespace Barryvdh\LaravelIdeHelper; namespace Barryvdh\LaravelIdeHelper;
use Barryvdh\LaravelIdeHelper\DocBlock\DocBlockBuilder;
use Barryvdh\Reflection\DocBlock; use Barryvdh\Reflection\DocBlock;
use Barryvdh\Reflection\DocBlock\Tag;
use Illuminate\Database\Eloquent\Builder as EloquentBuilder; use Illuminate\Database\Eloquent\Builder as EloquentBuilder;
use Illuminate\Support\Collection; use Illuminate\Support\Collection;
@@ -35,7 +35,7 @@ class Macro extends Method
*/ */
protected function initPhpDoc($method) protected function initPhpDoc($method)
{ {
$this->phpdoc = DocBlockBuilder::createFromReflector($method); $this->phpdoc = new DocBlock($method);
$this->addLocationToPhpDoc(); $this->addLocationToPhpDoc();
@@ -56,7 +56,7 @@ class Macro extends Method
$name = $parameter->isVariadic() ? '...' : ''; $name = $parameter->isVariadic() ? '...' : '';
$name .= '$' . $parameter->getName(); $name .= '$' . $parameter->getName();
$this->phpdoc->appendTagline("@param {$type} {$name}"); $this->phpdoc->appendTag(Tag::createInstance("@param {$type} {$name}"));
} }
} }
@@ -64,8 +64,8 @@ class Macro extends Method
if ($method->hasReturnType() && !$this->phpdoc->hasTag('return')) { if ($method->hasReturnType() && !$this->phpdoc->hasTag('return')) {
$builder = EloquentBuilder::class; $builder = EloquentBuilder::class;
$return = $method->getReturnType(); $return = $method->getReturnType();
$type = $this->concatReflectionTypes($return);
$type = $this->concatReflectionTypes($return);
/** @psalm-suppress UndefinedClass */ /** @psalm-suppress UndefinedClass */
if (!$return instanceof \ReflectionUnionType) { if (!$return instanceof \ReflectionUnionType) {
@@ -73,7 +73,7 @@ class Macro extends Method
$type .= $return->allowsNull() ? '|null' : ''; $type .= $return->allowsNull() ? '|null' : '';
} }
$this->phpdoc->appendTagLine("@return {$type}"); $this->phpdoc->appendTag(Tag::createInstance("@return {$type}"));
} }
} }
@@ -109,9 +109,9 @@ class Macro extends Method
}); });
if ($enclosingMethod) { if ($enclosingMethod) {
$this->phpdoc->appendTagLine( $this->phpdoc->appendTag(Tag::createInstance(
'@see \\' . $enclosingClass->getName() . '::' . $enclosingMethod->getName() . '()' '@see \\' . $enclosingClass->getName() . '::' . $enclosingMethod->getName() . '()'
); ));
} }
} }
+103 -26
View File
@@ -11,18 +11,18 @@
namespace Barryvdh\LaravelIdeHelper; namespace Barryvdh\LaravelIdeHelper;
use Barryvdh\LaravelIdeHelper\DocBlock\DocBlockBuilder;
use Barryvdh\Reflection\DocBlock; use Barryvdh\Reflection\DocBlock;
use Barryvdh\Reflection\DocBlock\Context;
use Barryvdh\Reflection\DocBlock\Serializer as DocBlockSerializer;
use Barryvdh\Reflection\DocBlock\Tag; use Barryvdh\Reflection\DocBlock\Tag;
use Barryvdh\Reflection\DocBlock\Tag\ParamTag;
use Barryvdh\Reflection\DocBlock\Tag\ReturnTag;
use Illuminate\Database\Eloquent\Builder; use Illuminate\Database\Eloquent\Builder;
use Illuminate\Support\Str; use Illuminate\Support\Str;
use phpDocumentor\Reflection\DocBlock\Serializer;
use phpDocumentor\Reflection\DocBlock\Tags\InvalidTag;
use phpDocumentor\Reflection\DocBlock\Tags\Return_;
class Method class Method
{ {
/** @var DocBlockBuilder */ /** @var DocBlock */
protected $phpdoc; protected $phpdoc;
/** @var \ReflectionMethod */ /** @var \ReflectionMethod */
@@ -63,9 +63,11 @@ class Method
//Create a DocBlock and serializer instance //Create a DocBlock and serializer instance
$this->initPhpDoc($method); $this->initPhpDoc($method);
//Normalize the returns and inherit the docs from parents/interfaces //Normalize the description and inherit the docs from parents/interfaces
try { try {
$this->normalizeParams($this->phpdoc);
$this->normalizeReturn($this->phpdoc); $this->normalizeReturn($this->phpdoc);
$this->normalizeDescription($this->phpdoc);
} catch (\Exception $e) { } catch (\Exception $e) {
} }
@@ -73,7 +75,7 @@ class Method
$this->getParameters($method); $this->getParameters($method);
//Make the method static //Make the method static
$this->phpdoc->appendTagline('@static'); $this->phpdoc->appendTag(Tag::createInstance('@static', $this->phpdoc));
} }
/** /**
@@ -81,8 +83,7 @@ class Method
*/ */
protected function initPhpDoc($method) protected function initPhpDoc($method)
{ {
$context = new \phpDocumentor\Reflection\Types\Context($this->namespace, $this->classAliases); $this->phpdoc = new DocBlock($method, new Context($this->namespace, $this->classAliases));
$this->phpdoc = DocBlockBuilder::createFromReflector($method, $context);
} }
/** /**
@@ -144,8 +145,8 @@ class Method
*/ */
public function getDocComment($prefix = "\t\t") public function getDocComment($prefix = "\t\t")
{ {
$serializer = new Serializer(1, $prefix); $serializer = new DocBlockSerializer(1, $prefix);
return $serializer->getDocComment($this->phpdoc->getDocBlock()); return $serializer->getDocComment($this->phpdoc);
} }
/** /**
@@ -190,12 +191,68 @@ class Method
return $implode ? implode(', ', $this->params_with_default) : $this->params_with_default; return $implode ? implode(', ', $this->params_with_default) : $this->params_with_default;
} }
/**
* Get the description and get the inherited docs.
*
* @param DocBlock $phpdoc
*/
protected function normalizeDescription(DocBlock $phpdoc)
{
//Get the short + long description from the DocBlock
$description = $phpdoc->getText();
//Loop through parents/interfaces, to fill in {@inheritdoc}
if (strpos($description, '{@inheritdoc}') !== false) {
$inheritdoc = $this->getInheritDoc($this->method);
$inheritDescription = $inheritdoc->getText();
$description = str_replace('{@inheritdoc}', $inheritDescription, $description);
$phpdoc->setText($description);
$this->normalizeParams($inheritdoc);
$this->normalizeReturn($inheritdoc);
//Add the tags that are inherited
$inheritTags = $inheritdoc->getTags();
if ($inheritTags) {
/** @var Tag $tag */
foreach ($inheritTags as $tag) {
$tag->setDocBlock();
$phpdoc->appendTag($tag);
}
}
}
}
/**
* Normalize the parameters
*
* @param DocBlock $phpdoc
*/
protected function normalizeParams(DocBlock $phpdoc)
{
//Get the return type and adjust them for beter autocomplete
$paramTags = $phpdoc->getTagsByName('param');
if ($paramTags) {
/** @var ParamTag $tag */
foreach ($paramTags as $tag) {
// Convert the keywords
$content = $this->convertKeywords($tag->getContent());
$tag->setContent($content);
// Get the expanded type and re-set the content
$content = $tag->getType() . ' ' . $tag->getVariableName() . ' ' . $tag->getDescription();
$tag->setContent(trim($content));
}
}
}
/** /**
* Normalize the return tag (make full namespace, replace interfaces) * Normalize the return tag (make full namespace, replace interfaces)
* *
* @param DocBlock $phpdoc * @param DocBlock $phpdoc
*/ */
protected function normalizeReturn(DocBlockBuilder $phpdoc) protected function normalizeReturn(DocBlock $phpdoc)
{ {
//Get the return type and adjust them for better autocomplete //Get the return type and adjust them for better autocomplete
$returnTags = $phpdoc->getTagsByName('return'); $returnTags = $phpdoc->getTagsByName('return');
@@ -205,13 +262,8 @@ class Method
return; return;
} }
/** @var ReturnTag $tag */
/** @var Return_ $tag */
$tag = reset($returnTags); $tag = reset($returnTags);
if ($tag instanceof InvalidTag) {
return;
}
// Get the expanded type // Get the expanded type
$returnValue = $tag->getType(); $returnValue = $tag->getType();
@@ -220,17 +272,15 @@ class Method
$returnValue = str_replace($interface, $real, $returnValue); $returnValue = str_replace($interface, $real, $returnValue);
} }
// Set the changed content
$tag->setContent($returnValue . ' ' . $tag->getDescription());
$this->return = $returnValue; $this->return = $returnValue;
if ($returnValue === '$this') { if ($tag->getType() === '$this') {
$returnValue = Str::contains($this->root, Builder::class) Str::contains($this->root, Builder::class)
? $this->root . '|static' ? $tag->setType($this->root . '|static')
: $this->root; : $tag->setType($this->root);
} }
// Set the changed content
$this->phpdoc->removeTag($tag);
$this->phpdoc->appendTagline('@return ' . $returnValue . ' ' . $tag->getDescription());
} }
/** /**
@@ -299,4 +349,31 @@ class Method
$this->params = $params; $this->params = $params;
$this->params_with_default = $paramsWithDefault; $this->params_with_default = $paramsWithDefault;
} }
/**
* @param \ReflectionMethod $reflectionMethod
* @return DocBlock
*/
protected function getInheritDoc($reflectionMethod)
{
$parentClass = $reflectionMethod->getDeclaringClass()->getParentClass();
//Get either a parent or the interface
if ($parentClass) {
$method = $parentClass->getMethod($reflectionMethod->getName());
} else {
$method = $reflectionMethod->getPrototype();
}
if ($method) {
$namespace = $method->getDeclaringClass()->getNamespaceName();
$phpdoc = new DocBlock($method, new Context($namespace, $this->classAliases));
if (strpos($phpdoc->getText(), '{@inheritdoc}') !== false) {
//Not at the end yet, try another parent/interface..
return $this->getInheritDoc($method);
}
return $phpdoc;
}
}
} }
@@ -9,6 +9,8 @@ use Illuminate\Database\Eloquent\Casts\AsCollection;
use Illuminate\Database\Eloquent\Model; use Illuminate\Database\Eloquent\Model;
/** /**
*
*
* @property \Illuminate\Support\Carbon $cast_to_date_serialization * @property \Illuminate\Support\Carbon $cast_to_date_serialization
* @property \Illuminate\Support\Carbon $cast_to_datetime_serialization * @property \Illuminate\Support\Carbon $cast_to_datetime_serialization
* @property \Illuminate\Support\Carbon $cast_to_custom_datetime * @property \Illuminate\Support\Carbon $cast_to_custom_datetime
@@ -7,6 +7,8 @@ namespace Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\AllowGlobDirecto
use Illuminate\Database\Eloquent\Model; use Illuminate\Database\Eloquent\Model;
/** /**
*
*
* @property int $id * @property int $id
* @property string|null $char_nullable * @property string|null $char_nullable
* @property string $char_not_nullable * @property string $char_not_nullable
@@ -7,16 +7,18 @@ namespace Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\ArrayCastsWithCo
use Illuminate\Database\Eloquent\Model; use Illuminate\Database\Eloquent\Model;
/** /**
* @property array<int,string>|null $cast_to_array -- These three should not be duplicated *
* @property array<int,string> $cast_to_json some-description *
* @property \Illuminate\Support\Collection<int,string> $cast_to_collection some-description * @property array<int, string>|null $cast_to_array -- These three should not be duplicated
* @property array<int, string> $cast_to_json some-description
* @property \Illuminate\Support\Collection<int, string> $cast_to_collection some-description
* @property array|null $cast_to_encrypted_array -- These three are OK (no types) * @property array|null $cast_to_encrypted_array -- These three are OK (no types)
* @property array $cast_to_encrypted_json some-description * @property array $cast_to_encrypted_json some-description
* @property \Illuminate\Support\Collection $cast_to_encrypted_collection some-description * @property \Illuminate\Support\Collection $cast_to_encrypted_collection some-description
* @property string $cast_to_string -- The next three are OK (no description), this not included * @property string $cast_to_string -- The next three are OK (no description), this not included
* @property array<int,string>|null $cast_to_immutable_date * @property array<int, string>|null $cast_to_immutable_date
* @property array<int,string> $cast_to_immutable_date_serialization * @property array<int, string> $cast_to_immutable_date_serialization
* @property \Illuminate\Support\Collection<int,string> $cast_to_immutable_custom_datetime * @property \Illuminate\Support\Collection<int, string> $cast_to_immutable_custom_datetime
* @property string $cast_to_int * @property string $cast_to_int
* @property string $cast_to_integer * @property string $cast_to_integer
* @property string $cast_to_real * @property string $cast_to_real
@@ -26,6 +28,9 @@ use Illuminate\Database\Eloquent\Model;
* @property string $cast_to_bool * @property string $cast_to_bool
* @property string $cast_to_boolean * @property string $cast_to_boolean
* @property string $cast_to_object * @property string $cast_to_object
* @property array $cast_to_array
* @property array $cast_to_json
* @property \Illuminate\Support\Collection $cast_to_collection
* @property string $cast_to_date * @property string $cast_to_date
* @property string $cast_to_datetime * @property string $cast_to_datetime
* @property string $cast_to_date_serialization * @property string $cast_to_date_serialization
@@ -8,6 +8,8 @@ use Illuminate\Database\Eloquent\Casts\Attribute;
use Illuminate\Database\Eloquent\Model; use Illuminate\Database\Eloquent\Model;
/** /**
*
*
* @property int $id * @property int $id
* @property int $diverging_type_hinted_get_and_set * @property int $diverging_type_hinted_get_and_set
* @property string|null $name * @property string|null $name
@@ -10,6 +10,8 @@ use Illuminate\Database\Eloquent\Relations\HasOne;
use Illuminate\Database\Eloquent\Relations\MorphTo; use Illuminate\Database\Eloquent\Relations\MorphTo;
/** /**
*
*
* @property int $id * @property int $id
* @property string $both_same_name I'm a getter * @property string $both_same_name I'm a getter
* @property string $both_without_getter_comment * @property string $both_without_getter_comment
@@ -9,11 +9,13 @@ use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\HasMany; use Illuminate\Database\Eloquent\Relations\HasMany;
/** /**
*
*
* @property int $id * @property int $id
* @property-read SimpleCollection<int, Simple> $relationHasMany * @property-read SimpleCollection<int, Simple> $relationHasMany
* @property-read int|null $relation_has_many_count * @property-read int|null $relation_has_many_count
* @method static void SimpleCollection() <int, static> all($columns = ['*']) * @method static SimpleCollection<int, static> all($columns = ['*'])
* @method static void SimpleCollection() <int, static> get($columns = ['*']) * @method static SimpleCollection<int, static> get($columns = ['*'])
* @method static \Illuminate\Database\Eloquent\Builder|Simple newModelQuery() * @method static \Illuminate\Database\Eloquent\Builder|Simple newModelQuery()
* @method static \Illuminate\Database\Eloquent\Builder|Simple newQuery() * @method static \Illuminate\Database\Eloquent\Builder|Simple newQuery()
* @method static \Illuminate\Database\Eloquent\Builder|Simple query() * @method static \Illuminate\Database\Eloquent\Builder|Simple query()
@@ -7,6 +7,8 @@ namespace Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\CustomDate\Model
use Illuminate\Database\Eloquent\Model; use Illuminate\Database\Eloquent\Model;
/** /**
*
*
* @property \Carbon\CarbonImmutable|null $created_at * @property \Carbon\CarbonImmutable|null $created_at
* @property \Carbon\CarbonImmutable|null $updated_at * @property \Carbon\CarbonImmutable|null $updated_at
* @method static \Illuminate\Database\Eloquent\Builder|CustomDate newModelQuery() * @method static \Illuminate\Database\Eloquent\Builder|CustomDate newModelQuery()
@@ -11,7 +11,7 @@ use Illuminate\Database\Eloquent\Model;
* the class phpdoc is written back, one is inserted. * the class phpdoc is written back, one is inserted.
* *
* @link https://github.com/barryvdh/laravel-ide-helper/issues/666 * @link https://github.com/barryvdh/laravel-ide-helper/issues/666
* @SuppressWarnings (PHPMD.ExcessiveClassComplexity) * @SuppressWarnings(PHPMD.ExcessiveClassComplexity)
* @property int $id * @property int $id
* @method static \Illuminate\Database\Eloquent\Builder|Simple newModelQuery() * @method static \Illuminate\Database\Eloquent\Builder|Simple newModelQuery()
* @method static \Illuminate\Database\Eloquent\Builder|Simple newQuery() * @method static \Illuminate\Database\Eloquent\Builder|Simple newQuery()
@@ -13,6 +13,8 @@
namespace Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\DoesNotGeneratePhpdocWithExternalEloquentBuilder\Models{ namespace Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\DoesNotGeneratePhpdocWithExternalEloquentBuilder\Models{
/** /**
*
*
* @property int $id * @property int $id
* @property string|null $char_nullable * @property string|null $char_nullable
* @property string $char_not_nullable * @property string $char_not_nullable
@@ -10,6 +10,8 @@ use Illuminate\Database\Eloquent\Relations\HasMany;
use Illuminate\Database\Eloquent\Relations\HasOne; use Illuminate\Database\Eloquent\Relations\HasOne;
/** /**
*
*
* @property-read \Illuminate\Database\Eloquent\Collection<int, Dynamic> $regularHasMany * @property-read \Illuminate\Database\Eloquent\Collection<int, Dynamic> $regularHasMany
* @property-read int|null $regular_has_many_count * @property-read int|null $regular_has_many_count
* @method static \Illuminate\Database\Eloquent\Builder|Dynamic newModelQuery() * @method static \Illuminate\Database\Eloquent\Builder|Dynamic newModelQuery()
@@ -9,7 +9,9 @@ use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model; use Illuminate\Database\Eloquent\Model;
/** /**
* @method static \Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\Factories\CustomSpace\ModelWithCustomNamespaceFactory factory(mixed $count, mixed $state) *
*
* @method static \Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\Factories\CustomSpace\ModelWithCustomNamespaceFactory factory($count = null, $state = [])
* @method static \Illuminate\Database\Eloquent\Builder|ModelWithCustomNamespace newModelQuery() * @method static \Illuminate\Database\Eloquent\Builder|ModelWithCustomNamespace newModelQuery()
* @method static \Illuminate\Database\Eloquent\Builder|ModelWithCustomNamespace newQuery() * @method static \Illuminate\Database\Eloquent\Builder|ModelWithCustomNamespace newQuery()
* @method static \Illuminate\Database\Eloquent\Builder|ModelWithCustomNamespace query() * @method static \Illuminate\Database\Eloquent\Builder|ModelWithCustomNamespace query()
@@ -39,7 +41,9 @@ use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model; use Illuminate\Database\Eloquent\Model;
/** /**
* @method static \Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\Factories\Factories\ModelWithFactoryFactory factory(mixed $count, mixed $state) *
*
* @method static \Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\Factories\Factories\ModelWithFactoryFactory factory($count = null, $state = [])
* @method static \Illuminate\Database\Eloquent\Builder|ModelWithFactory newModelQuery() * @method static \Illuminate\Database\Eloquent\Builder|ModelWithFactory newModelQuery()
* @method static \Illuminate\Database\Eloquent\Builder|ModelWithFactory newQuery() * @method static \Illuminate\Database\Eloquent\Builder|ModelWithFactory newQuery()
* @method static \Illuminate\Database\Eloquent\Builder|ModelWithFactory query() * @method static \Illuminate\Database\Eloquent\Builder|ModelWithFactory query()
@@ -56,7 +60,9 @@ declare(strict_types=1);
namespace Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\Factories\Models; namespace Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\Factories\Models;
/** /**
* @method static \Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\Factories\Factories\ModelWithNestedFactoryFactory factory(mixed $count, mixed $state) *
*
* @method static \Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\Factories\Factories\ModelWithNestedFactoryFactory factory($count = null, $state = [])
* @method static \Illuminate\Database\Eloquent\Builder|ModelWithNestedFactory newModelQuery() * @method static \Illuminate\Database\Eloquent\Builder|ModelWithNestedFactory newModelQuery()
* @method static \Illuminate\Database\Eloquent\Builder|ModelWithNestedFactory newQuery() * @method static \Illuminate\Database\Eloquent\Builder|ModelWithNestedFactory newQuery()
* @method static \Illuminate\Database\Eloquent\Builder|ModelWithNestedFactory query() * @method static \Illuminate\Database\Eloquent\Builder|ModelWithNestedFactory query()
@@ -75,6 +81,8 @@ use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model; use Illuminate\Database\Eloquent\Model;
/** /**
*
*
* @method static \Illuminate\Database\Eloquent\Builder|ModelWithoutFactory newModelQuery() * @method static \Illuminate\Database\Eloquent\Builder|ModelWithoutFactory newModelQuery()
* @method static \Illuminate\Database\Eloquent\Builder|ModelWithoutFactory newQuery() * @method static \Illuminate\Database\Eloquent\Builder|ModelWithoutFactory newQuery()
* @method static \Illuminate\Database\Eloquent\Builder|ModelWithoutFactory query() * @method static \Illuminate\Database\Eloquent\Builder|ModelWithoutFactory query()
@@ -9,6 +9,8 @@ use Illuminate\Database\Eloquent\Builder;
use Illuminate\Database\Eloquent\Model; use Illuminate\Database\Eloquent\Model;
/** /**
*
*
* @property int $id * @property int $id
* @property string|null $char_nullable * @property string|null $char_nullable
* @property string $char_not_nullable * @property string $char_not_nullable
@@ -7,6 +7,8 @@ namespace Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GenerateBasicPhp
use Illuminate\Database\Eloquent\Model; use Illuminate\Database\Eloquent\Model;
/** /**
*
*
* @property int $id * @property int $id
* @property string|null $char_nullable * @property string|null $char_nullable
* @property string $char_not_nullable * @property string $char_not_nullable
@@ -7,6 +7,8 @@ namespace Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GenerateBasicPhp
use Illuminate\Database\Eloquent\Model; use Illuminate\Database\Eloquent\Model;
/** /**
*
*
* @property int $id * @property int $id
* @property string|null $charNullable * @property string|null $charNullable
* @property string $charNotNullable * @property string $charNotNullable
@@ -7,6 +7,8 @@ namespace Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GenerateBasicPhp
use Illuminate\Database\Eloquent\Model; use Illuminate\Database\Eloquent\Model;
/** /**
*
*
* @property int $id * @property int $id
* @property string|null $char_nullable * @property string|null $char_nullable
* @property string $char_not_nullable * @property string $char_not_nullable
@@ -13,6 +13,8 @@
namespace Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GeneratePhpdocWithExternalEloquentBuilder\Models{ namespace Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GeneratePhpdocWithExternalEloquentBuilder\Models{
/** /**
*
*
* @property int $id * @property int $id
* @property string|null $char_nullable * @property string|null $char_nullable
* @property string $char_not_nullable * @property string $char_not_nullable
@@ -8,6 +8,8 @@ use Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GeneratePhpdocWithExte
use Illuminate\Database\Eloquent\Model; use Illuminate\Database\Eloquent\Model;
/** /**
*
*
* @property int $id * @property int $id
* @property string|null $char_nullable * @property string|null $char_nullable
* @property string $char_not_nullable * @property string $char_not_nullable
@@ -9,6 +9,8 @@ use Illuminate\Database\Eloquent\Relations\HasMany;
use Illuminate\Database\Eloquent\SoftDeletes; use Illuminate\Database\Eloquent\SoftDeletes;
/** /**
*
*
* @property int $id * @property int $id
* @property string|null $char_nullable * @property string|null $char_nullable
* @property string $char_not_nullable * @property string $char_not_nullable
@@ -80,84 +82,84 @@ use Illuminate\Database\Eloquent\SoftDeletes;
* @property string $macaddress_not_nullable * @property string $macaddress_not_nullable
* @property \Illuminate\Support\Carbon|null $created_at * @property \Illuminate\Support\Carbon|null $created_at
* @property \Illuminate\Support\Carbon|null $updated_at * @property \Illuminate\Support\Carbon|null $updated_at
* @property-read \Illuminate\Database\Eloquent\Collection<int,\Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GeneratePhpdocWithForcedFqn\Models\Post> $posts * @property-read \Illuminate\Database\Eloquent\Collection<int, \Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GeneratePhpdocWithForcedFqn\Models\Post> $posts
* @property-read int|null $posts_count * @property-read int|null $posts_count
* @method static \Illuminate\Database\Eloquent\Builder|\Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GeneratePhpdocWithForcedFqn\Models\Post newModelQuery() * @method static \Illuminate\Database\Eloquent\Builder|\Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GeneratePhpdocWithForcedFqn\Models\Post newModelQuery()
* @method static \Illuminate\Database\Eloquent\Builder|\Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GeneratePhpdocWithForcedFqn\Models\Post newQuery() * @method static \Illuminate\Database\Eloquent\Builder|\Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GeneratePhpdocWithForcedFqn\Models\Post newQuery()
* @method static \Illuminate\Database\Eloquent\Builder|\Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GeneratePhpdocWithForcedFqn\Models\Post null(string $unusedParam) * @method static \Illuminate\Database\Eloquent\Builder|\Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GeneratePhpdocWithForcedFqn\Models\Post null(string $unusedParam)
* @method static \Illuminate\Database\Eloquent\Builder|\Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GeneratePhpdocWithForcedFqn\Models\Post onlyTrashed() * @method static \Illuminate\Database\Eloquent\Builder|\Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GeneratePhpdocWithForcedFqn\Models\Post onlyTrashed()
* @method static \Illuminate\Database\Eloquent\Builder|\Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GeneratePhpdocWithForcedFqn\Models\Post query() * @method static \Illuminate\Database\Eloquent\Builder|\Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GeneratePhpdocWithForcedFqn\Models\Post query()
* @method static \Illuminate\Database\Eloquent\Builder|\Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GeneratePhpdocWithForcedFqn\Models\Post whereBigIntegerNotNullable(mixed $value) * @method static \Illuminate\Database\Eloquent\Builder|\Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GeneratePhpdocWithForcedFqn\Models\Post whereBigIntegerNotNullable($value)
* @method static \Illuminate\Database\Eloquent\Builder|\Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GeneratePhpdocWithForcedFqn\Models\Post whereBigIntegerNullable(mixed $value) * @method static \Illuminate\Database\Eloquent\Builder|\Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GeneratePhpdocWithForcedFqn\Models\Post whereBigIntegerNullable($value)
* @method static \Illuminate\Database\Eloquent\Builder|\Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GeneratePhpdocWithForcedFqn\Models\Post whereBinaryNotNullable(mixed $value) * @method static \Illuminate\Database\Eloquent\Builder|\Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GeneratePhpdocWithForcedFqn\Models\Post whereBinaryNotNullable($value)
* @method static \Illuminate\Database\Eloquent\Builder|\Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GeneratePhpdocWithForcedFqn\Models\Post whereBinaryNullable(mixed $value) * @method static \Illuminate\Database\Eloquent\Builder|\Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GeneratePhpdocWithForcedFqn\Models\Post whereBinaryNullable($value)
* @method static \Illuminate\Database\Eloquent\Builder|\Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GeneratePhpdocWithForcedFqn\Models\Post whereBooleanNotNullable(mixed $value) * @method static \Illuminate\Database\Eloquent\Builder|\Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GeneratePhpdocWithForcedFqn\Models\Post whereBooleanNotNullable($value)
* @method static \Illuminate\Database\Eloquent\Builder|\Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GeneratePhpdocWithForcedFqn\Models\Post whereBooleanNullable(mixed $value) * @method static \Illuminate\Database\Eloquent\Builder|\Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GeneratePhpdocWithForcedFqn\Models\Post whereBooleanNullable($value)
* @method static \Illuminate\Database\Eloquent\Builder|\Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GeneratePhpdocWithForcedFqn\Models\Post whereCharNotNullable(mixed $value) * @method static \Illuminate\Database\Eloquent\Builder|\Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GeneratePhpdocWithForcedFqn\Models\Post whereCharNotNullable($value)
* @method static \Illuminate\Database\Eloquent\Builder|\Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GeneratePhpdocWithForcedFqn\Models\Post whereCharNullable(mixed $value) * @method static \Illuminate\Database\Eloquent\Builder|\Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GeneratePhpdocWithForcedFqn\Models\Post whereCharNullable($value)
* @method static \Illuminate\Database\Eloquent\Builder|\Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GeneratePhpdocWithForcedFqn\Models\Post whereCreatedAt(mixed $value) * @method static \Illuminate\Database\Eloquent\Builder|\Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GeneratePhpdocWithForcedFqn\Models\Post whereCreatedAt($value)
* @method static \Illuminate\Database\Eloquent\Builder|\Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GeneratePhpdocWithForcedFqn\Models\Post whereDateNotNullable(mixed $value) * @method static \Illuminate\Database\Eloquent\Builder|\Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GeneratePhpdocWithForcedFqn\Models\Post whereDateNotNullable($value)
* @method static \Illuminate\Database\Eloquent\Builder|\Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GeneratePhpdocWithForcedFqn\Models\Post whereDateNullable(mixed $value) * @method static \Illuminate\Database\Eloquent\Builder|\Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GeneratePhpdocWithForcedFqn\Models\Post whereDateNullable($value)
* @method static \Illuminate\Database\Eloquent\Builder|\Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GeneratePhpdocWithForcedFqn\Models\Post whereDatetimeNotNullable(mixed $value) * @method static \Illuminate\Database\Eloquent\Builder|\Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GeneratePhpdocWithForcedFqn\Models\Post whereDatetimeNotNullable($value)
* @method static \Illuminate\Database\Eloquent\Builder|\Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GeneratePhpdocWithForcedFqn\Models\Post whereDatetimeNullable(mixed $value) * @method static \Illuminate\Database\Eloquent\Builder|\Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GeneratePhpdocWithForcedFqn\Models\Post whereDatetimeNullable($value)
* @method static \Illuminate\Database\Eloquent\Builder|\Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GeneratePhpdocWithForcedFqn\Models\Post whereDatetimetzNotNullable(mixed $value) * @method static \Illuminate\Database\Eloquent\Builder|\Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GeneratePhpdocWithForcedFqn\Models\Post whereDatetimetzNotNullable($value)
* @method static \Illuminate\Database\Eloquent\Builder|\Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GeneratePhpdocWithForcedFqn\Models\Post whereDatetimetzNullable(mixed $value) * @method static \Illuminate\Database\Eloquent\Builder|\Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GeneratePhpdocWithForcedFqn\Models\Post whereDatetimetzNullable($value)
* @method static \Illuminate\Database\Eloquent\Builder|\Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GeneratePhpdocWithForcedFqn\Models\Post whereDecimalNotNullable(mixed $value) * @method static \Illuminate\Database\Eloquent\Builder|\Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GeneratePhpdocWithForcedFqn\Models\Post whereDecimalNotNullable($value)
* @method static \Illuminate\Database\Eloquent\Builder|\Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GeneratePhpdocWithForcedFqn\Models\Post whereDecimalNullable(mixed $value) * @method static \Illuminate\Database\Eloquent\Builder|\Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GeneratePhpdocWithForcedFqn\Models\Post whereDecimalNullable($value)
* @method static \Illuminate\Database\Eloquent\Builder|\Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GeneratePhpdocWithForcedFqn\Models\Post whereDoubleNotNullable(mixed $value) * @method static \Illuminate\Database\Eloquent\Builder|\Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GeneratePhpdocWithForcedFqn\Models\Post whereDoubleNotNullable($value)
* @method static \Illuminate\Database\Eloquent\Builder|\Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GeneratePhpdocWithForcedFqn\Models\Post whereDoubleNullable(mixed $value) * @method static \Illuminate\Database\Eloquent\Builder|\Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GeneratePhpdocWithForcedFqn\Models\Post whereDoubleNullable($value)
* @method static \Illuminate\Database\Eloquent\Builder|\Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GeneratePhpdocWithForcedFqn\Models\Post whereEnumNotNullable(mixed $value) * @method static \Illuminate\Database\Eloquent\Builder|\Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GeneratePhpdocWithForcedFqn\Models\Post whereEnumNotNullable($value)
* @method static \Illuminate\Database\Eloquent\Builder|\Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GeneratePhpdocWithForcedFqn\Models\Post whereEnumNullable(mixed $value) * @method static \Illuminate\Database\Eloquent\Builder|\Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GeneratePhpdocWithForcedFqn\Models\Post whereEnumNullable($value)
* @method static \Illuminate\Database\Eloquent\Builder|\Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GeneratePhpdocWithForcedFqn\Models\Post whereFloatNotNullable(mixed $value) * @method static \Illuminate\Database\Eloquent\Builder|\Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GeneratePhpdocWithForcedFqn\Models\Post whereFloatNotNullable($value)
* @method static \Illuminate\Database\Eloquent\Builder|\Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GeneratePhpdocWithForcedFqn\Models\Post whereFloatNullable(mixed $value) * @method static \Illuminate\Database\Eloquent\Builder|\Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GeneratePhpdocWithForcedFqn\Models\Post whereFloatNullable($value)
* @method static \Illuminate\Database\Eloquent\Builder|\Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GeneratePhpdocWithForcedFqn\Models\Post whereId(mixed $value) * @method static \Illuminate\Database\Eloquent\Builder|\Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GeneratePhpdocWithForcedFqn\Models\Post whereId($value)
* @method static \Illuminate\Database\Eloquent\Builder|\Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GeneratePhpdocWithForcedFqn\Models\Post whereIntegerNotNullable(mixed $value) * @method static \Illuminate\Database\Eloquent\Builder|\Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GeneratePhpdocWithForcedFqn\Models\Post whereIntegerNotNullable($value)
* @method static \Illuminate\Database\Eloquent\Builder|\Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GeneratePhpdocWithForcedFqn\Models\Post whereIntegerNullable(mixed $value) * @method static \Illuminate\Database\Eloquent\Builder|\Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GeneratePhpdocWithForcedFqn\Models\Post whereIntegerNullable($value)
* @method static \Illuminate\Database\Eloquent\Builder|\Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GeneratePhpdocWithForcedFqn\Models\Post whereIpaddressNotNullable(mixed $value) * @method static \Illuminate\Database\Eloquent\Builder|\Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GeneratePhpdocWithForcedFqn\Models\Post whereIpaddressNotNullable($value)
* @method static \Illuminate\Database\Eloquent\Builder|\Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GeneratePhpdocWithForcedFqn\Models\Post whereIpaddressNullable(mixed $value) * @method static \Illuminate\Database\Eloquent\Builder|\Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GeneratePhpdocWithForcedFqn\Models\Post whereIpaddressNullable($value)
* @method static \Illuminate\Database\Eloquent\Builder|\Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GeneratePhpdocWithForcedFqn\Models\Post whereJsonNotNullable(mixed $value) * @method static \Illuminate\Database\Eloquent\Builder|\Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GeneratePhpdocWithForcedFqn\Models\Post whereJsonNotNullable($value)
* @method static \Illuminate\Database\Eloquent\Builder|\Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GeneratePhpdocWithForcedFqn\Models\Post whereJsonNullable(mixed $value) * @method static \Illuminate\Database\Eloquent\Builder|\Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GeneratePhpdocWithForcedFqn\Models\Post whereJsonNullable($value)
* @method static \Illuminate\Database\Eloquent\Builder|\Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GeneratePhpdocWithForcedFqn\Models\Post whereJsonbNotNullable(mixed $value) * @method static \Illuminate\Database\Eloquent\Builder|\Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GeneratePhpdocWithForcedFqn\Models\Post whereJsonbNotNullable($value)
* @method static \Illuminate\Database\Eloquent\Builder|\Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GeneratePhpdocWithForcedFqn\Models\Post whereJsonbNullable(mixed $value) * @method static \Illuminate\Database\Eloquent\Builder|\Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GeneratePhpdocWithForcedFqn\Models\Post whereJsonbNullable($value)
* @method static \Illuminate\Database\Eloquent\Builder|\Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GeneratePhpdocWithForcedFqn\Models\Post whereLongTextNotNullable(mixed $value) * @method static \Illuminate\Database\Eloquent\Builder|\Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GeneratePhpdocWithForcedFqn\Models\Post whereLongTextNotNullable($value)
* @method static \Illuminate\Database\Eloquent\Builder|\Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GeneratePhpdocWithForcedFqn\Models\Post whereLongTextNullable(mixed $value) * @method static \Illuminate\Database\Eloquent\Builder|\Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GeneratePhpdocWithForcedFqn\Models\Post whereLongTextNullable($value)
* @method static \Illuminate\Database\Eloquent\Builder|\Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GeneratePhpdocWithForcedFqn\Models\Post whereMacaddressNotNullable(mixed $value) * @method static \Illuminate\Database\Eloquent\Builder|\Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GeneratePhpdocWithForcedFqn\Models\Post whereMacaddressNotNullable($value)
* @method static \Illuminate\Database\Eloquent\Builder|\Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GeneratePhpdocWithForcedFqn\Models\Post whereMacaddressNullable(mixed $value) * @method static \Illuminate\Database\Eloquent\Builder|\Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GeneratePhpdocWithForcedFqn\Models\Post whereMacaddressNullable($value)
* @method static \Illuminate\Database\Eloquent\Builder|\Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GeneratePhpdocWithForcedFqn\Models\Post whereMediumIntegerNotNullable(mixed $value) * @method static \Illuminate\Database\Eloquent\Builder|\Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GeneratePhpdocWithForcedFqn\Models\Post whereMediumIntegerNotNullable($value)
* @method static \Illuminate\Database\Eloquent\Builder|\Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GeneratePhpdocWithForcedFqn\Models\Post whereMediumIntegerNullable(mixed $value) * @method static \Illuminate\Database\Eloquent\Builder|\Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GeneratePhpdocWithForcedFqn\Models\Post whereMediumIntegerNullable($value)
* @method static \Illuminate\Database\Eloquent\Builder|\Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GeneratePhpdocWithForcedFqn\Models\Post whereMediumTextNotNullable(mixed $value) * @method static \Illuminate\Database\Eloquent\Builder|\Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GeneratePhpdocWithForcedFqn\Models\Post whereMediumTextNotNullable($value)
* @method static \Illuminate\Database\Eloquent\Builder|\Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GeneratePhpdocWithForcedFqn\Models\Post whereMediumTextNullable(mixed $value) * @method static \Illuminate\Database\Eloquent\Builder|\Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GeneratePhpdocWithForcedFqn\Models\Post whereMediumTextNullable($value)
* @method static \Illuminate\Database\Eloquent\Builder|\Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GeneratePhpdocWithForcedFqn\Models\Post whereSmallIntegerNotNullable(mixed $value) * @method static \Illuminate\Database\Eloquent\Builder|\Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GeneratePhpdocWithForcedFqn\Models\Post whereSmallIntegerNotNullable($value)
* @method static \Illuminate\Database\Eloquent\Builder|\Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GeneratePhpdocWithForcedFqn\Models\Post whereSmallIntegerNullable(mixed $value) * @method static \Illuminate\Database\Eloquent\Builder|\Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GeneratePhpdocWithForcedFqn\Models\Post whereSmallIntegerNullable($value)
* @method static \Illuminate\Database\Eloquent\Builder|\Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GeneratePhpdocWithForcedFqn\Models\Post whereStringNotNullable(mixed $value) * @method static \Illuminate\Database\Eloquent\Builder|\Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GeneratePhpdocWithForcedFqn\Models\Post whereStringNotNullable($value)
* @method static \Illuminate\Database\Eloquent\Builder|\Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GeneratePhpdocWithForcedFqn\Models\Post whereStringNullable(mixed $value) * @method static \Illuminate\Database\Eloquent\Builder|\Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GeneratePhpdocWithForcedFqn\Models\Post whereStringNullable($value)
* @method static \Illuminate\Database\Eloquent\Builder|\Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GeneratePhpdocWithForcedFqn\Models\Post whereTextNotNullable(mixed $value) * @method static \Illuminate\Database\Eloquent\Builder|\Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GeneratePhpdocWithForcedFqn\Models\Post whereTextNotNullable($value)
* @method static \Illuminate\Database\Eloquent\Builder|\Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GeneratePhpdocWithForcedFqn\Models\Post whereTextNullable(mixed $value) * @method static \Illuminate\Database\Eloquent\Builder|\Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GeneratePhpdocWithForcedFqn\Models\Post whereTextNullable($value)
* @method static \Illuminate\Database\Eloquent\Builder|\Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GeneratePhpdocWithForcedFqn\Models\Post whereTimeNotNullable(mixed $value) * @method static \Illuminate\Database\Eloquent\Builder|\Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GeneratePhpdocWithForcedFqn\Models\Post whereTimeNotNullable($value)
* @method static \Illuminate\Database\Eloquent\Builder|\Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GeneratePhpdocWithForcedFqn\Models\Post whereTimeNullable(mixed $value) * @method static \Illuminate\Database\Eloquent\Builder|\Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GeneratePhpdocWithForcedFqn\Models\Post whereTimeNullable($value)
* @method static \Illuminate\Database\Eloquent\Builder|\Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GeneratePhpdocWithForcedFqn\Models\Post whereTimestampNotNullable(mixed $value) * @method static \Illuminate\Database\Eloquent\Builder|\Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GeneratePhpdocWithForcedFqn\Models\Post whereTimestampNotNullable($value)
* @method static \Illuminate\Database\Eloquent\Builder|\Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GeneratePhpdocWithForcedFqn\Models\Post whereTimestampNullable(mixed $value) * @method static \Illuminate\Database\Eloquent\Builder|\Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GeneratePhpdocWithForcedFqn\Models\Post whereTimestampNullable($value)
* @method static \Illuminate\Database\Eloquent\Builder|\Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GeneratePhpdocWithForcedFqn\Models\Post whereTimestamptzNotNullable(mixed $value) * @method static \Illuminate\Database\Eloquent\Builder|\Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GeneratePhpdocWithForcedFqn\Models\Post whereTimestamptzNotNullable($value)
* @method static \Illuminate\Database\Eloquent\Builder|\Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GeneratePhpdocWithForcedFqn\Models\Post whereTimestamptzNullable(mixed $value) * @method static \Illuminate\Database\Eloquent\Builder|\Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GeneratePhpdocWithForcedFqn\Models\Post whereTimestamptzNullable($value)
* @method static \Illuminate\Database\Eloquent\Builder|\Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GeneratePhpdocWithForcedFqn\Models\Post whereTimetzNotNullable(mixed $value) * @method static \Illuminate\Database\Eloquent\Builder|\Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GeneratePhpdocWithForcedFqn\Models\Post whereTimetzNotNullable($value)
* @method static \Illuminate\Database\Eloquent\Builder|\Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GeneratePhpdocWithForcedFqn\Models\Post whereTimetzNullable(mixed $value) * @method static \Illuminate\Database\Eloquent\Builder|\Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GeneratePhpdocWithForcedFqn\Models\Post whereTimetzNullable($value)
* @method static \Illuminate\Database\Eloquent\Builder|\Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GeneratePhpdocWithForcedFqn\Models\Post whereTinyIntegerNotNullable(mixed $value) * @method static \Illuminate\Database\Eloquent\Builder|\Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GeneratePhpdocWithForcedFqn\Models\Post whereTinyIntegerNotNullable($value)
* @method static \Illuminate\Database\Eloquent\Builder|\Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GeneratePhpdocWithForcedFqn\Models\Post whereTinyIntegerNullable(mixed $value) * @method static \Illuminate\Database\Eloquent\Builder|\Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GeneratePhpdocWithForcedFqn\Models\Post whereTinyIntegerNullable($value)
* @method static \Illuminate\Database\Eloquent\Builder|\Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GeneratePhpdocWithForcedFqn\Models\Post whereUnsignedBigIntegerNotNullable(mixed $value) * @method static \Illuminate\Database\Eloquent\Builder|\Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GeneratePhpdocWithForcedFqn\Models\Post whereUnsignedBigIntegerNotNullable($value)
* @method static \Illuminate\Database\Eloquent\Builder|\Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GeneratePhpdocWithForcedFqn\Models\Post whereUnsignedBigIntegerNullable(mixed $value) * @method static \Illuminate\Database\Eloquent\Builder|\Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GeneratePhpdocWithForcedFqn\Models\Post whereUnsignedBigIntegerNullable($value)
* @method static \Illuminate\Database\Eloquent\Builder|\Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GeneratePhpdocWithForcedFqn\Models\Post whereUnsignedIntegerNotNullable(mixed $value) * @method static \Illuminate\Database\Eloquent\Builder|\Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GeneratePhpdocWithForcedFqn\Models\Post whereUnsignedIntegerNotNullable($value)
* @method static \Illuminate\Database\Eloquent\Builder|\Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GeneratePhpdocWithForcedFqn\Models\Post whereUnsignedIntegerNullable(mixed $value) * @method static \Illuminate\Database\Eloquent\Builder|\Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GeneratePhpdocWithForcedFqn\Models\Post whereUnsignedIntegerNullable($value)
* @method static \Illuminate\Database\Eloquent\Builder|\Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GeneratePhpdocWithForcedFqn\Models\Post whereUnsignedMediumIntegerNotNullable(mixed $value) * @method static \Illuminate\Database\Eloquent\Builder|\Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GeneratePhpdocWithForcedFqn\Models\Post whereUnsignedMediumIntegerNotNullable($value)
* @method static \Illuminate\Database\Eloquent\Builder|\Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GeneratePhpdocWithForcedFqn\Models\Post whereUnsignedMediumIntegerNullable(mixed $value) * @method static \Illuminate\Database\Eloquent\Builder|\Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GeneratePhpdocWithForcedFqn\Models\Post whereUnsignedMediumIntegerNullable($value)
* @method static \Illuminate\Database\Eloquent\Builder|\Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GeneratePhpdocWithForcedFqn\Models\Post whereUnsignedSmallIntegerNotNullable(mixed $value) * @method static \Illuminate\Database\Eloquent\Builder|\Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GeneratePhpdocWithForcedFqn\Models\Post whereUnsignedSmallIntegerNotNullable($value)
* @method static \Illuminate\Database\Eloquent\Builder|\Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GeneratePhpdocWithForcedFqn\Models\Post whereUnsignedSmallIntegerNullable(mixed $value) * @method static \Illuminate\Database\Eloquent\Builder|\Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GeneratePhpdocWithForcedFqn\Models\Post whereUnsignedSmallIntegerNullable($value)
* @method static \Illuminate\Database\Eloquent\Builder|\Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GeneratePhpdocWithForcedFqn\Models\Post whereUnsignedTinyIntegerNotNullable(mixed $value) * @method static \Illuminate\Database\Eloquent\Builder|\Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GeneratePhpdocWithForcedFqn\Models\Post whereUnsignedTinyIntegerNotNullable($value)
* @method static \Illuminate\Database\Eloquent\Builder|\Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GeneratePhpdocWithForcedFqn\Models\Post whereUnsignedTinyIntegerNullable(mixed $value) * @method static \Illuminate\Database\Eloquent\Builder|\Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GeneratePhpdocWithForcedFqn\Models\Post whereUnsignedTinyIntegerNullable($value)
* @method static \Illuminate\Database\Eloquent\Builder|\Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GeneratePhpdocWithForcedFqn\Models\Post whereUpdatedAt(mixed $value) * @method static \Illuminate\Database\Eloquent\Builder|\Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GeneratePhpdocWithForcedFqn\Models\Post whereUpdatedAt($value)
* @method static \Illuminate\Database\Eloquent\Builder|\Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GeneratePhpdocWithForcedFqn\Models\Post whereUuidNotNullable(mixed $value) * @method static \Illuminate\Database\Eloquent\Builder|\Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GeneratePhpdocWithForcedFqn\Models\Post whereUuidNotNullable($value)
* @method static \Illuminate\Database\Eloquent\Builder|\Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GeneratePhpdocWithForcedFqn\Models\Post whereUuidNullable(mixed $value) * @method static \Illuminate\Database\Eloquent\Builder|\Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GeneratePhpdocWithForcedFqn\Models\Post whereUuidNullable($value)
* @method static \Illuminate\Database\Eloquent\Builder|\Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GeneratePhpdocWithForcedFqn\Models\Post whereYearNotNullable(mixed $value) * @method static \Illuminate\Database\Eloquent\Builder|\Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GeneratePhpdocWithForcedFqn\Models\Post whereYearNotNullable($value)
* @method static \Illuminate\Database\Eloquent\Builder|\Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GeneratePhpdocWithForcedFqn\Models\Post whereYearNullable(mixed $value) * @method static \Illuminate\Database\Eloquent\Builder|\Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GeneratePhpdocWithForcedFqn\Models\Post whereYearNullable($value)
* @method static \Illuminate\Database\Eloquent\Builder|\Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GeneratePhpdocWithForcedFqn\Models\Post withTrashed() * @method static \Illuminate\Database\Eloquent\Builder|\Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GeneratePhpdocWithForcedFqn\Models\Post withTrashed()
* @method static \Illuminate\Database\Eloquent\Builder|\Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GeneratePhpdocWithForcedFqn\Models\Post withoutTrashed() * @method static \Illuminate\Database\Eloquent\Builder|\Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GeneratePhpdocWithForcedFqn\Models\Post withoutTrashed()
* @mixin \Eloquent * @mixin \Eloquent
@@ -15,6 +15,8 @@ use Illuminate\Database\Query\Builder as QueryBuilder;
use Illuminate\Support\Carbon; use Illuminate\Support\Carbon;
/** /**
*
*
* @property int $id * @property int $id
* @property string|null $char_nullable * @property string|null $char_nullable
* @property CastType $char_not_nullable * @property CastType $char_not_nullable
@@ -13,6 +13,8 @@
namespace Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GeneratePhpdocWithFqnInExternalFile\Models{ namespace Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GeneratePhpdocWithFqnInExternalFile\Models{
/** /**
*
*
* @property int $id * @property int $id
* @property string|null $char_nullable * @property string|null $char_nullable
* @property string $char_not_nullable * @property string $char_not_nullable
@@ -8,7 +8,7 @@ use Illuminate\Database\Eloquent\Model;
/** /**
* @property $someProp * @property $someProp
* @method void someMethod(string $method) * @method someMethod(string $method)
* @mixin IdeHelperFinalPost * @mixin IdeHelperFinalPost
*/ */
final class FinalPost extends Model final class FinalPost extends Model
@@ -24,7 +24,7 @@ use Illuminate\Database\Eloquent\Model;
/** /**
* @property $someProp * @property $someProp
* @method void someMethod(string $method) * @method someMethod(string $method)
* @mixin IdeHelperPost * @mixin IdeHelperPost
*/ */
class Post extends Model class Post extends Model
@@ -45,8 +45,10 @@ class Post extends Model
namespace Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GeneratePhpdocWithMixin\Models{ namespace Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GeneratePhpdocWithMixin\Models{
/** /**
*
*
* @property $someProp * @property $someProp
* @method void someMethod(string $method) * @method someMethod(string $method)
* @method static \Illuminate\Database\Eloquent\Builder|FinalPost newModelQuery() * @method static \Illuminate\Database\Eloquent\Builder|FinalPost newModelQuery()
* @method static \Illuminate\Database\Eloquent\Builder|FinalPost newQuery() * @method static \Illuminate\Database\Eloquent\Builder|FinalPost newQuery()
* @method static \Illuminate\Database\Eloquent\Builder|FinalPost query() * @method static \Illuminate\Database\Eloquent\Builder|FinalPost query()
@@ -58,8 +60,10 @@ namespace Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GeneratePhpdocWi
namespace Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GeneratePhpdocWithMixin\Models{ namespace Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GeneratePhpdocWithMixin\Models{
/** /**
*
*
* @property $someProp * @property $someProp
* @method void someMethod(string $method) * @method someMethod(string $method)
* @property int $id * @property int $id
* @property string|null $char_nullable * @property string|null $char_nullable
* @property string $char_not_nullable * @property string $char_not_nullable
@@ -9,6 +9,8 @@ use Illuminate\Database\Eloquent\Relations\BelongsToMany;
use Illuminate\Database\Eloquent\Relations\HasMany; use Illuminate\Database\Eloquent\Relations\HasMany;
/** /**
*
*
* @property int $id * @property int $id
* @property-read \Illuminate\Database\Eloquent\Collection|Simple[] $regularBelongsToMany * @property-read \Illuminate\Database\Eloquent\Collection|Simple[] $regularBelongsToMany
* @property-read int|null $regular_belongs_to_many_count * @property-read int|null $regular_belongs_to_many_count
@@ -8,6 +8,8 @@ use DateTime;
use Illuminate\Database\Eloquent\Model; use Illuminate\Database\Eloquent\Model;
/** /**
*
*
* @property int $id * @property int $id
* @property-read int|null $attribute_return_type_int_or_null * @property-read int|null $attribute_return_type_int_or_null
* @property-read array $attribute_returns_array * @property-read array $attribute_returns_array
@@ -7,6 +7,8 @@ namespace Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\Ignored\Models;
use Illuminate\Database\Eloquent\Model; use Illuminate\Database\Eloquent\Model;
/** /**
*
*
* @method static \Illuminate\Database\Eloquent\Builder|NotIgnored newModelQuery() * @method static \Illuminate\Database\Eloquent\Builder|NotIgnored newModelQuery()
* @method static \Illuminate\Database\Eloquent\Builder|NotIgnored newQuery() * @method static \Illuminate\Database\Eloquent\Builder|NotIgnored newQuery()
* @method static \Illuminate\Database\Eloquent\Builder|NotIgnored query() * @method static \Illuminate\Database\Eloquent\Builder|NotIgnored query()
@@ -13,6 +13,8 @@
namespace Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\Interfaces\Models{ namespace Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\Interfaces\Models{
/** /**
*
*
* @method static \Illuminate\Database\Eloquent\Builder|User newModelQuery() * @method static \Illuminate\Database\Eloquent\Builder|User newModelQuery()
* @method static \Illuminate\Database\Eloquent\Builder|User newQuery() * @method static \Illuminate\Database\Eloquent\Builder|User newQuery()
* @method static \Illuminate\Database\Eloquent\Builder|User query() * @method static \Illuminate\Database\Eloquent\Builder|User query()
@@ -23,6 +23,8 @@ use Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\LaravelCustomCasts\Cas
use Illuminate\Database\Eloquent\Model; use Illuminate\Database\Eloquent\Model;
/** /**
*
*
* @property \Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\LaravelCustomCasts\Casts\CastedProperty $casted_property_with_return_type * @property \Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\LaravelCustomCasts\Casts\CastedProperty $casted_property_with_return_type
* @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
* @property \Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\LaravelCustomCasts\Casts\CastedProperty $casted_property_with_return_docblock_fqn * @property \Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\LaravelCustomCasts\Casts\CastedProperty $casted_property_with_return_docblock_fqn
@@ -7,6 +7,8 @@ namespace Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\MagicWhere\Model
use Illuminate\Database\Eloquent\Model; use Illuminate\Database\Eloquent\Model;
/** /**
*
*
* @property int $id * @property int $id
* @property string|null $char_nullable * @property string|null $char_nullable
* @property string $char_not_nullable * @property string $char_not_nullable
@@ -7,6 +7,8 @@ namespace Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\PHPStormNoInspec
use Illuminate\Database\Eloquent\Model; use Illuminate\Database\Eloquent\Model;
/** /**
*
*
* @property int $id * @property int $id
* @method static \Illuminate\Database\Eloquent\Builder|Simple newModelQuery() * @method static \Illuminate\Database\Eloquent\Builder|Simple newModelQuery()
* @method static \Illuminate\Database\Eloquent\Builder|Simple newQuery() * @method static \Illuminate\Database\Eloquent\Builder|Simple newQuery()
@@ -7,6 +7,8 @@ namespace Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\PHPStormNoInspec
use Illuminate\Database\Eloquent\Model; use Illuminate\Database\Eloquent\Model;
/** /**
*
*
* @property int $id * @property int $id
* @method static \Illuminate\Database\Eloquent\Builder|Simple newModelQuery() * @method static \Illuminate\Database\Eloquent\Builder|Simple newModelQuery()
* @method static \Illuminate\Database\Eloquent\Builder|Simple newQuery() * @method static \Illuminate\Database\Eloquent\Builder|Simple newQuery()
@@ -0,0 +1,18 @@
<?php
declare(strict_types=1);
namespace Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\Pivot\Models;
use Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\Pivot\Models\Pivots\CustomPivot;
use Illuminate\Database\Eloquent\Model;
class ModelWithPivot extends Model
{
public function relationWithCustomPivot()
{
return $this->belongsToMany(ModelwithPivot::class)
->using(CustomPivot::class)
->as('customAccessor');
}
}
@@ -0,0 +1,11 @@
<?php
declare(strict_types=1);
namespace Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\Pivot\Models\Pivots;
use Illuminate\Database\Eloquent\Relations\Pivot;
class CustomPivot extends Pivot
{
}
@@ -0,0 +1,24 @@
<?php
declare(strict_types=1);
namespace Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\Pivot;
use Barryvdh\LaravelIdeHelper\Console\ModelsCommand;
use Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\AbstractModelsCommand;
class Test extends AbstractModelsCommand
{
public function test(): void
{
$command = $this->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();
}
}
@@ -0,0 +1,48 @@
<?php
declare(strict_types=1);
namespace Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\Pivot\Models;
use Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\Pivot\Models\Pivots\CustomPivot;
use Illuminate\Database\Eloquent\Model;
/**
*
*
* @property-read CustomPivot $customAccessor
* @property-read \Illuminate\Database\Eloquent\Collection<int, ModelWithPivot> $relationWithCustomPivot
* @property-read int|null $relation_with_custom_pivot_count
* @method static \Illuminate\Database\Eloquent\Builder|ModelWithPivot newModelQuery()
* @method static \Illuminate\Database\Eloquent\Builder|ModelWithPivot newQuery()
* @method static \Illuminate\Database\Eloquent\Builder|ModelWithPivot query()
* @mixin \Eloquent
*/
class ModelWithPivot extends Model
{
public function relationWithCustomPivot()
{
return $this->belongsToMany(ModelwithPivot::class)
->using(CustomPivot::class)
->as('customAccessor');
}
}
<?php
declare(strict_types=1);
namespace Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\Pivot\Models\Pivots;
use Illuminate\Database\Eloquent\Relations\Pivot;
/**
*
*
* @method static \Illuminate\Database\Eloquent\Builder|CustomPivot newModelQuery()
* @method static \Illuminate\Database\Eloquent\Builder|CustomPivot newQuery()
* @method static \Illuminate\Database\Eloquent\Builder|CustomPivot query()
* @mixin \Eloquent
*/
class CustomPivot extends Pivot
{
}
@@ -0,0 +1,13 @@
<?php
declare(strict_types=1);
namespace Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\QueryScopes\Models;
class Post extends PostParent
{
public function scopePublic($query)
{
return $query;
}
}
@@ -0,0 +1,15 @@
<?php
declare(strict_types=1);
namespace Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\QueryScopes\Models;
use Illuminate\Database\Eloquent\Model;
class PostParent extends Model
{
public function scopeActive($query)
{
return $query;
}
}
@@ -0,0 +1,24 @@
<?php
declare(strict_types=1);
namespace Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\QueryScopes;
use Barryvdh\LaravelIdeHelper\Console\ModelsCommand;
use Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\AbstractModelsCommand;
class Test extends AbstractModelsCommand
{
public function test(): void
{
$command = $this->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();
}
}
@@ -0,0 +1,189 @@
<?php
declare(strict_types=1);
namespace Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\QueryScopes\Models;
/**
*
*
* @property int $id
* @property string|null $char_nullable
* @property string $char_not_nullable
* @property string|null $string_nullable
* @property string $string_not_nullable
* @property string|null $text_nullable
* @property string $text_not_nullable
* @property string|null $medium_text_nullable
* @property string $medium_text_not_nullable
* @property string|null $long_text_nullable
* @property string $long_text_not_nullable
* @property int|null $integer_nullable
* @property int $integer_not_nullable
* @property int|null $tiny_integer_nullable
* @property int $tiny_integer_not_nullable
* @property int|null $small_integer_nullable
* @property int $small_integer_not_nullable
* @property int|null $medium_integer_nullable
* @property int $medium_integer_not_nullable
* @property int|null $big_integer_nullable
* @property int $big_integer_not_nullable
* @property int|null $unsigned_integer_nullable
* @property int $unsigned_integer_not_nullable
* @property int|null $unsigned_tiny_integer_nullable
* @property int $unsigned_tiny_integer_not_nullable
* @property int|null $unsigned_small_integer_nullable
* @property int $unsigned_small_integer_not_nullable
* @property int|null $unsigned_medium_integer_nullable
* @property int $unsigned_medium_integer_not_nullable
* @property int|null $unsigned_big_integer_nullable
* @property int $unsigned_big_integer_not_nullable
* @property float|null $float_nullable
* @property float $float_not_nullable
* @property float|null $double_nullable
* @property float $double_not_nullable
* @property string|null $decimal_nullable
* @property string $decimal_not_nullable
* @property int|null $boolean_nullable
* @property int $boolean_not_nullable
* @property string|null $enum_nullable
* @property string $enum_not_nullable
* @property string|null $json_nullable
* @property string $json_not_nullable
* @property string|null $jsonb_nullable
* @property string $jsonb_not_nullable
* @property string|null $date_nullable
* @property string $date_not_nullable
* @property string|null $datetime_nullable
* @property string $datetime_not_nullable
* @property string|null $datetimetz_nullable
* @property string $datetimetz_not_nullable
* @property string|null $time_nullable
* @property string $time_not_nullable
* @property string|null $timetz_nullable
* @property string $timetz_not_nullable
* @property string|null $timestamp_nullable
* @property string $timestamp_not_nullable
* @property string|null $timestamptz_nullable
* @property string $timestamptz_not_nullable
* @property int|null $year_nullable
* @property int $year_not_nullable
* @property string|null $binary_nullable
* @property string $binary_not_nullable
* @property string|null $uuid_nullable
* @property string $uuid_not_nullable
* @property string|null $ipaddress_nullable
* @property string $ipaddress_not_nullable
* @property string|null $macaddress_nullable
* @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|Post active()
* @method static \Illuminate\Database\Eloquent\Builder|Post newModelQuery()
* @method static \Illuminate\Database\Eloquent\Builder|Post newQuery()
* @method static \Illuminate\Database\Eloquent\Builder|Post public()
* @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 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 PostParent
{
public function scopePublic($query)
{
return $query;
}
}
<?php
declare(strict_types=1);
namespace Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\QueryScopes\Models;
use Illuminate\Database\Eloquent\Model;
/**
*
*
* @method static \Illuminate\Database\Eloquent\Builder|PostParent active()
* @method static \Illuminate\Database\Eloquent\Builder|PostParent newModelQuery()
* @method static \Illuminate\Database\Eloquent\Builder|PostParent newQuery()
* @method static \Illuminate\Database\Eloquent\Builder|PostParent query()
* @mixin \Eloquent
*/
class PostParent extends Model
{
public function scopeActive($query)
{
return $query;
}
}
@@ -8,6 +8,8 @@ use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\HasMany; use Illuminate\Database\Eloquent\Relations\HasMany;
/** /**
*
*
* @property int $id * @property int $id
* @property string|null $char_nullable * @property string|null $char_nullable
* @property string $char_not_nullable * @property string $char_not_nullable
@@ -8,6 +8,8 @@ use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\BelongsTo; use Illuminate\Database\Eloquent\Relations\BelongsTo;
/** /**
*
*
* @property int $id * @property int $id
* @property int $not_null_column_with_foreign_key_constraint * @property int $not_null_column_with_foreign_key_constraint
* @property int $not_null_column_with_no_foreign_key_constraint * @property int $not_null_column_with_no_foreign_key_constraint
@@ -59,6 +61,8 @@ use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\BelongsTo; use Illuminate\Database\Eloquent\Relations\BelongsTo;
/** /**
*
*
* @property int $id * @property int $id
* @property int $not_null_column_with_foreign_key_constraint * @property int $not_null_column_with_foreign_key_constraint
* @property int $not_null_column_with_no_foreign_key_constraint * @property int $not_null_column_with_no_foreign_key_constraint
@@ -128,6 +132,8 @@ use Illuminate\Database\Eloquent\Relations\MorphTo;
use Illuminate\Database\Eloquent\Relations\MorphToMany; use Illuminate\Database\Eloquent\Relations\MorphToMany;
/** /**
*
*
* @property int $id * @property int $id
* @property-read Simple|null $relationBelongsTo * @property-read Simple|null $relationBelongsTo
* @property-read AnotherModel|null $relationBelongsToInAnotherNamespace * @property-read AnotherModel|null $relationBelongsToInAnotherNamespace
@@ -35,18 +35,4 @@ class Test extends AbstractModelsCommand
$this->assertStringContainsString('Written new phpDocBlock to', $tester->getDisplay()); $this->assertStringContainsString('Written new phpDocBlock to', $tester->getDisplay());
$this->assertMatchesMockedSnapshot(); $this->assertMatchesMockedSnapshot();
} }
public function testSmartReset(): void
{
$command = $this->app->make(ModelsCommand::class);
$tester = $this->runCommand($command, [
'--write' => true,
'--smart-reset' => true,
]);
$this->assertSame(0, $tester->getStatusCode());
$this->assertStringContainsString('Written new phpDocBlock to', $tester->getDisplay());
$this->assertMatchesMockedSnapshot();
}
} }
@@ -7,6 +7,8 @@ namespace Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\SimpleCasts\Mode
use Illuminate\Database\Eloquent\Model; use Illuminate\Database\Eloquent\Model;
/** /**
*
*
* @property int $cast_to_int * @property int $cast_to_int
* @property int $cast_to_integer * @property int $cast_to_integer
* @property float $cast_to_real * @property float $cast_to_real
@@ -8,6 +8,8 @@ use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\SoftDeletes; use Illuminate\Database\Eloquent\SoftDeletes;
/** /**
*
*
* @property int $id * @property int $id
* @method static \Illuminate\Database\Eloquent\Builder|Simple newModelQuery() * @method static \Illuminate\Database\Eloquent\Builder|Simple newModelQuery()
* @method static \Illuminate\Database\Eloquent\Builder|Simple newQuery() * @method static \Illuminate\Database\Eloquent\Builder|Simple newQuery()
@@ -9,6 +9,8 @@ use Illuminate\Database\Eloquent\Relations\HasMany;
use Illuminate\Database\Query\Builder; use Illuminate\Database\Query\Builder;
/** /**
*
*
* @property-read string|int|null $foo * @property-read string|int|null $foo
* @property-read \Illuminate\Database\Eloquent\Collection<int, UnionTypeModel> $withUnionTypeReturn * @property-read \Illuminate\Database\Eloquent\Collection<int, UnionTypeModel> $withUnionTypeReturn
* @property-read int|null $with_union_type_return_count * @property-read int|null $with_union_type_return_count
@@ -8,6 +8,8 @@ use Illuminate\Database\Eloquent\Builder;
use Illuminate\Database\Eloquent\Model; use Illuminate\Database\Eloquent\Model;
/** /**
*
*
* @property int $id * @property int $id
* @method static Builder|Simple newModelQuery() * @method static Builder|Simple newModelQuery()
* @method static Builder|Simple newQuery() * @method static Builder|Simple newQuery()
+14 -14
View File
@@ -5,10 +5,10 @@ declare(strict_types=1);
namespace Barryvdh\LaravelIdeHelper\Tests; namespace Barryvdh\LaravelIdeHelper\Tests;
use Barryvdh\LaravelIdeHelper\Macro; use Barryvdh\LaravelIdeHelper\Macro;
use Barryvdh\Reflection\DocBlock;
use Barryvdh\Reflection\DocBlock\Tag;
use Illuminate\Database\Eloquent\Builder as EloquentBuilder; use Illuminate\Database\Eloquent\Builder as EloquentBuilder;
use Illuminate\Routing\UrlGenerator; use Illuminate\Routing\UrlGenerator;
use phpDocumentor\Reflection\DocBlock;
use phpDocumentor\Reflection\DocBlock\Tag;
use ReflectionClass; use ReflectionClass;
use ReflectionFunction; use ReflectionFunction;
use ReflectionFunctionAbstract; use ReflectionFunctionAbstract;
@@ -62,7 +62,7 @@ class MacroTest extends TestCase
); );
$this->assertNotNull($phpdoc); $this->assertNotNull($phpdoc);
$this->assertEmpty($phpdoc->getSummary()); $this->assertEmpty($phpdoc->getText());
$this->assertEquals('@param int|null $a', $this->tagsToString($phpdoc, 'param')); $this->assertEquals('@param int|null $a', $this->tagsToString($phpdoc, 'param'));
$this->assertEquals('@return int', $this->tagsToString($phpdoc, 'return')); $this->assertEquals('@return int', $this->tagsToString($phpdoc, 'return'));
$this->assertTrue($phpdoc->hasTag('see')); $this->assertTrue($phpdoc->hasTag('see'));
@@ -86,7 +86,7 @@ class MacroTest extends TestCase
); );
$this->assertNotNull($phpdoc); $this->assertNotNull($phpdoc);
$this->assertStringContainsString('Test docblock', $phpdoc->getSummary()); $this->assertStringContainsString('Test docblock', $phpdoc->getText());
$this->assertEquals('@param int|null $a', $this->tagsToString($phpdoc, 'param')); $this->assertEquals('@param int|null $a', $this->tagsToString($phpdoc, 'param'));
$this->assertEquals('@return int', $this->tagsToString($phpdoc, 'return')); $this->assertEquals('@return int', $this->tagsToString($phpdoc, 'return'));
$this->assertTrue($phpdoc->hasTag('see')); $this->assertTrue($phpdoc->hasTag('see'));
@@ -110,7 +110,7 @@ class MacroTest extends TestCase
); );
$this->assertNotNull($phpdoc); $this->assertNotNull($phpdoc);
$this->assertStringContainsString('Test docblock', $phpdoc->getSummary()); $this->assertStringContainsString('Test docblock', $phpdoc->getText());
$this->assertEquals('@param int|null $a', $this->tagsToString($phpdoc, 'param')); $this->assertEquals('@param int|null $a', $this->tagsToString($phpdoc, 'param'));
$this->assertFalse($phpdoc->hasTag('return')); $this->assertFalse($phpdoc->hasTag('return'));
$this->assertTrue($phpdoc->hasTag('see')); $this->assertTrue($phpdoc->hasTag('see'));
@@ -134,7 +134,7 @@ class MacroTest extends TestCase
); );
$this->assertNotNull($phpdoc); $this->assertNotNull($phpdoc);
$this->assertStringContainsString('Test docblock', $phpdoc->getSummary()); $this->assertStringContainsString('Test docblock', $phpdoc->getText());
$this->assertFalse($phpdoc->hasTag('param')); $this->assertFalse($phpdoc->hasTag('param'));
$this->assertEquals('@return int', $this->tagsToString($phpdoc, 'return')); $this->assertEquals('@return int', $this->tagsToString($phpdoc, 'return'));
$this->assertTrue($phpdoc->hasTag('see')); $this->assertTrue($phpdoc->hasTag('see'));
@@ -159,7 +159,7 @@ class MacroTest extends TestCase
); );
$this->assertNotNull($phpdoc); $this->assertNotNull($phpdoc);
$this->assertStringContainsString('Test docblock', $phpdoc->getSummary()); $this->assertStringContainsString('Test docblock', $phpdoc->getText());
$this->assertEquals('@param \stdClass|null $a aaaaa', $this->tagsToString($phpdoc, 'param')); $this->assertEquals('@param \stdClass|null $a aaaaa', $this->tagsToString($phpdoc, 'param'));
$this->assertEquals('@return int', $this->tagsToString($phpdoc, 'return')); $this->assertEquals('@return int', $this->tagsToString($phpdoc, 'return'));
} }
@@ -183,7 +183,7 @@ class MacroTest extends TestCase
); );
$this->assertNotNull($phpdoc); $this->assertNotNull($phpdoc);
$this->assertStringContainsString('Test docblock', $phpdoc->getSummary()); $this->assertStringContainsString('Test docblock', $phpdoc->getText());
$this->assertEquals('@param mixed $a', $this->tagsToString($phpdoc, 'param')); $this->assertEquals('@param mixed $a', $this->tagsToString($phpdoc, 'param'));
$this->assertEquals('@return \stdClass|null rrrrrrr', $this->tagsToString($phpdoc, 'return')); $this->assertEquals('@return \stdClass|null rrrrrrr', $this->tagsToString($phpdoc, 'return'));
} }
@@ -202,7 +202,7 @@ class MacroTest extends TestCase
PHP)); PHP));
$this->assertNotNull($phpdoc); $this->assertNotNull($phpdoc);
$this->assertStringContainsString('Test docblock', $phpdoc->getSummary()); $this->assertStringContainsString('Test docblock', $phpdoc->getText());
$this->assertEquals('@param \Stringable|string|null $a', $this->tagsToString($phpdoc, 'param')); $this->assertEquals('@param \Stringable|string|null $a', $this->tagsToString($phpdoc, 'param'));
$this->assertEquals('@return \Stringable|string|null', $this->tagsToString($phpdoc, 'return')); $this->assertEquals('@return \Stringable|string|null', $this->tagsToString($phpdoc, 'return'));
} }
@@ -212,7 +212,7 @@ class MacroTest extends TestCase
$tags = $docBlock->getTagsByName($name); $tags = $docBlock->getTagsByName($name);
$tags = array_map( $tags = array_map(
function (Tag $tag) { function (Tag $tag) {
return trim($tag->render()); return trim((string)$tag);
}, },
$tags $tags
); );
@@ -242,13 +242,13 @@ class MacroTest extends TestCase
$macro = new Macro($reflectionMethod, 'URL', new ReflectionClass(UrlGenerator::class), 'macroName'); $macro = new Macro($reflectionMethod, 'URL', new ReflectionClass(UrlGenerator::class), 'macroName');
$output = <<<'DOC' $output = <<<'DOC'
/** /**
* *
* *
* @param string $foo * @param string $foo
* @param int $bar * @param int $bar
* @return string * @return string
* @see \Barryvdh\LaravelIdeHelper\Tests\UrlGeneratorMacroClass::__invoke() * @see \Barryvdh\LaravelIdeHelper\Tests\UrlGeneratorMacroClass::__invoke()
* @static * @static
*/ */
DOC; DOC;
$this->assertSame($output, $macro->getDocComment('')); $this->assertSame($output, $macro->getDocComment(''));
@@ -276,7 +276,7 @@ class MacroMock extends Macro
public function getPhpDoc(ReflectionFunctionAbstract $method, ReflectionClass $class = null): DocBlock public function getPhpDoc(ReflectionFunctionAbstract $method, ReflectionClass $class = null): DocBlock
{ {
return (new Macro($method, '', $class ?? $method->getClosureScopeClass()))->phpdoc->getDocBlock(); return (new Macro($method, '', $class ?? $method->getClosureScopeClass()))->phpdoc;
} }
} }