Skip to content

Conversation

rmunate
Copy link
Contributor

@rmunate rmunate commented Aug 28, 2023

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.
@rmunate rmunate changed the title [10.x] Ajuste Helpers STR y agregado nueva funcion convertCase [10.x] Adjusted STR Helpers and added new function convertCase Aug 28, 2023
@driesvints
Copy link
Member

Seems this pr's tests fail.

@driesvints driesvints self-assigned this Aug 28, 2023
@driesvints driesvints marked this pull request as draft August 28, 2023 14:58
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
@rmunate
Copy link
Contributor Author

rmunate commented Aug 28, 2023

@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.

@rmunate rmunate marked this pull request as ready for review August 28, 2023 16:11
@taylorotwell
Copy link
Member

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.

@taylorotwell
Copy link
Member

Please don't change any unrelated methods.

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants