Skip to content

False positive type error when chaining Query Builder methods on Eloquent Relations #1001

@imKenjo18

Description

@imKenjo18
public function items(): HasMany
{
    return $this->hasMany(InventoryItem::class);
}

public function rootItems(): HasMany
{
    return $this->items()->whereNull('inventory_group_id');
}
Image

Expected Behavior

The extension should recognize that chaining builder methods (like where(), whereNull(), orderBy()) on a Relation object returns the Relation object, not the Builder.

Environment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions