Skip to content
Discussion options

You must be logged in to vote

Yes, I think it makes sense to open a PR against 12.x for this.

The change should be small and backward-compatible, since it only adds the missing $capitalize argument to Stringable::initials() and forwards it to Str::initials(), same as in 13.x.

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.

Replies: 1 comment 2 replies

Comment options

You must be logged in to vote
2 replies
@mjamilasfihani
Comment options

@mjamilasfihani
Comment options

Answer selected by mjamilasfihani
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants