diff --git a/phpstan.neon b/phpstan.neon index aa9effb6625..bd86e81a28c 100644 --- a/phpstan.neon +++ b/phpstan.neon @@ -16,3 +16,4 @@ parameters: ignoreErrors: - '#Class Event constructor invoked with 1 parameter, 4-5 required\.#' - '#Constant [A-Z_]+ not found\.#' + - '#might not be defined\.#' diff --git a/upload/admin/controller/extension/advertise/google.php b/upload/admin/controller/extension/advertise/google.php index ef85a803e7a..1d10ee9620f 100644 --- a/upload/admin/controller/extension/advertise/google.php +++ b/upload/admin/controller/extension/advertise/google.php @@ -268,7 +268,7 @@ public function advertise() { if (!empty($select)) { $this->model_extension_advertise_google->setAdvertisingBySelect($select, $target_ids, $this->store_id); - } else if (!empty($filter_data)) { + } else { $this->model_extension_advertise_google->setAdvertisingByFilter($filter_data, $target_ids, $this->store_id); } diff --git a/upload/admin/controller/extension/module/pilibaba_button.php b/upload/admin/controller/extension/module/pilibaba_button.php index 1948588814b..d0a9028c409 100644 --- a/upload/admin/controller/extension/module/pilibaba_button.php +++ b/upload/admin/controller/extension/module/pilibaba_button.php @@ -1,5 +1,7 @@ load->language('extension/module/pilibaba_button'); diff --git a/upload/admin/controller/extension/module/pp_braintree_button.php b/upload/admin/controller/extension/module/pp_braintree_button.php index bce800a753d..b010ae4cf10 100644 --- a/upload/admin/controller/extension/module/pp_braintree_button.php +++ b/upload/admin/controller/extension/module/pp_braintree_button.php @@ -1,5 +1,7 @@ load->language('extension/module/pp_braintree_button'); diff --git a/upload/admin/controller/extension/payment/klarna_invoice.php b/upload/admin/controller/extension/payment/klarna_invoice.php index 584d9cd84a1..405927ec125 100644 --- a/upload/admin/controller/extension/payment/klarna_invoice.php +++ b/upload/admin/controller/extension/payment/klarna_invoice.php @@ -1,6 +1,7 @@ load->language('extension/payment/klarna_invoice'); diff --git a/upload/admin/controller/extension/payment/securetrading_pp.php b/upload/admin/controller/extension/payment/securetrading_pp.php index c333116d06c..e2895f795d6 100644 --- a/upload/admin/controller/extension/payment/securetrading_pp.php +++ b/upload/admin/controller/extension/payment/securetrading_pp.php @@ -337,7 +337,7 @@ public function release() { $amount = number_format($this->request->post['amount'], 2); - if (isset($this->request->post['order_id']) && $this->request->post['order_id'] != '' && isset($amount) && $amount > 0) { + if (isset($this->request->post['order_id']) && $this->request->post['order_id'] != '' && $amount > 0) { $this->load->model('extension/payment/securetrading_pp'); $securetrading_pp_order = $this->model_extension_payment_securetrading_pp->getOrder($this->request->post['order_id']); diff --git a/upload/admin/controller/extension/payment/securetrading_ws.php b/upload/admin/controller/extension/payment/securetrading_ws.php index 1d8698a7acc..c0c9cd21c67 100644 --- a/upload/admin/controller/extension/payment/securetrading_ws.php +++ b/upload/admin/controller/extension/payment/securetrading_ws.php @@ -411,7 +411,7 @@ public function release() { $amount = number_format($this->request->post['amount'], 2); - if (isset($this->request->post['order_id']) && $this->request->post['order_id'] != '' && isset($amount) && $amount > 0) { + if (isset($this->request->post['order_id']) && $this->request->post['order_id'] != '' && $amount > 0) { $this->load->model('extension/payment/securetrading_ws'); $securetrading_ws_order = $this->model_extension_payment_securetrading_ws->getOrder($this->request->post['order_id']); diff --git a/upload/admin/controller/extension/report/customer_activity.php b/upload/admin/controller/extension/report/customer_activity.php index 270e48a92c7..c2d753a608f 100644 --- a/upload/admin/controller/extension/report/customer_activity.php +++ b/upload/admin/controller/extension/report/customer_activity.php @@ -1,5 +1,7 @@ load->language('extension/report/customer_activity'); diff --git a/upload/admin/controller/extension/report/customer_order.php b/upload/admin/controller/extension/report/customer_order.php index 4751e3c5062..707f04d315c 100644 --- a/upload/admin/controller/extension/report/customer_order.php +++ b/upload/admin/controller/extension/report/customer_order.php @@ -1,5 +1,7 @@ load->language('extension/report/customer_order'); diff --git a/upload/admin/controller/extension/report/customer_reward.php b/upload/admin/controller/extension/report/customer_reward.php index fdf9985269f..ccbdd32e31e 100644 --- a/upload/admin/controller/extension/report/customer_reward.php +++ b/upload/admin/controller/extension/report/customer_reward.php @@ -1,5 +1,7 @@ load->language('extension/report/customer_reward'); diff --git a/upload/admin/controller/extension/report/customer_search.php b/upload/admin/controller/extension/report/customer_search.php index 89f33d81d34..5d7cceee174 100644 --- a/upload/admin/controller/extension/report/customer_search.php +++ b/upload/admin/controller/extension/report/customer_search.php @@ -1,5 +1,7 @@ load->language('extension/report/customer_search'); diff --git a/upload/admin/controller/extension/report/customer_transaction.php b/upload/admin/controller/extension/report/customer_transaction.php index 09b476c00eb..cb6ce81c524 100644 --- a/upload/admin/controller/extension/report/customer_transaction.php +++ b/upload/admin/controller/extension/report/customer_transaction.php @@ -1,5 +1,7 @@ load->language('extension/report/customer_transaction'); diff --git a/upload/admin/controller/extension/report/marketing.php b/upload/admin/controller/extension/report/marketing.php index 0546a17b2d6..360f710784e 100644 --- a/upload/admin/controller/extension/report/marketing.php +++ b/upload/admin/controller/extension/report/marketing.php @@ -1,5 +1,7 @@ load->language('extension/report/marketing'); diff --git a/upload/admin/controller/extension/report/product_purchased.php b/upload/admin/controller/extension/report/product_purchased.php index dd1dca08877..de82263311d 100644 --- a/upload/admin/controller/extension/report/product_purchased.php +++ b/upload/admin/controller/extension/report/product_purchased.php @@ -1,5 +1,7 @@ load->language('extension/report/product_purchased'); diff --git a/upload/admin/controller/extension/report/product_viewed.php b/upload/admin/controller/extension/report/product_viewed.php index 337386f5646..6e2df56c516 100644 --- a/upload/admin/controller/extension/report/product_viewed.php +++ b/upload/admin/controller/extension/report/product_viewed.php @@ -1,5 +1,7 @@ load->language('extension/report/product_viewed'); diff --git a/upload/admin/controller/extension/report/sale_coupon.php b/upload/admin/controller/extension/report/sale_coupon.php index 694877c2338..9eef69b4e2f 100644 --- a/upload/admin/controller/extension/report/sale_coupon.php +++ b/upload/admin/controller/extension/report/sale_coupon.php @@ -1,5 +1,7 @@ load->language('extension/report/sale_coupon'); diff --git a/upload/admin/controller/extension/report/sale_order.php b/upload/admin/controller/extension/report/sale_order.php index 7ec99a78c8e..ad6e01155d6 100644 --- a/upload/admin/controller/extension/report/sale_order.php +++ b/upload/admin/controller/extension/report/sale_order.php @@ -1,5 +1,7 @@ load->language('extension/report/sale_order'); diff --git a/upload/admin/controller/extension/report/sale_return.php b/upload/admin/controller/extension/report/sale_return.php index 32490782455..3b43c0a0882 100644 --- a/upload/admin/controller/extension/report/sale_return.php +++ b/upload/admin/controller/extension/report/sale_return.php @@ -1,5 +1,7 @@ load->language('extension/report/sale_return'); diff --git a/upload/admin/controller/extension/report/sale_shipping.php b/upload/admin/controller/extension/report/sale_shipping.php index e70390a6af9..0ce14c2b96e 100644 --- a/upload/admin/controller/extension/report/sale_shipping.php +++ b/upload/admin/controller/extension/report/sale_shipping.php @@ -1,5 +1,7 @@ load->language('extension/report/sale_shipping'); diff --git a/upload/admin/controller/extension/report/sale_tax.php b/upload/admin/controller/extension/report/sale_tax.php index a1dbe051bcc..b70a22eb53a 100644 --- a/upload/admin/controller/extension/report/sale_tax.php +++ b/upload/admin/controller/extension/report/sale_tax.php @@ -1,5 +1,7 @@ load->language('extension/report/sale_tax'); diff --git a/upload/admin/controller/marketplace/modification.php b/upload/admin/controller/marketplace/modification.php index 5f98622f20e..320c629d7f3 100644 --- a/upload/admin/controller/marketplace/modification.php +++ b/upload/admin/controller/marketplace/modification.php @@ -149,7 +149,7 @@ public function refresh($data = array()) { $recovery = array(); // Set the a recovery of the modification code in case we need to use it if an abort attribute is used. - if (isset($modification)) { + if ($modification) { $recovery = $modification; } diff --git a/upload/admin/model/extension/payment/sagepay_direct.php b/upload/admin/model/extension/payment/sagepay_direct.php index c3da2de9b27..7a5258b1e1e 100644 --- a/upload/admin/model/extension/payment/sagepay_direct.php +++ b/upload/admin/model/extension/payment/sagepay_direct.php @@ -245,7 +245,7 @@ public function sendCurl($url, $payment_data) { $response_info = explode(chr(10), $response); foreach ($response_info as $i => $string) { - if (strpos($string, '=') && isset($i)) { + if (strpos($string, '=')) { $parts = explode('=', $string, 2); $data['RepeatResponseData_' . $i][trim($parts[0])] = trim($parts[1]); } elseif (strpos($string, '=')) { diff --git a/upload/admin/model/extension/payment/sagepay_server.php b/upload/admin/model/extension/payment/sagepay_server.php index e774e179d48..f77c879eab4 100644 --- a/upload/admin/model/extension/payment/sagepay_server.php +++ b/upload/admin/model/extension/payment/sagepay_server.php @@ -246,7 +246,7 @@ public function sendCurl($url, $payment_data) { $response_info = explode(chr(10), $response); foreach ($response_info as $i => $string) { - if (strpos($string, '=') && isset($i)) { + if (strpos($string, '=')) { $parts = explode('=', $string, 2); $data['RepeatResponseData_' . $i][trim($parts[0])] = trim($parts[1]); } elseif (strpos($string, '=')) { diff --git a/upload/catalog/controller/extension/payment/g2apay.php b/upload/catalog/controller/extension/payment/g2apay.php index 65c7f06247d..ba903085745 100644 --- a/upload/catalog/controller/extension/payment/g2apay.php +++ b/upload/catalog/controller/extension/payment/g2apay.php @@ -43,22 +43,20 @@ public function checkout() { $this->load->model('extension/total/' . $result['code']); // We have to put the totals in an array so that they pass by reference. - $this->{'model_extension_total_' . $result['code']}->getTotal($total_data); - - if (isset($order_data['totals'][$i])) { - if (strstr(strtolower($order_data['totals'][$i]['code']), 'total') === false) { - $item = new stdClass(); - $item->sku = $order_data['totals'][$i]['code']; - $item->name = $order_data['totals'][$i]['title']; - $item->amount = number_format($order_data['totals'][$i]['value'], 2); - $item->qty = 1; - $item->id = $order_data['totals'][$i]['code']; - $item->price = $order_data['totals'][$i]['value']; - $item->url = $this->url->link('common/home', '', true); - $items[] = $item; - } - - $i++; + $total_info = $this->{'model_extension_total_' . $result['code']}->getTotal($total_data); + + if ($total_info) { + $item = new \stdClass(); + + $item->sku = $total_info['totals']['code']; + $item->name = $total_info['totals']['title']; + $item->amount = number_format($total_info['totals']['value'], 2); + $item->qty = 1; + $item->id = $total_info['totals']['code']; + $item->price = $total_info['totals']['value']; + $item->url = $this->url->link('common/home', '', true); + + $items[] = $item; } } } diff --git a/upload/catalog/controller/mail/order.php b/upload/catalog/controller/mail/order.php index c7e5a8ea109..b6f8bfcb533 100644 --- a/upload/catalog/controller/mail/order.php +++ b/upload/catalog/controller/mail/order.php @@ -36,7 +36,7 @@ public function index(&$route, &$args) { // If order status is not 0 then send update text email if ($order_info['order_status_id'] && $order_status_id && $notify) { - $this->edit($order_info, $order_status_id, $comment, $notify); + $this->edit($order_info, $order_status_id, $comment); } } } diff --git a/upload/catalog/model/extension/payment/opayo.php b/upload/catalog/model/extension/payment/opayo.php index 0880ed35488..e24fdabe7a6 100644 --- a/upload/catalog/model/extension/payment/opayo.php +++ b/upload/catalog/model/extension/payment/opayo.php @@ -394,7 +394,7 @@ private function getRecurringOrder($order_recurring_id) { private function addRecurring($order_id, $description, $data, $reference) { $order_recurring_id = $this->model_checkout_recurring->addRecurring($order_id, $description, $data); $this->model_checkout_recurring->editReference($order_recurring_id, $reference); - return order_recurring_id; + return $order_recurring_id; } public function editRecurringStatus($order_recurring_id, $status) { diff --git a/upload/system/library/googleshopping/googleshopping.php b/upload/system/library/googleshopping/googleshopping.php index 360e0b2bdc0..be2e3ed26ed 100644 --- a/upload/system/library/googleshopping/googleshopping.php +++ b/upload/system/library/googleshopping/googleshopping.php @@ -366,7 +366,7 @@ protected function getFeedProducts($page, $language_id, $currency) { do { ${'custom_label_' . ($i++)} = trim(strtolower(array_pop($campaigns))); - } while (!empty($campaigns)); + } while ($campaigns); } $mpn = !empty($row['mpn']) ? $row['mpn'] : ''; @@ -664,7 +664,7 @@ public function cron() { $product_reports = $this->getProductReports($chunk); if (!empty($product_reports)) { - $this->updateProductReports($product_reports, $this->store_id); + $this->updateProductReports($product_reports); $report_count += count($product_reports); } }