From fc2ca8cc1b6624d3a3c3cb3470de5f2279e05a17 Mon Sep 17 00:00:00 2001 From: Mior Muhammad Zaki Date: Wed, 19 Feb 2025 10:59:15 +0800 Subject: [PATCH] Revert "Fix Collection::implode with \Stringable objects (#54630)" This reverts commit 9626c3dca99432b8a95bb884fed92352a4aafc2d. --- src/Illuminate/Collections/Collection.php | 2 +- tests/Support/SupportCollectionTest.php | 8 -------- 2 files changed, 1 insertion(+), 9 deletions(-) diff --git a/src/Illuminate/Collections/Collection.php b/src/Illuminate/Collections/Collection.php index dc2a260df923..01e1114ed84b 100644 --- a/src/Illuminate/Collections/Collection.php +++ b/src/Illuminate/Collections/Collection.php @@ -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()); } diff --git a/tests/Support/SupportCollectionTest.php b/tests/Support/SupportCollectionTest.php index 23c8f90f81d6..beaa1f84109d 100755 --- a/tests/Support/SupportCollectionTest.php +++ b/tests/Support/SupportCollectionTest.php @@ -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; @@ -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) {