Skip to content

Commit

Permalink
Merge pull request opencart#13656 from mhcwebdesign/3.0.x.x
Browse files Browse the repository at this point in the history
More bugfixes as per phpstan level 1
  • Loading branch information
mhcwebdesign authored Feb 9, 2024
2 parents 682864a + 23c275b commit 77ad102
Show file tree
Hide file tree
Showing 27 changed files with 56 additions and 26 deletions.
1 change: 1 addition & 0 deletions phpstan.neon
Original file line number Diff line number Diff line change
Expand Up @@ -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\.#'
2 changes: 1 addition & 1 deletion upload/admin/controller/extension/advertise/google.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

Expand Down
2 changes: 2 additions & 0 deletions upload/admin/controller/extension/module/pilibaba_button.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<?php
class ControllerExtensionModulePilibabaButton extends Controller {
private $error = array();

public function index() {
$this->load->language('extension/module/pilibaba_button');

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<?php
class ControllerExtensionModulePPBraintreeButton extends Controller {
private $error = array();

public function index() {
$this->load->language('extension/module/pp_braintree_button');

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
<?php
class ControllerExtensionPaymentKlarnaInvoice extends Controller {
private $error = array();
private $pclasses = array();

public function index() {
$this->load->language('extension/payment/klarna_invoice');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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']);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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']);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<?php
class ControllerExtensionReportCustomerActivity extends Controller {
private $error = array();

public function index() {
$this->load->language('extension/report/customer_activity');

Expand Down
2 changes: 2 additions & 0 deletions upload/admin/controller/extension/report/customer_order.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<?php
class ControllerExtensionReportCustomerOrder extends Controller {
private $error = array();

public function index() {
$this->load->language('extension/report/customer_order');

Expand Down
2 changes: 2 additions & 0 deletions upload/admin/controller/extension/report/customer_reward.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<?php
class ControllerExtensionReportCustomerReward extends Controller {
private $error = array();

public function index() {
$this->load->language('extension/report/customer_reward');

Expand Down
2 changes: 2 additions & 0 deletions upload/admin/controller/extension/report/customer_search.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<?php
class ControllerExtensionReportCustomerSearch extends Controller {
private $error = array();

public function index() {
$this->load->language('extension/report/customer_search');

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<?php
class ControllerExtensionReportCustomerTransaction extends Controller {
private $error = array();

public function index() {
$this->load->language('extension/report/customer_transaction');

Expand Down
2 changes: 2 additions & 0 deletions upload/admin/controller/extension/report/marketing.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<?php
class ControllerExtensionReportMarketing extends Controller {
private $error = array();

public function index() {
$this->load->language('extension/report/marketing');

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<?php
class ControllerExtensionReportProductPurchased extends Controller {
private $error = array();

public function index() {
$this->load->language('extension/report/product_purchased');

Expand Down
2 changes: 2 additions & 0 deletions upload/admin/controller/extension/report/product_viewed.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<?php
class ControllerExtensionReportProductViewed extends Controller {
private $error = array();

public function index() {
$this->load->language('extension/report/product_viewed');

Expand Down
2 changes: 2 additions & 0 deletions upload/admin/controller/extension/report/sale_coupon.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<?php
class ControllerExtensionReportSaleCoupon extends Controller {
private $error = array();

public function index() {
$this->load->language('extension/report/sale_coupon');

Expand Down
2 changes: 2 additions & 0 deletions upload/admin/controller/extension/report/sale_order.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<?php
class ControllerExtensionReportSaleOrder extends Controller {
private $error = array();

public function index() {
$this->load->language('extension/report/sale_order');

Expand Down
2 changes: 2 additions & 0 deletions upload/admin/controller/extension/report/sale_return.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<?php
class ControllerExtensionReportSaleReturn extends Controller {
private $error = array();

public function index() {
$this->load->language('extension/report/sale_return');

Expand Down
2 changes: 2 additions & 0 deletions upload/admin/controller/extension/report/sale_shipping.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<?php
class ControllerExtensionReportSaleShipping extends Controller {
private $error = array();

public function index() {
$this->load->language('extension/report/sale_shipping');

Expand Down
2 changes: 2 additions & 0 deletions upload/admin/controller/extension/report/sale_tax.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<?php
class ControllerExtensionReportSaleTax extends Controller {
private $error = array();

public function index() {
$this->load->language('extension/report/sale_tax');

Expand Down
2 changes: 1 addition & 1 deletion upload/admin/controller/marketplace/modification.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down
2 changes: 1 addition & 1 deletion upload/admin/model/extension/payment/sagepay_direct.php
Original file line number Diff line number Diff line change
Expand Up @@ -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, '=')) {
Expand Down
2 changes: 1 addition & 1 deletion upload/admin/model/extension/payment/sagepay_server.php
Original file line number Diff line number Diff line change
Expand Up @@ -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, '=')) {
Expand Down
30 changes: 14 additions & 16 deletions upload/catalog/controller/extension/payment/g2apay.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion upload/catalog/controller/mail/order.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion upload/catalog/model/extension/payment/opayo.php
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
4 changes: 2 additions & 2 deletions upload/system/library/googleshopping/googleshopping.php
Original file line number Diff line number Diff line change
Expand Up @@ -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'] : '';
Expand Down Expand Up @@ -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);
}
}
Expand Down

0 comments on commit 77ad102

Please sign in to comment.