-
Notifications
You must be signed in to change notification settings - Fork 357
Closed
Description
- Scout Version: 8.3.1
- Laravel Version: 7.28.3
- PHP Version: 7.4.9
Description:
The $callback property of the Laravel\Scout\Builder is defined as a string.
/**
* Optional callback before search execution.
*
* @var string
*/
public $callback;In the constructor the $callback parameter is defined as either a closure or null, although the docblock does not reflect the possible null value.
/**
* Create a new search builder instance.
*
* @param \Illuminate\Database\Eloquent\Model $model
* @param string $query
* @param \Closure $callback <--- this should say \Closure|null
* @param bool $softDelete
* @return void
*/
public function __construct($model, $query, $callback = null, $softDelete = false)
{
$this->model = $model;
$this->query = $query;
$this->callback = $callback; // <--- a property of type string is set with a closure
if ($softDelete) {
$this->wheres['__soft_deleted'] = 0;
}
}Proposal:
Change the type hint for the $callback property to be @var \Closure|null, just like the $queryCallback property. And also update the constructor docblock to match the parameter value.
Metadata
Metadata
Assignees
Labels
No labels