Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 8 additions & 8 deletions src/Illuminate/Support/Collection.php
Original file line number Diff line number Diff line change
Expand Up @@ -1144,14 +1144,14 @@ public function shuffle($seed = null)

if (is_null($seed)) {
shuffle($items);
} else {
srand($seed);

usort($items, function () {
return rand(-1, 1);
});
}

srand($seed);

usort($items, function () {
return rand(-1, 1);
});

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

again ... this is now always going to be executed

return new static($items);
}

Expand Down Expand Up @@ -1548,9 +1548,9 @@ public function offsetSet($key, $value)
{
if (is_null($key)) {
$this->items[] = $value;
} else {
$this->items[$key] = $value;
}

$this->items[$key] = $value;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is always going to be executed now

Copy link

@ghost ghost Jun 4, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@geekcom: you could've only done that shortening if you were breaking the path of execution (using guard clauses for instance). I wouldn't recommend that though, since it alters type signature in this case.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok, let's see what happens with this PR.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you broke the functionality of at least 1 method for no reason at all ... what do you think is going to happen? :)

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

humm, that's make sense, so sorry

}

/**
Expand Down