-
-
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
[NFC] Use strict comparison where possible #16896
Conversation
(Standard links)
|
test this please |
CRM/Activity/Form/Activity.php
Outdated
@@ -823,7 +823,7 @@ public function buildQuickForm() { | |||
*/ | |||
public static function formRule($fields, $files, $self) { | |||
// skip form rule if deleting | |||
if (CRM_Utils_Array::value('_qf_Activity_next_', $fields) == 'Delete') { | |||
if ($fields['_qf_Activity_next_'] ?? NULL === 'Delete') { |
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.
This seems a little ambiguous about which operator goes first (?? or ===)
if ($fields['_qf_Activity_next_'] ?? NULL === 'Delete') { | |
if (($fields['_qf_Activity_next_'] ?? NULL) === 'Delete') { |
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.
lol - I was going the brackets but thought you have been removing them from lots of places where I wanted them
CRM/Activity/Form/Activity.php
Outdated
@@ -958,7 +958,7 @@ public function postProcess($params = NULL) { | |||
$this->_activityId | |||
); | |||
|
|||
$params['is_multi_activity'] = CRM_Utils_Array::value('separation', $params) == 'separate'; | |||
$params['is_multi_activity'] = $params['separation'] ?? NULL === 'separate'; |
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.
$params['is_multi_activity'] = $params['separation'] ?? NULL === 'separate'; | |
$params['is_multi_activity'] = ($params['separation'] ?? NULL) === 'separate'; |
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.
@colemanw fixed
Also fixes a couple of comments & uses of Array::value
Unrelated fail. |
Overview
Minor code standards cleanup
Before
Non-strict comparison used when comparing against strings
After
Strict comparison used
Technical Details
Also fixes a couple of comments & uses of Array::value
Comments
Strict comparison should always be used where possible