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

[8.x] Add a simple Str::repeat() helper function #36887

Merged
merged 3 commits into from
Apr 6, 2021

Conversation

JonaLoeffler
Copy link
Contributor

This PR adds a simple repeat() function to the Str and Stringable classes.

Given most other string manipulation methods are present in these classes, one might also expect to find the str_repeat() functionality.

@driesvints driesvints changed the title Add a simple Str::repeat() helper function [8.x] Add a simple Str::repeat() helper function Apr 6, 2021
@GrahamCampbell
Copy link
Member

This seems quite unnecessary IMO.

@JonaLoeffler
Copy link
Contributor Author

JonaLoeffler commented Apr 6, 2021

I am currently using a longer Stringable expression and because there currently is no repeat() I had to break that chain an manually call str_repeat() making the code harder to read.

A straightforward solution is to add macros to both Str and Stringable that achieve exactly the same behaviour, but I thought this might actually be useful to others.

@taylorotwell taylorotwell merged commit 141e223 into laravel:8.x Apr 6, 2021
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.

None yet

3 participants