Skip to content

Generated Eloquent::whereIn PHPDoc lists $boolean/$not as required; static analyzers (e.g. Intelephense P1005) expect 4 arguments #1784

Description

@stephenjason89

Versions:

  • ide-helper Version: v3.7.0
  • Laravel Version: v12.58.0
  • PHP Version: 8.4.18 (project constraint: ^8.2 || ^8.3 || ^8.4)

Description:

After running php artisan ide-helper:generate, the generated global Eloquent class in _ide_helper.php declares whereIn() with correct PHP default values:

public static function whereIn($column, $values, $boolean = 'and', $not = false)

However, the PHPDoc block above it lists four separate @param tags ($column, $values, $boolean, $not) with no indication that $boolean and $not are optional. Static analyzers that infer required arity from @param count (e.g. Intelephense P1005) then report that four arguments are required.

Models that use @mixin IdeHelper* (from ide-helper:models), which includes @mixin \Eloquent, resolve hovers and diagnostics to App\Models\Foo::whereIn. A valid call such as:

SomeModel::query()->whereIn('id', [1, 2]);

is flagged as not enough arguments (expected 4, found 2) even though runtime and the generated PHP signature only require two.

Runtime behavior matches Laravel’s query builder; the issue is documentation mismatch between PHPDoc and the actual optional parameters.

IDE: VS Code / Cursor with Intelephense 1.18.2 (same behavior is analyzer-dependent, not PHP-runtime).

Steps To Reproduce:

  1. Install barryvdh/laravel-ide-helper and run php artisan ide-helper:generate so _ide_helper.php exists.
  2. Run php artisan ide-helper:models -M (or equivalent) so a model gets @mixin IdeHelper* with @mixin \Eloquent in the generated _ide_helper_models.php.
  3. In application code, open a file and add:
    \App\Models\YourModel::query()->whereIn('id', [1]);
  4. Open _ide_helper.php and locate the generated Eloquent::whereIn method: compare the four @param lines in the docblock to the method signature with default values on $boolean and $not.
  5. In the editor with Intelephense enabled, observe P1005 (or equivalent) on the whereIn call, or hover whereIn and see four parameters presented as required.

Expected: PHPDoc matches optional parameters (or omits optional @param lines) so two-argument whereIn calls are not reported as errors.

Actual: Analyzer treats four @param entries as four required parameters.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions