Skip to content

[9.x] Add Ignore Case of Str::contains and Str::containsAll to Stringable contains and containsAll#44369

Merged
taylorotwell merged 2 commits intolaravel:9.xfrom
byt3sage:feature/add-case-sensitivity-to-fluent-string-contains
Sep 29, 2022
Merged

[9.x] Add Ignore Case of Str::contains and Str::containsAll to Stringable contains and containsAll#44369
taylorotwell merged 2 commits intolaravel:9.xfrom
byt3sage:feature/add-case-sensitivity-to-fluent-string-contains

Conversation

@byt3sage
Copy link
Copy Markdown
Contributor

This PR is here to resolve a little gremlin I found when using Fluent Strings. I wanted to do ->contains() and I needed it to ignore case. It turns out this isn't possible with the Stringable class. I've added in the ability to pass a boolean to Stringable contains and containsAll like how Str contains and containsAll works. I've also updated the pre-existing tests to test that ignore case works.

This doesn't break any existing implementations of these functions because it is an optional parameter placed last.

Now I did think about adding this to whenContains and whenContainsAll - if you feel this would be of benefit also within this PR then let me know and I'll get that bashed in.

I'm aware this is my first PR to the framework, so any feedback would be greatly appreciated.

@byt3sage byt3sage changed the title Add Ignore Case of Str::contains and Str::containsAll to Stringable contains and containsAll [9.x] Add Ignore Case of Str::contains and Str::containsAll to Stringable contains and containsAll Sep 29, 2022
@taylorotwell taylorotwell merged commit f7a5cfc into laravel:9.x Sep 29, 2022
@byt3sage byt3sage deleted the feature/add-case-sensitivity-to-fluent-string-contains branch February 25, 2023 11:50
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