diff --git a/app/code/Magento/Sales/Model/AdminOrder/Create.php b/app/code/Magento/Sales/Model/AdminOrder/Create.php index 69f4d19e4dd630a45242df8e507de199525602d5..8ea09e6fb3d42de9e8ffc9b6c2f061200d37e2a3 100644 --- a/app/code/Magento/Sales/Model/AdminOrder/Create.php +++ b/app/code/Magento/Sales/Model/AdminOrder/Create.php @@ -681,7 +681,7 @@ class Create extends \Magento\Framework\DataObject implements \Magento\Checkout\ */ public function getCustomerWishlist($cacheReload = false) { - if (!is_null($this->_wishlist) && !$cacheReload) { + if (($this->_wishlist !== null) && !$cacheReload) { return $this->_wishlist; } @@ -708,7 +708,7 @@ class Create extends \Magento\Framework\DataObject implements \Magento\Checkout\ */ public function getCustomerCart() { - if (!is_null($this->_cart)) { + if ($this->_cart !== null) { return $this->_cart; } @@ -736,7 +736,7 @@ class Create extends \Magento\Framework\DataObject implements \Magento\Checkout\ */ public function getCustomerCompareList() { - if (!is_null($this->_compareList)) { + if ($this->_compareList !== null) { return $this->_compareList; } $customerId = (int)$this->getSession()->getCustomerId(); @@ -807,7 +807,7 @@ class Create extends \Magento\Framework\DataObject implements \Magento\Checkout\ break; case 'cart': $cart = $this->getCustomerCart(); - if ($cart && is_null($item->getOptionByCode('additional_options'))) { + if ($cart && ($item->getOptionByCode('additional_options') === null)) { //options and info buy request $product = $this->_objectManager->create( \Magento\Catalog\Model\Product::class @@ -1727,7 +1727,7 @@ class Create extends \Magento\Framework\DataObject implements \Magento\Checkout\ } $data = $form->restoreData($data); foreach ($data as $key => $value) { - if (!is_null($value)) { + if ($value !== null) { unset($data[$key]); } } @@ -1851,12 +1851,12 @@ class Create extends \Magento\Framework\DataObject implements \Magento\Checkout\ switch ($addressType) { case \Magento\Quote\Model\Quote\Address::ADDRESS_TYPE_BILLING: - if (is_null($customer->getDefaultBilling())) { + if ($customer->getDefaultBilling() === null) { $customerAddress->setIsDefaultBilling(true); } break; case \Magento\Quote\Model\Quote\Address::ADDRESS_TYPE_SHIPPING: - if (is_null($customer->getDefaultShipping())) { + if ($customer->getDefaultShipping() === null) { $customerAddress->setIsDefaultShipping(true); } break; @@ -1948,7 +1948,7 @@ class Create extends \Magento\Framework\DataObject implements \Magento\Checkout\ protected function _validate() { $customerId = $this->getSession()->getCustomerId(); - if (is_null($customerId)) { + if ($customerId === null) { throw new \Magento\Framework\Exception\LocalizedException(__('Please select a customer')); } diff --git a/app/code/Magento/Sales/Model/Order/Creditmemo.php b/app/code/Magento/Sales/Model/Order/Creditmemo.php index 64b903fe5b5c1eacca4eb2b0241f71102f523176..0d0e0d23496b75ba8781c500d36463c0aff59229 100644 --- a/app/code/Magento/Sales/Model/Order/Creditmemo.php +++ b/app/code/Magento/Sales/Model/Order/Creditmemo.php @@ -431,7 +431,7 @@ class Creditmemo extends AbstractModel implements EntityInterface, CreditmemoInt /** * If we not retrieve negative answer from payment yet */ - if (is_null($canVoid)) { + if ($canVoid === null) { $canVoid = $this->getOrder()->getPayment()->canVoid(); if ($canVoid === false) { $this->setCanVoidFlag(false); @@ -451,7 +451,7 @@ class Creditmemo extends AbstractModel implements EntityInterface, CreditmemoInt */ public static function getStates() { - if (is_null(static::$_states)) { + if (static::$_states === null) { static::$_states = [ self::STATE_OPEN => __('Pending'), self::STATE_REFUNDED => __('Refunded'), @@ -469,11 +469,11 @@ class Creditmemo extends AbstractModel implements EntityInterface, CreditmemoInt */ public function getStateName($stateId = null) { - if (is_null($stateId)) { + if ($stateId === null) { $stateId = $this->getState(); } - if (is_null(static::$_states)) { + if (static::$_states === null) { static::getStates(); } if (isset(static::$_states[$stateId])) { diff --git a/app/code/Magento/Sales/Model/Order/Payment/Transaction.php b/app/code/Magento/Sales/Model/Order/Payment/Transaction.php index b9b7a142095d9de0750949dbfa68d5914c3a4d1b..7540ee1902b572e72fab886c4db2e9292126bdac 100644 --- a/app/code/Magento/Sales/Model/Order/Payment/Transaction.php +++ b/app/code/Magento/Sales/Model/Order/Payment/Transaction.php @@ -733,7 +733,7 @@ class Transaction extends AbstractModel implements TransactionInterface */ public function getOrderWebsiteId() { - if (is_null($this->_orderWebsiteId)) { + if ($this->_orderWebsiteId === null) { $this->_orderWebsiteId = (int)$this->getResource()->getOrderWebsiteId($this->getOrderId()); } return $this->_orderWebsiteId; diff --git a/app/code/Magento/Sales/Model/Order/Pdf/AbstractPdf.php b/app/code/Magento/Sales/Model/Order/Pdf/AbstractPdf.php index 1a25ff7bfdb80ffd079669adcdb3ea421e9ee6b1..1b80d08e68cda046cbdc887e76a45649f57d4408 100644 --- a/app/code/Magento/Sales/Model/Order/Pdf/AbstractPdf.php +++ b/app/code/Magento/Sales/Model/Order/Pdf/AbstractPdf.php @@ -804,7 +804,7 @@ abstract class AbstractPdf extends \Magento\Framework\DataObject throw new \Magento\Framework\Exception\LocalizedException(__('We found an invalid renderer model.')); } - if (is_null($this->_renderers[$type]['renderer'])) { + if ($this->_renderers[$type]['renderer'] === null) { $this->_renderers[$type]['renderer'] = $this->_pdfItemsFactory->get($this->_renderers[$type]['model']); } diff --git a/app/code/Magento/Sales/Model/ResourceModel/Report/Bestsellers/Collection.php b/app/code/Magento/Sales/Model/ResourceModel/Report/Bestsellers/Collection.php index 7f0aaff02d1040403b4cf384fc75b46694f54860..fa4fccb1b17e768ed0906d4f04345bc50e4d78c9 100644 --- a/app/code/Magento/Sales/Model/ResourceModel/Report/Bestsellers/Collection.php +++ b/app/code/Magento/Sales/Model/ResourceModel/Report/Bestsellers/Collection.php @@ -255,8 +255,8 @@ class Collection extends \Magento\Sales\Model\ResourceModel\Report\Collection\Ab $selectUnions = []; // apply date boundaries (before calling $this->_applyDateRangeFilter()) - $periodFrom = !is_null($this->_from) ? new \DateTime($this->_from) : null; - $periodTo = !is_null($this->_to) ? new \DateTime($this->_to) : null; + $periodFrom = ($this->_from !== null) ? new \DateTime($this->_from) : null; + $periodTo = ($this->_to !== null) ? new \DateTime($this->_to) : null; if ('year' == $this->_period) { if ($periodFrom) { // not the first day of the year