laravel-ide-helper icon indicating copy to clipboard operation
laravel-ide-helper copied to clipboard

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

Open ghost opened this issue 1 year ago • 4 comments

Versions:

  • ide-helper Version: 3
  • Laravel Version: 11
  • PHP Version: 8

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.

ghost avatar Jun 07 '24 23:06 ghost

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

mfn avatar Jun 08 '24 05:06 mfn

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.

ghost avatar Jun 08 '24 18:06 ghost

Heres the full code block in the ide helper file:

No, I asked for the model please.

mfn avatar Jun 10 '24 14:06 mfn

@mfn this has nothing to do with the model. The generated Eloquent class in _ide_helper.php is not parsing correctly "iterable" types.

chack1172 avatar Dec 18 '24 15:12 chack1172