-
Notifications
You must be signed in to change notification settings - Fork 11k
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.6] Feature/refactor Str::languageSpecificCharsArray() #23330
[5.6] Feature/refactor Str::languageSpecificCharsArray() #23330
Conversation
src/Illuminate/Support/Str.php
Outdated
@@ -56,8 +56,8 @@ public static function ascii($value, $language = 'en') | |||
{ | |||
$languageSpecific = static::languageSpecificCharsArray($language); | |||
|
|||
if (! is_null($languageSpecific)) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is_object(), is_null() and similar is_*() functions calls are not analyzed, instead we recommend to rely on null identity and instanceof operators;
All 'is_null(...)' calls can be safely replaced with 'null === ...' constructs (or 'null !== ...' if the original construct was negated).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The rest of the framework uses is_null
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@ntzm yes, but it will be more clear and correct to use null !== ...
. Should I revert this changes?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It should stay consistent throughout the framework
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@ntzm Rolled back
I understand what you're trying to do, but this part of the code is taken from the Stringy library. Your changes will be lost next time we update this method. |
@sisve hm, good notice 👍 Should I contribute then to |
Pull Request to original repository in progress danielstjules/Stringy#179 |
Description
Improve readability of
Support\Str::languageSpecificCharsArray()
Motivation and context
Associative array could be easier read and support as to different arrays, because you can always see which value refers to which value
How has this been tested?
All tests passed successfully
Types of changes
Checklist: