Skip to content
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

Merged
merged 5 commits into from
Jul 23, 2018
Merged

Clean code #16841

merged 5 commits into from
Jul 23, 2018

Conversation

GraysonChiang
Copy link
Contributor

Description

Just modify some code, and make it Cleaner more...

@magento-cicd2
Copy link
Contributor

magento-cicd2 commented Jul 16, 2018

CLA assistant check
All committers have signed the CLA.

@magento-engcom-team
Copy link
Contributor

Hi @GraysonChiang. Thank you for your contribution
Here is some useful tips how you can test your changes using Magento test environment.
Add the comment under your pull request to deploy test or vanilla Magento instance:

  • @magento-engcom-team give me test instance - deploy test instance based on PR changes
  • @magento-engcom-team give me {$VERSION} instance - deploy vanilla Magento instance

For more details, please, review the Magento Contributor Assistant documentation

@magento-engcom-team
Copy link
Contributor

Hi @ihor-sviziev, thank you for the review.
ENGCOM-2366 has been created to process this Pull Request

@magento-engcom-team
Copy link
Contributor

@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;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  1. Please add space there before ??
  2. Looks like there should not be :

@GraysonChiang
Copy link
Contributor Author

Sor, I fixed it and commit that again.

@GraysonChiang GraysonChiang changed the title clean code Clean code Jul 18, 2018
@@ -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;
Copy link
Contributor

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;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  1. Please add space before ??
  2. 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] ?? : [];
Copy link
Contributor

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] ?? : '';
Copy link
Contributor

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;
Copy link
Contributor

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'];
Copy link
Contributor

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;
Copy link
Contributor

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] ?? [];
Copy link
Contributor

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 ??

@GraysonChiang
Copy link
Contributor Author

I fixed.

@magento-engcom-team
Copy link
Contributor

Hi @ihor-sviziev, thank you for the review.
ENGCOM-2366 has been created to process this Pull Request

@magento-engcom-team magento-engcom-team merged commit f9d546f into magento:2.2-develop Jul 23, 2018
magento-engcom-team pushed a commit that referenced this pull request Jul 23, 2018
@magento-engcom-team
Copy link
Contributor

Hi @GraysonChiang. Thank you for your contribution.
We will aim to release these changes as part of 2.2.6.
Please check the release notes for final confirmation.

Please, consider to port this solution to 2.3 release line.
You may use Porting tool to port commits automatically.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants