-
Notifications
You must be signed in to change notification settings - Fork 11.2k
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
[10.x] Adjusted STR Helpers and added new function convertCase #48221
Conversation
The types of data required for the helper functions are adjusted, the "casting" is removed since the type of data to be received is defined from the beginning, the "padBoth" function is adjusted since it lacked a length validation of the chain. Ternary returns are adjusted in cases where they are easily understandable and applicable. Added the function Str::convertCase(string $string, int $mode = MB_CASE_FOLD, ?string $encoding = null) which is used to convert the character case to a string, especially when working with multibyte strings, which can contain characters from various languages and character sets.
Seems this pr's tests fail. |
The types of data required for the helper functions are adjusted, the "casting" is removed since the type of data to be received is defined from the beginning, the "padBoth" function is adjusted since it lacked a length validation of the chain. Ternary returns are adjusted in cases where they are easily understandable and applicable. Added the function Str::convertCase(string $string, int $mode = MB_CASE_FOLD, ?string $encoding = null) which is used to convert the character case to a string, especially when working with multibyte strings, which can contain characters from various languages and character sets.
The types of data required for the helper functions are adjusted, the "casting" is removed since the type of data to be received is defined from the beginning, the "padBoth" function is adjusted since it lacked a length validation of the chain. Ternary returns are adjusted in cases where they are easily understandable and applicable. Added the function Str::convertCase(string $string, int $mode = MB_CASE_FOLD, ?string $encoding = null) which is used to convert the character case to a string, especially when working with multibyte strings, which can contain characters from various languages and character sets.
The types of data required for the helper functions are adjusted, the "casting" is removed since the type of data to be received is defined from the beginning, the "padBoth" function is adjusted since it lacked a length validation of the chain. Ternary returns are adjusted in cases where they are easily understandable and applicable. Added the function Str::convertCase(string $string, int $mode = MB_CASE_FOLD, ?string $encoding = null) which is used to convert the character case to a string, especially when working with multibyte strings, which can contain characters from various languages and character sets.
1) Illuminate\Tests\Support\SupportStrTest::testStrExcerpt TypeError: Illuminate\Support\Str::excerpt(): Argument #1 ($text) must be of type string, null given, called in /home/runner/work/framework/framework/tests/Support/SupportStrTest.php on line 185 /home/runner/work/framework/framework/src/Illuminate/Support/Str.php:309 /home/runner/work/framework/framework/tests/Support/SupportStrTest.php:185 2) Illuminate\Tests\Support\SupportStrTest::testIs TypeError: Illuminate\Support\Str::is(): Argument #2 ($value) must be of type string, null given, called in /home/runner/work/framework/framework/tests/Support/SupportStrTest.php on line 405 /home/runner/work/framework/framework/src/Illuminate/Support/Str.php:371 /home/runner/work/framework/framework/tests/Support/SupportStrTest.php:405 3) Illuminate\Tests\Support\SupportStrTest::testAsciiNull TypeError: Illuminate\Support\Str::ascii(): Argument #1 ($value) must be of type string, null given, called in /home/runner/work/framework/framework/tests/Support/SupportStrTest.php on line 869 /home/runner/work/framework/framework/src/Illuminate/Support/Str.php:112 /home/runner/work/framework/framework/tests/Support/SupportStrTest.php:869 4) Illuminate\Tests\Support\SupportStringableTest::testCharAt TypeError: Illuminate\Support\Str::charAt(): Argument #2 ($index) must be of type int, string given, called in /home/runner/work/framework/framework/src/Illuminate/Support/Stringable.php on line 110 /home/runner/work/framework/framework/src/Illuminate/Support/Str.php:218 /home/runner/work/framework/framework/src/Illuminate/Support/Stringable.php:110 /home/runner/work/framework/framework/tests/Support/SupportStringableTest.php:981 5) Illuminate\Tests\View\ViewBladeCompilerTest::testDontIncludeNullPath TypeError: Illuminate\Support\Str::after(): Argument #1 ($subject) must be of type string, null given, called in /home/runner/work/framework/framework/src/Illuminate/View/Compilers/Compiler.php on line 84
@driesvints driesvints I have taken the time to adjust the errors of the Tests, I hope it is useful, thanks engineer. In case the collaboration is useful, I will apply the PR to the documentation to add the use of the function. |
Thanks for your pull request to Laravel! Unfortunately, I'm going to delay merging this code for now. To preserve our ability to adequately maintain the framework, we need to be very careful regarding the amount of code we include. If possible, please consider releasing your code as a package so that the community can still take advantage of your contributions! If you feel absolutely certain that this code corrects a bug in the framework, please "@" mention me in a follow-up comment with further explanation so that GitHub will send me a notification of your response. |
Please don't change any unrelated methods. |
The types of data required for the helper functions are adjusted, the "casting" is removed since the type of data to be received is defined from the beginning, the "padBoth" function is adjusted since it lacked a length validation of the chain.
Ternary returns are adjusted in cases where they are easily understandable and applicable.
Added the function Str::convertCase(string $string, int $mode = MB_CASE_FOLD, ?string $encoding = null) which is used to convert the character case to a string, especially when working with multibyte strings, which can contain characters from various languages and character sets.