Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Revert "Fix Collection::implode with \Stringable objects" #54691

Merged
Merged
Show file tree
Hide file tree
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
2 changes: 1 addition & 1 deletion src/Illuminate/Collections/Collection.php
Original file line number Diff line number Diff line change
Expand Up @@ -628,7 +628,7 @@ public function implode($value, $glue = null)

$first = $this->first();

if (is_array($first) || (is_object($first) && ! $first instanceof \Stringable)) {
if (is_array($first) || (is_object($first) && ! $first instanceof Stringable)) {
return implode($glue ?? '', $this->pluck($value)->all());
}

Expand Down
8 changes: 0 additions & 8 deletions tests/Support/SupportCollectionTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@
use PHPUnit\Framework\TestCase;
use ReflectionClass;
use stdClass;
use Symfony\Component\String\ByteString;
use Symfony\Component\VarDumper\VarDumper;
use Traversable;
use UnexpectedValueException;
Expand Down Expand Up @@ -2332,13 +2331,6 @@ public function testImplode($collection)
$this->assertSame('taylor-foo,dayle-bar', $data->implode(fn ($user) => $user['name'].'-'.$user['email'], ','));
}

#[DataProvider('collectionClassProvider')]
public function testImplodeStringable($collection)
{
$data = new $collection([new ByteString('taylor'), new ByteString('dayle')]);
$this->assertSame('taylordayle', $data->implode(''));
}

#[DataProvider('collectionClassProvider')]
public function testTake($collection)
{
Expand Down
Loading