Skip to content

Commit

Permalink
Fix Collection::implode() string argument (#41468)
Browse files Browse the repository at this point in the history
collect(['foo', 'bar'])->implode('_') should be 'foo-bar' but it
instead attempts to call translator helper _().

For callable only support Closure, an invokable class, or a
[class, 'method'] array pair.
  • Loading branch information
derekmd committed Mar 14, 2022
1 parent 11c6786 commit fafe2b9
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion Collection.php
Original file line number Diff line number Diff line change
Expand Up @@ -583,7 +583,7 @@ public function hasAny($key)
*/
public function implode($value, $glue = null)
{
if (is_callable($value)) {
if ($this->useAsCallable($value)) {
return implode($glue ?? '', $this->map($value)->all());
}

Expand Down

0 comments on commit fafe2b9

Please sign in to comment.