Skip to content
This repository has been archived by the owner on Aug 3, 2021. It is now read-only.

Error with larastan. #28

Closed
bolechen opened this issue Oct 28, 2019 · 1 comment
Closed

Error with larastan. #28

bolechen opened this issue Oct 28, 2019 · 1 comment

Comments

@bolechen
Copy link
Contributor

bolechen commented Oct 28, 2019

When i use nunomaduro/larastan package (https://github.com/nunomaduro/larastan) to analyse my code, is have error

 ------ -------------------------------------------------------------------------------------------------
  Line   app/YouzanPush.php
 ------ -------------------------------------------------------------------------------------------------
  84     Method App\YouzanPush::cleanUp() should return Illuminate\Database\Eloquent\Builder but returns
         Illuminate\Database\Eloquent\Collection.
 ------ -------------------------------------------------------------------------------------------------

My code is below:

     * @param Builder $query
     *
     * @return \Illuminate\Database\Eloquent\Builder
     */
    public static function cleanUp(Builder $query): Builder
    {
        return $query->onlyTrashed()->where('deleted_at', '<', Carbon::now()->subMonth());
    }
···
@freekmurze
Copy link
Member

I think Larastan is wrong here. The method currently works (and the typehint is correct)

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants