Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion .rector.php
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,6 @@
DeadCode\Ternary\TernaryToBooleanOrFalseToBooleanAndRector::class, # todo: TMP
DeadCode\TryCatch\RemoveDeadTryCatchRector::class, # todo: TMP (!?!)
EarlyReturn\Foreach_\ChangeNestedForeachIfsToEarlyContinueRector::class, # todo: TMP
EarlyReturn\If_\ChangeIfElseValueAssignToEarlyReturnRector::class, # todo: TMP
EarlyReturn\If_\ChangeNestedIfsToEarlyReturnRector::class, # todo: TMP
EarlyReturn\If_\ChangeOrIfContinueToMultiContinueRector::class, # todo: TMP
EarlyReturn\Return_\ReturnBinaryOrToEarlyReturnRector::class, # todo: TMP
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -123,25 +123,24 @@ public function getNodeClickListener()
}

if ($this->getUseMassaction()) {
$js = '
return '
function (node, e) {
if (node.ui.toggleCheck) {
node.ui.toggleCheck(true);
}
}
';
} else {
$chooserJsObject = $this->getId();
$js = '
}

$chooserJsObject = $this->getId();

return '
function (node, e) {
' . $chooserJsObject . '.setElementValue("category/" + node.attributes.id);
' . $chooserJsObject . '.setElementLabel(node.text);
' . $chooserJsObject . '.close();
}
';
}

return $js;
}

/**
Expand Down
6 changes: 2 additions & 4 deletions app/code/core/Mage/Adminhtml/Block/Customer/Edit/Tab/View.php
Original file line number Diff line number Diff line change
Expand Up @@ -183,12 +183,10 @@ public function getBillingAddressHtml()
{
$html = '';
if ($address = $this->getCustomer()->getPrimaryBillingAddress()) {
$html = $address->format('html');
} else {
$html = Mage::helper('customer')->__('The customer does not have default billing address.');
return $address->format('html');
}

return $html;
return Mage::helper('customer')->__('The customer does not have default billing address.');
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,10 @@ public function render(Varien_Object $row)
{
$value = $row->getData($this->getColumn()->getIndex());
if (Mage::helper('core/string')->strlen($value) > 30) {
$value = '<span title="' . $this->escapeHtml($value) . '">'
return '<span title="' . $this->escapeHtml($value) . '">'
. $this->escapeHtml(Mage::helper('core/string')->truncate($value, 30)) . '</span>';
} else {
$value = $this->escapeHtml($value);
}

return $value;
return $this->escapeHtml($value);
}
}
6 changes: 2 additions & 4 deletions app/code/core/Mage/Adminhtml/Block/Sales/Order/Create.php
Original file line number Diff line number Diff line change
Expand Up @@ -115,14 +115,12 @@ protected function _getSession()
public function getCancelUrl()
{
if ($this->_getSession()->getOrder()->getId()) {
$url = $this->getUrl('*/sales_order/view', [
return $this->getUrl('*/sales_order/view', [
'order_id' => Mage::getSingleton('adminhtml/session_quote')->getOrder()->getId(),
]);
} else {
$url = $this->getUrl('*/*/cancel');
}

return $url;
return $this->getUrl('*/*/cancel');
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -109,12 +109,10 @@ public function getAddressId()
public function getAddress()
{
if ($this->getIsAsBilling()) {
$address = $this->getCreateOrderModel()->getBillingAddress();
} else {
$address = $this->getCreateOrderModel()->getShippingAddress();
return $this->getCreateOrderModel()->getBillingAddress();
}

return $address;
return $this->getCreateOrderModel()->getShippingAddress();
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,18 +42,16 @@ public function getCreditmemo()
public function getHeaderText()
{
if ($this->getCreditmemo()->getInvoice()) {
$header = Mage::helper('sales')->__(
return Mage::helper('sales')->__(
'New Credit Memo for Invoice #%s',
$this->escapeHtml($this->getCreditmemo()->getInvoice()->getIncrementId()),
);
} else {
$header = Mage::helper('sales')->__(
'New Credit Memo for Order #%s',
$this->escapeHtml($this->getCreditmemo()->getOrder()->getRealOrderId()),
);
}

return $header;
return Mage::helper('sales')->__(
'New Credit Memo for Order #%s',
$this->escapeHtml($this->getCreditmemo()->getOrder()->getRealOrderId()),
);
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -193,12 +193,10 @@ public function getPackages()
{
$packages = $this->getShipment()->getPackages();
if ($packages) {
$packages = unserialize($packages, ['allowed_classes' => false]);
} else {
$packages = [];
return unserialize($packages, ['allowed_classes' => false]);
}

return $packages;
return [];
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,13 +28,11 @@
public function getCollection()
{
if ($this->getShipment()->getId()) {
$collection = Mage::getModel('sales/order_shipment_item')->getCollection()
return Mage::getModel('sales/order_shipment_item')->getCollection()

Check failure on line 31 in app/code/core/Mage/Adminhtml/Block/Sales/Order/Shipment/Packaging/Grid.php

View workflow job for this annotation

GitHub Actions / PHPStan / Analyze

Method Mage_Adminhtml_Block_Sales_Order_Shipment_Packaging_Grid::getCollection() should return array but returns Mage_Sales_Model_Resource_Order_Shipment_Item_Collection.
->setShipmentFilter($this->getShipment()->getId());
} else {
$collection = $this->getShipment()->getAllItems();
}

return $collection;
return $this->getShipment()->getAllItems();
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,12 +86,10 @@ protected function _prepareColumns()
public function decorateState($value, $row, $column, $isExport)
{
if ($value) {
$cell = $value . ' [' . Mage::getSingleton('sales/order_config')->getStateLabel($value) . ']';
} else {
$cell = $value;
return $value . ' [' . Mage::getSingleton('sales/order_config')->getStateLabel($value) . ']';
}

return $cell;
return $value;
}

public function decorateAction($value, $row, $column, $isExport)
Expand Down
18 changes: 8 additions & 10 deletions app/code/core/Mage/Adminhtml/Block/System/Store/Edit.php
Original file line number Diff line number Diff line change
Expand Up @@ -103,17 +103,15 @@ public function _getDeleteUrl($storeType, $backupAvailable = false)
{
$storeType = uc_words($storeType);
if ($backupAvailable) {
$deleteUrl = $this->getUrl('*/*/delete' . $storeType, ['item_id' => Mage::registry('store_data')->getId()]);
} else {
$deleteUrl = $this->getUrl(
'*/*/delete' . $storeType . 'Post',
[
'item_id' => Mage::registry('store_data')->getId(),
'form_key' => Mage::getSingleton('core/session')->getFormKey(),
],
);
return $this->getUrl('*/*/delete' . $storeType, ['item_id' => Mage::registry('store_data')->getId()]);
}

return $deleteUrl;
return $this->getUrl(
'*/*/delete' . $storeType . 'Post',
[
'item_id' => Mage::registry('store_data')->getId(),
'form_key' => Mage::getSingleton('core/session')->getFormKey(),
],
);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -120,13 +120,11 @@ public function renderHeader()
$className = 'sort-arrow-' . $dir;
}

$out = '<a href="#" name="' . $this->getColumn()->getId() . '" title="' . $nDir . '" class="' . $className . '"><span class="sort-title">'
return '<a href="#" name="' . $this->getColumn()->getId() . '" title="' . $nDir . '" class="' . $className . '"><span class="sort-title">'
. $this->escapeHtml($this->getColumn()->getHeader()) . '</span></a>';
} else {
$out = $this->escapeHtml($this->getColumn()->getHeader());
}

return $out;
return $this->escapeHtml($this->getColumn()->getHeader());
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,12 +37,10 @@ protected function _initStatus()
{
$statusCode = $this->getRequest()->getParam('status');
if ($statusCode) {
$status = Mage::getModel('sales/order_status')->load($statusCode);
} else {
$status = false;
return Mage::getModel('sales/order_status')->load($statusCode);
}

return $status;
return false;
}

/**
Expand Down
6 changes: 2 additions & 4 deletions app/code/core/Mage/Api2/Block/Adminhtml/Roles/Tab/Users.php
Original file line number Diff line number Diff line change
Expand Up @@ -209,11 +209,9 @@ public function getUsers($json = false)

/** @var Mage_Core_Helper_Data $helper */
$helper = Mage::helper('core');
$result = $helper->jsonEncode((object) $jsonUsers);
} else {
$result = array_values($users);
return $helper->jsonEncode((object) $jsonUsers);
}

return $result;
return array_values($users);
}
}
6 changes: 2 additions & 4 deletions app/code/core/Mage/Bundle/Model/Product/Price.php
Original file line number Diff line number Diff line change
Expand Up @@ -1047,12 +1047,10 @@ protected function _getMaximalCustomOptionPrice($option)
{
$prices = $this->_getCustomOptionValuesPrices($option);
if ($prices) {
$maximalPrice = ($option->isMultipleType()) ? array_sum($prices) : max($prices);
} else {
$maximalPrice = (float) ($option->getPrice(true));
return ($option->isMultipleType()) ? array_sum($prices) : max($prices);
}

return $maximalPrice;
return (float) ($option->getPrice(true));
}

/**
Expand Down
9 changes: 4 additions & 5 deletions app/code/core/Mage/Captcha/Model/Zend.php
Original file line number Diff line number Diff line change
Expand Up @@ -320,13 +320,12 @@ protected function _getFontPath()
$fonts = $this->_getHelper()->getFonts();

if (isset($fonts[$font])) {
$fontPath = $fonts[$font]['path'];
} else {
$fontData = array_shift($fonts);
$fontPath = $fontData['path'];
return $fonts[$font]['path'];
}

return $fontPath;
$fontData = array_shift($fonts);

return $fontData['path'];
}

/**
Expand Down
10 changes: 4 additions & 6 deletions app/code/core/Mage/Catalog/Block/Navigation.php
Original file line number Diff line number Diff line change
Expand Up @@ -171,14 +171,12 @@ protected function _getCategoryInstance()
public function getCategoryUrl($category)
{
if ($category instanceof Mage_Catalog_Model_Category) {
$url = $category->getUrl();
} else {
$url = $this->_getCategoryInstance()
->setData($category->getData())
->getUrl();
return $category->getUrl();
}

return $url;
return $this->_getCategoryInstance()
->setData($category->getData())
->getUrl();
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -144,12 +144,10 @@ protected function _formatPrice($value, $flag = true)
public function getPrice($price, $includingTax = null)
{
if (!is_null($includingTax)) {
$price = Mage::helper('tax')->getPrice($this->getProduct(), $price, true);
} else {
$price = Mage::helper('tax')->getPrice($this->getProduct(), $price);
return Mage::helper('tax')->getPrice($this->getProduct(), $price, true);
}

return $price;
return Mage::helper('tax')->getPrice($this->getProduct(), $price);
}

/**
Expand Down
26 changes: 12 additions & 14 deletions app/code/core/Mage/Catalog/Block/Product/Widget/Html/Pager.php
Original file line number Diff line number Diff line change
Expand Up @@ -204,23 +204,21 @@ public function getPages()
$finish = 1;

if ($this->getLastPageNum() <= $this->_displayPages) {
$pages = range(1, $this->getLastPageNum());
} else {
$half = ceil($this->_displayPages / 2);
if ($this->getCurrentPage() >= $half && $this->getCurrentPage() <= $this->getLastPageNum() - $half) {
$start = ($this->getCurrentPage() - $half) + 1;
$finish = ($start + $this->_displayPages) - 1;
} elseif ($this->getCurrentPage() < $half) {
$finish = $this->_displayPages;
} elseif ($this->getCurrentPage() > ($this->getLastPageNum() - $half)) {
$finish = $this->getLastPageNum();
$start = $finish - $this->_displayPages + 1;
}
return range(1, $this->getLastPageNum());
}

$pages = range($start, $finish);
$half = ceil($this->_displayPages / 2);
if ($this->getCurrentPage() >= $half && $this->getCurrentPage() <= $this->getLastPageNum() - $half) {
$start = ($this->getCurrentPage() - $half) + 1;
$finish = ($start + $this->_displayPages) - 1;
} elseif ($this->getCurrentPage() < $half) {
$finish = $this->_displayPages;
} elseif ($this->getCurrentPage() > ($this->getLastPageNum() - $half)) {
$finish = $this->getLastPageNum();
$start = $finish - $this->_displayPages + 1;
}

return $pages;
return range($start, $finish);
}

/**
Expand Down
26 changes: 12 additions & 14 deletions app/code/core/Mage/Catalog/Block/Seo/Sitemap/Tree/Pager.php
Original file line number Diff line number Diff line change
Expand Up @@ -168,23 +168,21 @@ public function getPages()
$finish = 1;

if ($this->getLastPageNum() <= $this->_displayPages) {
$pages = range(1, $this->getLastPageNum());
} else {
$half = ceil($this->_displayPages / 2);
if ($this->getCurrentPage() >= $half && $this->getCurrentPage() <= $this->getLastPageNum() - $half) {
$start = ($this->getCurrentPage() - $half) + 1;
$finish = ($start + $this->_displayPages) - 1;
} elseif ($this->getCurrentPage() < $half) {
$finish = $this->_displayPages;
} elseif ($this->getCurrentPage() > ($this->getLastPageNum() - $half)) {
$finish = $this->getLastPageNum();
$start = $finish - $this->_displayPages + 1;
}
return range(1, $this->getLastPageNum());
}

$pages = range($start, $finish);
$half = ceil($this->_displayPages / 2);
if ($this->getCurrentPage() >= $half && $this->getCurrentPage() <= $this->getLastPageNum() - $half) {
$start = ($this->getCurrentPage() - $half) + 1;
$finish = ($start + $this->_displayPages) - 1;
} elseif ($this->getCurrentPage() < $half) {
$finish = $this->_displayPages;
} elseif ($this->getCurrentPage() > ($this->getLastPageNum() - $half)) {
$finish = $this->getLastPageNum();
$start = $finish - $this->_displayPages + 1;
}

return $pages;
return range($start, $finish);
}

/**
Expand Down
8 changes: 3 additions & 5 deletions app/code/core/Mage/Catalog/Model/Category.php
Original file line number Diff line number Diff line change
Expand Up @@ -665,13 +665,11 @@ public function getDesignAttributes()
private function _getAttribute($attributeCode)
{
if (!$this->_useFlatResource) {
$attribute = $this->getResource()->getAttribute($attributeCode);
} else {
$attribute = Mage::getSingleton('catalog/config')
->getAttribute(self::ENTITY, $attributeCode);
return $this->getResource()->getAttribute($attributeCode);
}

return $attribute;
return Mage::getSingleton('catalog/config')
->getAttribute(self::ENTITY, $attributeCode);
}

/**
Expand Down
Loading
Loading