Skip to content

Commit cd9a43d

Browse files
committed
Add Closure typehint to AdapterInterface::load()
1 parent 32a9fbe commit cd9a43d

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

src/Adapter/AdapterInterface.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111

1212
namespace Tobyz\JsonApiServer\Adapter;
1313

14+
use Closure;
1415
use Tobyz\JsonApiServer\Context;
1516
use Tobyz\JsonApiServer\Schema\Attribute;
1617
use Tobyz\JsonApiServer\Schema\HasMany;
@@ -226,11 +227,11 @@ public function delete($model): void;
226227
*
227228
* @param array $models
228229
* @param array $relationships
229-
* @param mixed $scope Should be called to give the deepest relationship
230+
* @param Closure $scope Should be called to give the deepest relationship
230231
* an opportunity to scope the query that will fetch related resources
231232
* @param bool $linkage true if we just need the IDs of the related
232233
* resources and not their full data
233234
* @return mixed
234235
*/
235-
public function load(array $models, array $relationships, $scope, bool $linkage): void;
236+
public function load(array $models, array $relationships, Closure $scope, bool $linkage): void;
236237
}

src/Adapter/EloquentAdapter.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -204,7 +204,7 @@ public function paginate($query, int $limit, int $offset): void
204204
$query->take($limit)->skip($offset);
205205
}
206206

207-
public function load(array $models, array $relationships, $scope, bool $linkage): void
207+
public function load(array $models, array $relationships, Closure $scope, bool $linkage): void
208208
{
209209
// TODO: Find the relation on the model that we're after. If it's a
210210
// belongs-to relation, and we only need linkage, then we won't need

0 commit comments

Comments
 (0)