Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[WIP] phpmd ... #4497

Draft
wants to merge 5 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
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
3 changes: 1 addition & 2 deletions .phpmd.dist.xml
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,12 @@
</description>

<!-- UNUSEDCODE
[ ] UnusedFormalParameter - TMP disabled
[x] UnusedFormalParameter
[ ] UnusedLocalVariable - TMP disabled
[x] UnusedPrivateField
[x] UnusedPrivateMethod
-->
<rule ref="rulesets/unusedcode.xml">
<exclude name="UnusedFormalParameter" />
<exclude name="UnusedLocalVariable" />
</rule>

Expand Down
12 changes: 0 additions & 12 deletions .phpstan.dist.baseline.neon
Original file line number Diff line number Diff line change
Expand Up @@ -3684,12 +3684,6 @@ parameters:
count: 1
path: app/code/core/Mage/Customer/Model/Customer/Api/V2.php

-
message: '#^Parameter \#1 \$customer of method Mage_Customer_Model_Resource_Customer\:\:_saveAddresses\(\) expects Mage_Customer_Model_Customer, Varien_Object given\.$#'
identifier: argument.type
count: 1
path: app/code/core/Mage/Customer/Model/Resource/Customer.php

-
message: '#^Parameter \#2 \$entityId of method Mage_Eav_Model_Entity_Abstract\:\:load\(\) expects int, string given\.$#'
identifier: argument.type
Expand Down Expand Up @@ -6084,12 +6078,6 @@ parameters:
count: 2
path: app/code/core/Mage/Tax/Helper/Data.php

-
message: '#^Method Mage_Tax_Helper_Data\:\:needPriceConversion\(\) should return int\|false but returns bool\.$#'
identifier: return.type
count: 1
path: app/code/core/Mage/Tax/Helper/Data.php

