Skip to content

Conversation

@Rahul-Mac
Copy link
Contributor

Currently, Illuminate\Support\Stringable::exactly() only supports string or an instance of Illuminate\Support\Stringable as the $value parameter.

This PR aims to enhance the allowed types for exactly() by accepting any object that implements \Stringable.

Let's assume we have an object like this:

$object = new class () implements \Stringable {
    public function __toString(): string
    {
        return "foo";
    }
}

Earlier:

Str::of('foo')->exactly($object); // false

Now:

Str::of('foo')->exactly($object); // true

@taylorotwell
Copy link
Member

I think it's fine as is.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants