barryvdh / laravel-ide-helper

IDE Helper for Laravel
MIT License
14.1k stars 1.16k forks source link

Expected type 'iterable'. Found 'Illuminate\Database\Query\iterable'. #1555

Open ghost opened 3 months ago

ghost commented 3 months ago

Versions:

Description:

I am getting the following error inside of the ide helper file in vscode:

Expected type 'iterable'. Found 'Illuminate\Database\Query\iterable'.

If I change this line:

@param \Illuminate\Database\Query\iterable $values

To this:

@param iterable $values

The error disappears.

This happens in multiple places inside of the ide helper file btw.

mfn commented 3 months ago

How does your model look like? Please post more details.

ghost commented 3 months ago

Heres the full code block in the ide helper file:

             * Add a where between statement to the query.
             *
             * @param \Illuminate\Contracts\Database\Query\Expression|string $column
             * @param \Illuminate\Database\Query\iterable $values
             * @param string $boolean
             * @param bool $not
             * @return \Illuminate\Database\Query\Builder 
             * @static 
             */            public static function whereBetween($column, $values, $boolean = 'and', $not = false)
            {
                                /** @var \Illuminate\Database\Query\Builder $instance */
                                return $instance->whereBetween($column, $values, $boolean, $not);
            }

The whereBetween method accepts a generic iterable type in the parameters. Making the changes I previously mentioned resolves the issue.

mfn commented 2 months ago

Heres the full code block in the ide helper file:

No, I asked for the model please.