Laravel v12.x initials method in Stringable #60652
-
|
can we make a PR for v12.x to resolve this issue? because in v13.x is already fixed. framework/src/Illuminate/Support/Stringable.php Lines 894 to 902 in fe2afc0 |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 2 replies
-
|
Yes, I think it makes sense to open a PR against The change should be small and backward-compatible, since it only adds the missing Suggested patch: public function initials($capitalize = false)
{
return new static(Str::initials($this->value, $capitalize));
}We should also include/update tests to cover both cases: $this->assertSame('to', (string) Str::of('Taylor Otwell')->initials());
$this->assertSame('TO', (string) Str::of('Taylor Otwell')->initials(true));Yes, that sounds good. If you’re okay with it, I’d be happy to prepare a PR targeting 12.x. |
Beta Was this translation helpful? Give feedback.
Yes, I think it makes sense to open a PR against
12.xfor this.The change should be small and backward-compatible, since it only adds the missing
$capitalizeargument toStringable::initials()and forwards it toStr::initials(), same as in13.x.Suggested patch:
We should also include/update tests to cover both cases:
Yes, that sounds good. If you’re okay with it, I’d be happy to prepare a PR targeting 12.x.