8000 [String] fix before/after[Last]() returning the empty string instead of the original one on non-match by nicolas-grekas · Pull Request #38678 · symfony/symfony · GitHub
[go: up one dir, main page]

Skip to content

[String] fix before/after[Last]() returning the empty string instead of the original one on non-match #38678

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Oct 22, 2020

Conversation

nicolas-grekas
Copy link
Member
Q A
Branch? 5.1
Bug fix? yes
New feature? no
Deprecations? no
Tickets -
License MIT
Doc PR -

The current behavior is the least useful one. Returning the original string when no match is found is the most sensible behavior. It saves code instead of requiring more.

Typical example is when removing a potential suffix:
$bar = $foo->beforeLast(['.svg', '.png']); should remove any of these extensions if found, and return the original string otherwise.

Copy link
Member
@javiereguiluz javiereguiluz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree and I also think that this change is a "bug fix" and not a "BC break".

Copy link
Member
@Nyholm Nyholm left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you

@Nyholm Nyholm merged commit 310926f into symfony:5.1 Oct 22, 2020
@nicolas-grekas nicolas-grekas deleted the s-fix-before-after branch October 26, 2020 18:10
This was referenced Oct 28, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants
0