From 3cb22bea22875d059ccce89cf6379dc151a28860 Mon Sep 17 00:00:00 2001 From: Alexander Shkurko Date: Sun, 14 Jan 2018 12:40:28 +0100 Subject: [PATCH] Optimization: magento/module-eav is_null change to strict comparison instead --- app/code/Magento/Eav/Model/Attribute.php | 4 ++-- app/code/Magento/Eav/Model/Attribute/Data/AbstractData.php | 6 +++--- app/code/Magento/Eav/Model/Entity/AbstractEntity.php | 2 +- .../Magento/Eav/Model/Entity/Attribute/Backend/Datetime.php | 2 +- 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/app/code/Magento/Eav/Model/Attribute.php b/app/code/Magento/Eav/Model/Attribute.php index 64504b59fe9c9..e53f3ccc82a75 100644 --- a/app/code/Magento/Eav/Model/Attribute.php +++ b/app/code/Magento/Eav/Model/Attribute.php @@ -62,7 +62,7 @@ public function setWebsite($website) */ public function getWebsite() { - if (is_null($this->_website)) { + if ($this->_website === null) { $this->_website = $this->_storeManager->getWebsite(); } @@ -88,7 +88,7 @@ public function afterSave() public function getUsedInForms() { $forms = $this->getData('used_in_forms'); - if (is_null($forms)) { + if ($forms === null) { $forms = $this->_getResource()->getUsedInForms($this); $this->setData('used_in_forms', $forms); } diff --git a/app/code/Magento/Eav/Model/Attribute/Data/AbstractData.php b/app/code/Magento/Eav/Model/Attribute/Data/AbstractData.php index ed052cb71e2fa..12023acc3b33b 100644 --- a/app/code/Magento/Eav/Model/Attribute/Data/AbstractData.php +++ b/app/code/Magento/Eav/Model/Attribute/Data/AbstractData.php @@ -205,7 +205,7 @@ public function setExtractedData(array $data) */ public function getExtractedData($index = null) { - if (!is_null($index)) { + if ($index !== null) { if (isset($this->_extractedData[$index])) { return $this->_extractedData[$index]; } @@ -262,9 +262,9 @@ protected function _getFormFilter() */ protected function _dateFilterFormat($format = null) { - if (is_null($format)) { + if ($format === null) { // get format - if (is_null($this->_dateFilterFormat)) { + if ($this->_dateFilterFormat === null) { $this->_dateFilterFormat = \IntlDateFormatter::SHORT; } return $this->_localeDate->getDateFormat($this->_dateFilterFormat); diff --git a/app/code/Magento/Eav/Model/Entity/AbstractEntity.php b/app/code/Magento/Eav/Model/Entity/AbstractEntity.php index b0d186705026f..feb2c4d7d3f9f 100644 --- a/app/code/Magento/Eav/Model/Entity/AbstractEntity.php +++ b/app/code/Magento/Eav/Model/Entity/AbstractEntity.php @@ -1294,7 +1294,7 @@ protected function _collectSaveData($newObject) $origData = $this->_getOrigObject($newObject)->getOrigData(); } - if (is_null($origData)) { + if ($origData === null) { $origData = []; } diff --git a/app/code/Magento/Eav/Model/Entity/Attribute/Backend/Datetime.php b/app/code/Magento/Eav/Model/Entity/Attribute/Backend/Datetime.php index 786060ea7b312..1a5f0a7811de3 100644 --- a/app/code/Magento/Eav/Model/Entity/Attribute/Backend/Datetime.php +++ b/app/code/Magento/Eav/Model/Entity/Attribute/Backend/Datetime.php @@ -49,7 +49,7 @@ public function beforeSave($object) throw new \Magento\Framework\Exception\LocalizedException(__('Invalid date')); } - if (is_null($value)) { + if ($value === null) { $value = $object->getData($attributeName); }