Skip to content

Commit

Permalink
Merge e27ba3d into a868e1d
Browse files Browse the repository at this point in the history
  • Loading branch information
Rias committed Sep 4, 2019
2 parents a868e1d + e27ba3d commit adb7cf7
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 9 deletions.
1 change: 0 additions & 1 deletion src/Macros/FirstOrFail.php
Expand Up @@ -2,7 +2,6 @@

namespace Spatie\CollectionMacros\Macros;

use Illuminate\Support\Collection;
use Spatie\CollectionMacros\Exceptions\CollectionItemNotFound;

/**
Expand Down
2 changes: 1 addition & 1 deletion src/Macros/FromPairs.php
Expand Up @@ -17,7 +17,7 @@ public function __invoke()
{
return function (): Collection {
return $this->reduce(function ($assoc, array $keyValuePair): Collection {
list($key, $value) = $keyValuePair;
[$key, $value] = $keyValuePair;
$assoc[$key] = $value;

return $assoc;
Expand Down
2 changes: 1 addition & 1 deletion src/Macros/SliceBefore.php
Expand Up @@ -29,7 +29,7 @@ public function __invoke()
]);

return $this->eachCons(2)->reduce(function ($sliced, $previousAndCurrent) use ($callback) {
list($previousItem, $item) = $previousAndCurrent;
[$previousItem, $item] = $previousAndCurrent;

$callback($item, $previousItem)
? $sliced->push(new static([$item]))
Expand Down
12 changes: 6 additions & 6 deletions tests/Macros/GroupByModelTest.php
Expand Up @@ -12,7 +12,7 @@ class GroupByModelTest extends TestCase
/** @test */
public function it_can_group_a_collection_by_a_model_with_a_callable()
{
list($model1, $model2, $collection) = $this->getDummies();
[$model1, $model2, $collection] = $this->getDummies();

$expected = [
[$model1, [
Expand All @@ -39,7 +39,7 @@ public function it_can_group_a_collection_by_a_model_with_a_callable()
/** @test */
public function it_can_group_a_collection_by_a_model_with_a_callable_and_custom_key_names()
{
list($model1, $model2, $collection) = $this->getDummies();
[$model1, $model2, $collection] = $this->getDummies();

$grouped = $collection->groupByModel(function ($item) {
return $item['model'];
Expand Down Expand Up @@ -71,7 +71,7 @@ public function it_can_group_a_collection_by_a_model_with_a_callable_and_custom_
/** @test */
public function it_can_group_a_collection_by_a_model_with_a_key()
{
list($model1, $model2, $collection) = $this->getDummies();
[$model1, $model2, $collection] = $this->getDummies();

$grouped = $collection->groupByModel('model');

Expand All @@ -96,7 +96,7 @@ public function it_can_group_a_collection_by_a_model_with_a_key()
/** @test */
public function it_can_group_a_collection_by_a_model_with_a_key_and_custom_key_names()
{
list($model1, $model2, $collection) = $this->getDummies();
[$model1, $model2, $collection] = $this->getDummies();

$grouped = $collection->groupByModel('model', false, 'myKey', 'items');

Expand Down Expand Up @@ -126,7 +126,7 @@ public function it_can_group_a_collection_by_a_model_with_a_key_and_custom_key_n
/** @test */
public function it_can_group_a_collection_by_a_model_with_a_key_and_a_custom_items_key()
{
list($model1, $model2, $collection) = $this->getDummies();
[$model1, $model2, $collection] = $this->getDummies();

$grouped = $collection->groupByModel('model', false, 'model', 'myItems');

Expand Down Expand Up @@ -156,7 +156,7 @@ public function it_can_group_a_collection_by_a_model_with_a_key_and_a_custom_ite
/** @test */
public function it_can_group_a_collection_by_a_model_and_preserve_keys()
{
list($model1, $model2, $collection) = $this->getDummies();
[$model1, $model2, $collection] = $this->getDummies();

$grouped = $collection->groupByModel('model', true, 'model', 'items');

Expand Down

0 comments on commit adb7cf7

Please sign in to comment.