laravel-ide-helper
laravel-ide-helper copied to clipboard
Expected type 'iterable'. Found 'Illuminate\Database\Query\iterable'.
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.
How does your model look like? Please post more details.
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.
Heres the full code block in the ide helper file:
No, I asked for the model please.
@mfn this has nothing to do with the model. The generated Eloquent class in _ide_helper.php is not parsing correctly "iterable" types.