Skip to content

Commit 2b4dacf

Browse files
ntzmtaylorotwell
authored andcommitted
Revert "[5.5] Add 'filter by attribute' functionality" (#21909)
* Revert "[5.5] Add assertJsonMissingExact method to TestResponse.php (#21881)" This reverts commit 2b4aa9f. * Revert "Add 'filter by attribute' functionality (#21898)" This reverts commit edc6398.
1 parent 7ad7524 commit 2b4dacf

File tree

2 files changed

+2
-13
lines changed

2 files changed

+2
-13
lines changed

src/Illuminate/Support/Collection.php

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -408,15 +408,11 @@ public function except($keys)
408408
/**
409409
* Run a filter over each of the items.
410410
*
411-
* @param mixed|null $callback
411+
* @param callable|null $callback
412412
* @return static
413413
*/
414-
public function filter($callback = null)
414+
public function filter(callable $callback = null)
415415
{
416-
if (is_string($callback)) {
417-
$callback = $this->valueRetriever($callback);
418-
}
419-
420416
if ($callback) {
421417
return new static(Arr::where($this->items, $callback));
422418
}

tests/Support/SupportCollectionTest.php

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -305,13 +305,6 @@ public function testFilter()
305305
$this->assertEquals(['first' => 'Hello', 'second' => 'World'], $c->filter(function ($item, $key) {
306306
return $key != 'id';
307307
})->all());
308-
309-
$c = new Collection([
310-
['value' => 'foo', 'nested' => ['included' => true]],
311-
['value' => 'bar', 'nested' => ['included' => false]],
312-
['value' => 'baz', 'nested' => ['included' => true]],
313-
]);
314-
$this->assertEquals(['foo', 'baz'], $c->filter('nested.included')->pluck('value')->toArray());
315308
}
316309

317310
public function testHigherOrderKeyBy()

0 commit comments

Comments
 (0)