Skip to content

Commit b006f6d

Browse files
committed
Move contract on Enumerable
It doesn't really makes sense that Enumerable is also array accesible or has anything to do with JSON manipulations. These interfaces should be defined on the implementing class. It does makes sense however to keep Countable and IteratorAggregate as we're still talking about collections here. But we shouldn't force people to also implement ArrayAccess or also any JSON contracts.
1 parent 4bf9f8b commit b006f6d

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

src/Illuminate/Collections/Enumerable.php

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,9 @@
33
namespace Illuminate\Collections;
44

55
use Countable;
6-
use Illuminate\Contracts\Support\Arrayable;
7-
use Illuminate\Contracts\Support\Jsonable;
86
use IteratorAggregate;
9-
use JsonSerializable;
107

11-
interface Enumerable extends Arrayable, Countable, IteratorAggregate, Jsonable, JsonSerializable
8+
interface Enumerable extends Countable, IteratorAggregate
129
{
1310
/**
1411
* Create a new collection instance if the value isn't one already.

src/Illuminate/Collections/LazyCollection.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,14 @@
44

55
use ArrayIterator;
66
use Closure;
7+
use Illuminate\Contracts\Support\Arrayable;
8+
use Illuminate\Contracts\Support\Jsonable;
79
use Illuminate\Macroable\Macroable;
810
use IteratorAggregate;
11+
use JsonSerializable;
912
use stdClass;
1013

11-
class LazyCollection implements Enumerable
14+
class LazyCollection implements Arrayable, Enumerable, Jsonable, JsonSerializable
1215
{
1316
use EnumeratesValues, Macroable;
1417

0 commit comments

Comments
 (0)