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

[12.x] Refactor: Remove unnecessary variables in Str class methods #54963

Conversation

mohammadrasoulasghari
Copy link
Contributor

Refactor: Remove unnecessary variables in Str class methods 🧹

In this PR, I've made two small refactoring improvements to remove unnecessary variables: ✨

  1. Replaced the null coalescing assignment operator (??=) with the standard null coalescing operator (??) in the Str::wrap method, as the variable is not used after the operation. 🔄

  2. Removed the unused exception variable in the isUuid method's try-catch block by using PHP 8.0's variable-less catch syntax. 🪄

These changes eliminate unused variables and improve code readability while maintaining the exact same functionality. Removing unnecessary variables contributes to better code maintenance and reduces potential confusion for developers reading the code. 📝

The modifications are minimal and focused on code quality improvements only. 🚀

@taylorotwell taylorotwell merged commit b5695ba into laravel:12.x Mar 10, 2025
41 checks passed
@mohammadrasoulasghari mohammadrasoulasghari deleted the refactor/str-wrap-replace-null-coalescing-assignment branch March 10, 2025 17:19
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