Skip to content
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

[11.x] slug() with alphanumeric separator #54446

Open
wants to merge 1 commit into
base: 11.x
Choose a base branch
from

Conversation

faissaloux
Copy link
Contributor

@faissaloux faissaloux commented Feb 3, 2025

Fixes #54444

This PR made slug() fallback to default separator (-) when an alphanumeric separator been passed.

Examples

Before

str('nad')->slug('az'); // nazd

After

str('nad')->slug('az'); // nad

str('hello world')->slug('e'); // hello-word
str('hello world')->slug('2'); // hello-word

@shaedrich
Copy link
Contributor

I don't like these silent fallbacks that might not be intuitive and therefore easily overlooked when something doesn't work as expected. Maybe, throwing an exception is more intuitive.

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.

Weird behavior of Str::slug in particular language
2 participants