laravel-mongodb icon indicating copy to clipboard operation
laravel-mongodb copied to clipboard

ScoutEngine: correct `delete()` TypeError message to reference EloquentCollection

Open zigzagdev opened this issue 1 month ago • 0 comments

Context

The ScoutEngine::delete() method requires an Illuminate\Database\Eloquent\Collection (alias EloquentCollection). However, the thrown TypeError message incorrectly states the expected type as Illuminate\Support\Collection, which misleads during debugging.

Problem

Current message (incorrect): Argument #1 ($models) must be of type Illuminate\Support\Collection

This contradicts the actual method contract and the behaviour of update(), which already reports EloquentCollection correctly.

Change

Update the thrown TypeError message in ScoutEngine::delete() to name Illuminate\Database\Eloquent\Collection (EloquentCollection) as the expected type.

Tests

Adjust/confirm the expectation in testDeleteRejectsNonEloquentCollection() to assert the corrected message: Argument #1 ($models) must be of type Illuminate\Database\Eloquent\Collection. スクリーンショット 2025-10-30 17 00 07

Checklist

  • [x] Add tests and ensure they pass

zigzagdev avatar Oct 30 '25 08:10 zigzagdev