-
-
Notifications
You must be signed in to change notification settings - Fork 825
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
[REF] CRM_Utils_Array::value() -> empty() #16704
Conversation
(Standard links)
|
b716053
to
7396bec
Compare
@@ -546,7 +546,7 @@ public function preProcess() { | |||
|
|||
// assign context to drive the template display, make sure context is valid | |||
$this->_context = CRM_Utils_Request::retrieve('context', 'Alphanumeric', $this, FALSE, 'search'); | |||
if (!CRM_Utils_Array::value($this->_context, self::validContext())) { | |||
if (!array_key_exists($this->_context, self::validContext())) { |
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.
Theoretically these aren't equal. I don't see any code outside this class that manipulates the $_validContext property directly (which is what is returned by self::validContext()), and it seems unlikely anyone would do something screwy with it like change it to null, but it's a public property. Seems low risk though.
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.
My thoughts too.
Replaces CRM_Utils_Array::value() with empty() when the value is immediately cast to boolean. The two statements have identical meaning but the latter is faster & easier to read.
Ok looks good I don't have anything more to add. |
test this please |
1 similar comment
test this please |
Unrelated fail |
Overview
Replaces
CRM_Utils_Array::value()
withempty()
when the value is immediately cast to boolean.The two statements have identical meaning but the latter is faster & easier to read.
Technical Details
Before/after should be functionally identical.
Comments
This was done via regex with some spot-checking.