-
message: '#^Parameter \#1 \$shippingAddress of method Mage_Tax_Model_Calculation\:\:getRateRequest\(\) expects Mage_Sales_Model_Quote_Address\|false\|null, Mage_Customer_Model_Address\|null given\.$#'
identifier: argument.type
Expand Down
2 changes: 1 addition & 1 deletion app/Mage.php
Original file line number Diff line number Diff line change
Expand Up @@ -318,7 +318,7 @@ public static function registry($key)
public static function setRoot($appRoot = '')
{
if (self::$_appRoot) {
return ;
return;
}

if ($appRoot === '') {
Expand Down
2 changes: 2 additions & 0 deletions app/code/core/Mage/Admin/Model/Acl/Assert/Ip.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ class Mage_Admin_Model_Acl_Assert_Ip implements Zend_Acl_Assert_Interface
*
* @param string|null $privilege
* @return bool|null
* @SuppressWarnings("PHPMD.UnusedFormalParameter")
*/
public function assert(
Mage_Admin_Model_Acl $acl,
Expand All @@ -39,6 +40,7 @@ public function assert(

/**
* @param string|false $ip
* @SuppressWarnings("PHPMD.UnusedFormalParameter")
*/
protected function _isCleanIP($ip)
{
Expand Down
2 changes: 2 additions & 0 deletions app/code/core/Mage/Admin/Model/Acl/Assert/Time.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ class Mage_Admin_Model_Acl_Assert_Time implements Zend_Acl_Assert_Interface
*
* @param string|null $privilege
* @return bool|null
* @SuppressWarnings("PHPMD.UnusedFormalParameter")
*/
public function assert(
Mage_Admin_Model_Acl $acl,
Expand All @@ -39,6 +40,7 @@ public function assert(

/**
* @param int $time
* @SuppressWarnings("PHPMD.UnusedFormalParameter")
*/
protected function _isCleanTime($time)
{
Expand Down
2 changes: 2 additions & 0 deletions app/code/core/Mage/Admin/Model/Observer.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ class Mage_Admin_Model_Observer
* Handler for controller_action_predispatch event
*
* @param Varien_Event_Observer $observer
* @SuppressWarnings("PHPMD.UnusedFormalParameter")
*/
public function actionPreDispatchAdmin($observer)
{
Expand Down Expand Up @@ -105,6 +106,7 @@ public function actionPreDispatchAdmin($observer)
*
* @deprecated after 1.4.0.1, logic moved to admin session
* @param Varien_Event_Observer $event
* @SuppressWarnings("PHPMD.UnusedFormalParameter")
*/
public function actionPostDispatchAdmin($event) {}

Expand Down
1 change: 1 addition & 0 deletions app/code/core/Mage/AdminNotification/Helper/Data.php
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ public function getUnreadNoticeCount($severity)
* @param bool $withExt
* @return string
* @deprecated v19.4.16
* @SuppressWarnings("PHPMD.UnusedFormalParameter")
*/
public function getPopupObjectUrl($withExt = false)
{
Expand Down
2 changes: 2 additions & 0 deletions app/code/core/Mage/AdminNotification/Model/Observer.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ class Mage_AdminNotification_Model_Observer
{
/**
* Predispath admin action controller
*
* @SuppressWarnings("PHPMD.UnusedFormalParameter")
*/
public function preDispatch(Varien_Event_Observer $observer)
{
Expand Down
3 changes: 3 additions & 0 deletions app/code/core/Mage/AdminNotification/Model/Resource/Inbox.php
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ public function loadLatestNotice(Mage_AdminNotification_Model_Inbox $object)
* Get notifications grouped by severity
*
* @return array
* @SuppressWarnings("PHPMD.UnusedFormalParameter")
*/
public function getNoticeStatus(Mage_AdminNotification_Model_Inbox $object)
{
Expand All @@ -76,6 +77,8 @@ public function getNoticeStatus(Mage_AdminNotification_Model_Inbox $object)

/**
* Save notifications (if not exists)
*
* @SuppressWarnings("PHPMD.UnusedFormalParameter")
*/
public function parse(Mage_AdminNotification_Model_Inbox $object, array $data)
{
Expand Down
2 changes: 2 additions & 0 deletions app/code/core/Mage/Adminhtml/Block/Cache/Grid.php
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,7 @@ protected function _prepareColumns()
* Decorate status column values
*
* @return string
* @SuppressWarnings("PHPMD.UnusedFormalParameter")
*/
public function decorateStatus($value, $row, $column, $isExport)
{
Expand All @@ -122,6 +123,7 @@ public function decorateStatus($value, $row, $column, $isExport)
* Get row edit url
*
* @return string
* @SuppressWarnings("PHPMD.UnusedFormalParameter")
*/
public function getRowUrl($row)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,7 @@ public function setPreconfiguredValue()
*
* @param Mage_Catalog_Model_Product $product
* @return bool
* @SuppressWarnings("PHPMD.UnusedFormalParameter")
*/
public function getCanShowProductPrice($product)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@ public function __construct()
/**
* Get option html block
*
*
* @return string
*/
public function getOptionHtml(Mage_Catalog_Model_Product_Option $option)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,9 @@ protected function _getHeaderHtml($element)
return $html . '<tbody>';
}

/**
* @SuppressWarnings("PHPMD.UnusedFormalParameter")
*/
protected function _getFooterHtml($element)
{
return '</tbody></table></fieldset>';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,6 @@ public function getDataObject()
/**
* Retrieve attribute field name
*
*
* @param Mage_Catalog_Model_Resource_Eav_Attribute $attribute
* @return string
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ protected function _getTaxObservingCode($attribute)
/**
* @param null $index deprecated
* @return string|null
* @SuppressWarnings("PHPMD.UnusedFormalParameter")
*/
public function getEscapedValue($index = null)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -315,6 +315,7 @@ protected function _addOrderStatusFilter($collection, $filterData)
* @param Mage_Sales_Model_Resource_Report_Collection_Abstract $collection
* @param Varien_Object $filterData
* @return $this
* @SuppressWarnings("PHPMD.UnusedFormalParameter")
*/
protected function _addCustomFilter($collection, $filterData)
{
Expand Down
3 changes: 3 additions & 0 deletions app/code/core/Mage/Adminhtml/Block/Review/Rating/Detailed.php
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,9 @@ public function setIndependentMode()
return $this;
}

/**
* @SuppressWarnings("PHPMD.UnusedFormalParameter")
*/
public function isSelected($option, $rating)
{
if ($this->getIsIndependentMode()) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,7 @@ protected function _getAdditionalFormElementRenderers()
* Add additional data to form element
*
* @return Mage_Adminhtml_Block_Sales_Order_Create_Form_Abstract
* @SuppressWarnings("PHPMD.UnusedFormalParameter")
*/
protected function _addAdditionalFormElementData(Varien_Data_Form_Element_Abstract $element)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,6 @@ public function _prepareForm()
* Prepare form fieldset
* All fields are hidden
*
*
* @return $this
*/
protected function _prepareHiddenFields(Varien_Data_Form_Element_Fieldset $fieldset)
Expand Down Expand Up @@ -204,7 +203,6 @@ protected function _prepareHiddenFields(Varien_Data_Form_Element_Fieldset $field
* Prepare form fieldset
* All fields are visible
*
*
* @return $this
*/
protected function _prepareVisibleFields(Varien_Data_Form_Element_Fieldset $fieldset)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,7 @@ protected function _prepareColumns()
* Decorate status column values
*
* @return string
* @SuppressWarnings("PHPMD.UnusedFormalParameter")
*/
public function decorateState($value, $row, $column, $isExport)
{
Expand All @@ -101,6 +102,9 @@ public function decorateState($value, $row, $column, $isExport)
return $cell;
}

/**
* @SuppressWarnings("PHPMD.UnusedFormalParameter")
*/
public function decorateAction($value, $row, $column, $isExport)
{
$cell = '';
Expand Down
1 change: 0 additions & 1 deletion app/code/core/Mage/Adminhtml/Block/System/Config/Form.php
Original file line number Diff line number Diff line change
Expand Up @@ -536,7 +536,6 @@ protected function _prepareFieldTooltip($element, $helper)
/**
* Append dependence block at then end of form block
*
*
*/
protected function _afterToHtml($html)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,8 @@ protected function _getElementHtml(Varien_Data_Form_Element_Abstract $element)

/**
* Prepare existing row data object
*
* @SuppressWarnings("PHPMD.UnusedFormalParameter")
*/
protected function _prepareArrayRow(Varien_Object $row)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,7 @@ protected function _getFooterHtml($element)
* @param Varien_Data_Form_Element_Abstract $element
* @param bool $tooltipsExist Init tooltips observer or not
* @return string
* @SuppressWarnings("PHPMD.UnusedFormalParameter")
*/
protected function _getExtraJs($element, $tooltipsExist = false)
{
Expand Down
1 change: 0 additions & 1 deletion app/code/core/Mage/Adminhtml/Block/Widget/Container.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@ class Mage_Adminhtml_Block_Widget_Container extends Mage_Adminhtml_Block_Templat
/**
* Array of buttons
*
*
* @var array
*/
protected $_buttons = [
Expand Down
1 change: 1 addition & 0 deletions app/code/core/Mage/Adminhtml/Block/Widget/Form.php
Original file line number Diff line number Diff line change
Expand Up @@ -243,6 +243,7 @@ protected function _getAdditionalElementTypes()
/**
* @param Varien_Data_Form_Element_Abstract $element
* @return string
* @SuppressWarnings("PHPMD.UnusedFormalParameter")
*/
protected function _getAdditionalElementHtml($element)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,6 @@ public function getDataAsJSON()
* Get serialize data to manage it (called specified method, that return data to manage)
* Also use reload param name for saving grid checked boxes states
*
*
* @param Mage_Adminhtml_Block_Widget_Grid | string $grid grid object or grid block name
* @param string $callback block method to retrieve data to serialize
* @param string $hiddenInputName hidden input name where serialized data will be store
Expand Down
3 changes: 3 additions & 0 deletions app/code/core/Mage/Adminhtml/Controller/Action.php
Original file line number Diff line number Diff line change
Expand Up @@ -296,6 +296,9 @@ public function loadLayout($ids = null, $generateBlocks = true, $generateXml = t
return $this;
}

/**
* @SuppressWarnings("PHPMD.UnusedFormalParameter")
*/
public function norouteAction($coreRoute = null)
{
$this->getResponse()->setHeader('HTTP/1.1', '404 Not Found');
Expand Down
1 change: 1 addition & 0 deletions app/code/core/Mage/Adminhtml/Helper/Data.php
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ public function getPageHelpUrl($url = null, $suffix = null)
* @param null|string $suffix
* @return $this
* @deprecated
* @SuppressWarnings("PHPMD.UnusedFormalParameter")
*/
public function setPageHelpUrl($url = null, $suffix = null)
{
Expand Down
2 changes: 2 additions & 0 deletions app/code/core/Mage/Adminhtml/Model/Config.php
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ class Mage_Adminhtml_Model_Config extends Varien_Simplexml_Config
* @param string $websiteCode
* @param string $storeCode
* @return Varien_Simplexml_Element
* @SuppressWarnings("PHPMD.UnusedFormalParameter")
*/
public function getSections($sectionCode = null, $websiteCode = null, $storeCode = null)
{
Expand Down Expand Up @@ -156,6 +157,7 @@ public function getSection($sectionCode = null, $websiteCode = null, $storeCode
* @param string $storeCode
* @param bool $isField
* @return bool
* @SuppressWarnings("PHPMD.UnusedFormalParameter")
*/
public function hasChildren($node, $websiteCode = null, $storeCode = null, $isField = false)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ class Mage_Adminhtml_Model_System_Config_Backend_Admin_Observer
*
* @param Varien_Event_Observer $observer
* @SuppressWarnings("PHPMD.ExitExpression")
* @SuppressWarnings("PHPMD.UnusedFormalParameter")
*/
public function afterCustomUrlChanged($observer)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,9 @@ class Mage_Adminhtml_Model_System_Config_Source_Currency
{
protected $_options;

/**
* @SuppressWarnings("PHPMD.UnusedFormalParameter")
*/
public function toOptionArray($isMultiselect)
{
if (!$this->_options) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,9 @@ class Mage_Adminhtml_Model_System_Config_Source_Currency_Service
{
protected $_options;

/**
* @SuppressWarnings("PHPMD.UnusedFormalParameter")
*/
public function toOptionArray($isMultiselect)
{
if (!$this->_options) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ public function markAsReadAction()
if (!$model->getId()) {
$session->addError(Mage::helper('adminnotification')->__('Unable to proceed. Please, try again.'));
$this->_redirect('*/*/');
return ;
return;
}

try {
Expand Down Expand Up @@ -99,7 +99,7 @@ public function removeAction()

if (!$model->getId()) {
$this->_redirect('*/*/');
return ;
return;
}

try {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@ protected function _initInvoice($order)
*
* @return Mage_Sales_Model_Order_Creditmemo|false
* @throws Mage_Core_Exception
* @SuppressWarnings("PHPMD.UnusedFormalParameter")
*/
protected function _initCreditmemo($update = false)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ protected function _getItemQtys()
*
* @return Mage_Sales_Model_Order_Invoice|false
* @throws Mage_Core_Exception
* @SuppressWarnings("PHPMD.UnusedFormalParameter")
*/
protected function _initInvoice($update = false)
{
Expand Down
Loading
Loading