renoki-co/laravel-eloquent-query-cache

PHPStorm complains about method signature

denisgoryaynov opened this issue · 1 comments

When using cacheTags or cacheFor directly on a model query instance, for example Organization::cacheTags(['tag1', 'tag2'])->get(), PHPStorm complains that 'Method call is provided 1 parameters, but the method signature uses 0 parameters' because of the doc block portion in src/Traits/QueryCacheable.php. Currently the methods are declared like this:

... other methods ...
 * @method static \Illuminate\Database\Query\Builder|static cacheFor()
 * @method static \Illuminate\Database\Query\Builder|static cacheTags()
... other methods ...

Adding the method signature to the doc block portion fixes the issue:

... other methods ...
 * @method static \Illuminate\Database\Query\Builder|static cacheFor(\DateTime|int|null  $time)
 * @method static \Illuminate\Database\Query\Builder|static cacheTags(array $cacheTags = [])
... other methods ...

But I don't know if it's the best way to solve this because it requires to copy methods signatures from src/Traits/QueryCacheModule.php every time.

Thanks for mentioning! :D

Fixed in 12669e1.