plugin icon indicating copy to clipboard operation
plugin copied to clipboard

[Bug]: Mixins not recognized (properly) for hammerstonedev/fast-paginate

Open xHeaven opened this issue 2 years ago • 0 comments

Bug description

When using the fastPaginate() or simpleFastPaginate() method from the hammerstonedev/fast-paginate package, Laravel Idea won't recognize its methods under the Builder class, and recognizes - but incorrectly, though - for Relations.

I'm not sure if this is fixable on the plugin's end, or it's completely a package related issue. If the latter, is there any way to fix this behavior, without creating my own IDE helper classes with @method PHPDocs?

Plugin version

7.4.3.232

Operating system

Linux

Steps to reproduce

  1. composer require hammerstone/fast-paginate:^1.0
  2. Create a Controller
  3. Run User::query()->fastPaginate() or User::query()->simpleFastPaginate()
    • It runs perfectly fine, but PHPStorm says Method 'fastPaginate' not found in \Illuminate\Database\Eloquent\Builder|\LaravelIdea\Helper\App\Models\_IH_User_QB
  4. Run User::first()->posts()->fastPaginate(); or User::first()->posts()->simpleFastPaginate();
    • It runs perfectly fine, however, Laravel Idea thinks it'll return HigherOrderTapProxy|mixed, which is not right, because it'll return Illuminate\Pagination\LengthAwarePaginator

Relevant log output

// _ide_helper_macro.php
namespace Illuminate\Database\Eloquent\Relations {

    use Illuminate\Support\HigherOrderTapProxy;

    /**
     * @method HigherOrderTapProxy|mixed fastPaginate($perPage = null, $columns = ['*'], $pageName = 'page', $page = null)
     * @method HigherOrderTapProxy|mixed simpleFastPaginate($perPage = null, $columns = ['*'], $pageName = 'page', $page = null)
     */
    class Relation {}
}

xHeaven avatar Oct 28 '23 00:10 xHeaven