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

[5.x] Remove Str call forwarding for 🌶️ methods #9637

Merged
merged 4 commits into from
Apr 3, 2024
Merged

[5.x] Remove Str call forwarding for 🌶️ methods #9637

merged 4 commits into from
Apr 3, 2024

Conversation

JohnathonKoster
Copy link
Contributor

This PR brings the following string helpers into the Statamic\Support\Str class to prevent them being called via. dynamic calls or forwarding to Stringy:

  • removeRight
  • collapseWhitespace
  • ensureLeft
  • ensureRight

These functions are used in hot code paths and the forwarding overhead is not insignificant when working with many, many thousands of entries/etc.

@JohnathonKoster JohnathonKoster changed the title [5.x[ Remove Str call forwarding for 🌶️ methods [5.x] Remove Str call forwarding for 🌶️ methods Mar 2, 2024
@JohnathonKoster JohnathonKoster mentioned this pull request Mar 2, 2024
37 tasks
Copy link
Member

@jasonvarga jasonvarga left a comment

Choose a reason for hiding this comment

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

Please target master.

@JohnathonKoster JohnathonKoster changed the base branch from 4.x to master March 8, 2024 01:08
@jasonvarga jasonvarga dismissed their stale review March 11, 2024 16:55

Requested changes were made.

@jasonvarga
Copy link
Member

I can't see any places where Str::collapseWhitespace() is used. The only reference to collapseWhitespace is directly through Stringy. Am I missing something?

@JohnathonKoster
Copy link
Contributor Author

I can't see any places where Str::collapseWhitespace() is used. The only reference to collapseWhitespace is directly through Stringy. Am I missing something?

No, you're correct 🙈 (likely over-aggressive copy/pasta on my part). That one can be removed for now; I can update this PR later today 🙂

@jasonvarga jasonvarga merged commit 8bd663a into statamic:master Apr 3, 2024
16 checks passed
@jasonvarga jasonvarga deleted the remove-some-str-call-forwarding branch April 3, 2024 13:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

2 participants