-
Notifications
You must be signed in to change notification settings - Fork 9.3k
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
Clean code #16841
Clean code #16841
Conversation
Hi @GraysonChiang. Thank you for your contribution
For more details, please, review the Magento Contributor Assistant documentation |
Hi @ihor-sviziev, thank you for the review. |
@GraysonChiang thank you for contributing. Please accept Community Contributors team invitation here to gain extended permissions for this repository. |
@@ -859,7 +859,7 @@ public function getFrame() | |||
*/ | |||
protected function getAttribute($name) | |||
{ | |||
return isset($this->attributes[$name]) ? $this->attributes[$name] : null; | |||
return $this->attributes[$name]?? : 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.
- Please add space there before
??
- Looks like there should not be
:
Sor, I fixed it and commit that again. |
@@ -102,6 +102,6 @@ public function getResult(\Magento\Backend\Model\Menu $menu) | |||
*/ | |||
protected function _getParam($params, $paramName, $defaultValue = null) | |||
{ | |||
return isset($params[$paramName]) ? $params[$paramName] : $defaultValue; | |||
return $params[$paramName]?? $defaultValue; |
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.
Please add space before ??
@@ -321,7 +321,7 @@ function ($title, $storeName) { | |||
*/ | |||
protected function getTypeValue($type) | |||
{ | |||
return isset($this->typeMapping[$type]) ? $this->typeMapping[$type] : self::VALUE_DYNAMIC; | |||
return $this->typeMapping[$type]?? self::VALUE_DYNAMIC; |
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.
- Please add space before
??
- Remove 2nd space after
??
@@ -105,7 +105,7 @@ public function addHandler($method, $handler) | |||
public function getHandlers($method) | |||
{ | |||
$method = strtolower($method); | |||
return isset($this->_handlers[$method]) ? $this->_handlers[$method] : []; | |||
return $this->_handlers[$method] ?? : []; |
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.
Please remove :
(and space hear it)
@@ -312,7 +312,7 @@ public function getGroupByType($type = null) | |||
self::OPTION_TYPE_TIME => self::OPTION_GROUP_DATE, | |||
]; | |||
|
|||
return isset($optionGroupsToTypes[$type]) ? $optionGroupsToTypes[$type] : ''; | |||
return $optionGroupsToTypes[$type] ?? : ''; |
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.
please remove :
(and space near it)
@@ -931,7 +931,7 @@ private function mapConditionType($conditionType) | |||
'eq' => 'in', | |||
'neq' => 'nin' | |||
]; | |||
return isset($conditionsMap[$conditionType]) ? $conditionsMap[$conditionType] : $conditionType; | |||
return $conditionsMap[$conditionType] ?? $conditionType; |
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.
please remove 2nd space after ??
@@ -80,6 +80,6 @@ public function prepare() | |||
*/ | |||
protected function getFilterType($frontendInput) | |||
{ | |||
return isset($this->filterMap[$frontendInput]) ? $this->filterMap[$frontendInput] : $this->filterMap['default']; | |||
return $this->filterMap[$frontendInput] ?? $this->filterMap['default']; |
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.
please remove 2nd space after ??
@@ -44,6 +44,6 @@ public function getFieldset($name, $root = 'global') | |||
if (empty($fieldsets)) { | |||
return null; | |||
} | |||
return isset($fieldsets[$name]) ? $fieldsets[$name] : null; | |||
return $fieldsets[$name] ?? 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.
Please remove 2nd space after ??
@@ -251,6 +251,6 @@ public function populateWithArray(array $data) | |||
*/ | |||
private function getArrayValueByKey($key, array $array) | |||
{ | |||
return isset($array[$key]) ? $array[$key] : []; | |||
return $array[$key] ?? []; |
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.
Please remove 2nd space after ??
I fixed. |
Hi @ihor-sviziev, thank you for the review. |
Hi @GraysonChiang. Thank you for your contribution. Please, consider to port this solution to 2.3 release line. |
Description
Just modify some code, and make it Cleaner more...