Skip to content

Commit

Permalink
Updated phpstan to v2.1 (#4430)
Browse files Browse the repository at this point in the history
* Updated phpstan to v2

* rector

* update docs

- see phpstan/phpdoc-parser#256

* phpstan/phpmd

* updated to phpstan v2.1
  • Loading branch information
sreichel authored Jan 5, 2025
1 parent d9e63b6 commit db20784
Show file tree
Hide file tree
Showing 127 changed files with 3,780 additions and 2,012 deletions.
5,252 changes: 3,510 additions & 1,742 deletions .phpstan.dist.baseline.neon

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
class Mage_Adminhtml_Block_Customer_Online_Grid_Renderer_Ip extends Mage_Adminhtml_Block_Widget_Grid_Column_Renderer_Abstract
{
/**
* @SuppressWarnings(PHPMD.ErrorControlOperator)
* @SuppressWarnings("PHPMD.ErrorControlOperator")
*/
public function render(Varien_Object $row)
{
Expand Down
2 changes: 1 addition & 1 deletion app/code/core/Mage/Adminhtml/Block/Report/Wishlist.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
*
* @category Mage
* @package Mage_Adminhtml
* @SuppressWarnings(PHPMD.CamelCasePropertyName)
* @SuppressWarnings("PHPMD.CamelCasePropertyName")
*/
class Mage_Adminhtml_Block_Report_Wishlist extends Mage_Adminhtml_Block_Template
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ class Mage_Adminhtml_Block_System_Email_Template_Grid_Renderer_Type extends Mage

/**
* @return string
* @SuppressWarnings(PHPMD.CamelCaseVariableName)
* @SuppressWarnings("PHPMD.CamelCaseVariableName")
*/
public function render(Varien_Object $row)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ class Mage_Adminhtml_Block_Widget_Grid_Column_Renderer_Ip extends Mage_Adminhtml
* Render the grid cell value
*
* @return string
* @SuppressWarnings(PHPMD.ErrorControlOperator)
* @SuppressWarnings("PHPMD.ErrorControlOperator")
*/
public function render(Varien_Object $row)
{
Expand Down
4 changes: 2 additions & 2 deletions app/code/core/Mage/Adminhtml/Controller/Action.php
Original file line number Diff line number Diff line change
Expand Up @@ -330,8 +330,8 @@ public function setUsedModuleName($moduleName)
* Translate a phrase
*
* @return string
* @SuppressWarnings(PHPMD.CamelCaseMethodName)
* @SuppressWarnings(PHPMD.ShortMethodName)
* @SuppressWarnings("PHPMD.CamelCaseMethodName")
* @SuppressWarnings("PHPMD.ShortMethodName")
*/
public function __()
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ class Mage_Adminhtml_Model_Customer_Renderer_Region implements Varien_Data_Form_

/**
* @return string
* @SuppressWarnings(PHPMD.CamelCaseVariableName)
* @SuppressWarnings("PHPMD.CamelCaseVariableName")
*/
public function render(Varien_Data_Form_Element_Abstract $element)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ class Mage_Adminhtml_Model_System_Config_Backend_Admin_Observer
* Log out user and redirect him to new admin custom url
*
* @param Varien_Event_Observer $observer
* @SuppressWarnings(PHPMD.ExitExpression)
* @SuppressWarnings("PHPMD.ExitExpression")
*/
public function afterCustomUrlChanged($observer)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ class Mage_Adminhtml_Model_System_Config_Backend_File extends Mage_Core_Model_Co
* Save uploaded file before saving config value
*
* @return $this
* @SuppressWarnings(PHPMD.Superglobals)
* @SuppressWarnings("PHPMD.Superglobals")
*/
protected function _beforeSave()
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ class Mage_Adminhtml_AjaxController extends Mage_Adminhtml_Controller_Action
/**
* Ajax action for inline translation
*
* @SuppressWarnings(PHPMD.ExitExpression)
* @SuppressWarnings("PHPMD.ExitExpression")
*/
public function translateAction()
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -784,7 +784,7 @@ public function massAssignGroupAction()
}

/**
* @SuppressWarnings(PHPMD.ExitExpression)
* @SuppressWarnings("PHPMD.ExitExpression")
*/
public function viewfileAction()
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ protected function _getSyncFlag()
/**
* Synchronize action between storages
*
* @SuppressWarnings(PHPMD.Superglobals)
* @SuppressWarnings("PHPMD.Superglobals")
*/
public function synchronizeAction()
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ public function editAction()
/**
* Save configuration
*
* @SuppressWarnings(PHPMD.Superglobals)
* @SuppressWarnings("PHPMD.Superglobals")
*/
public function saveAction()
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -248,7 +248,7 @@ public function importExportAction()
/**
* import action from import/export tax
*
* @SuppressWarnings(PHPMD.Superglobals)
* @SuppressWarnings("PHPMD.Superglobals")
*/
public function importPostAction()
{
Expand All @@ -269,7 +269,7 @@ public function importPostAction()
}

/**
* @SuppressWarnings(PHPMD.Superglobals)
* @SuppressWarnings("PHPMD.Superglobals")
*/
protected function _importRates()
{
Expand Down
2 changes: 1 addition & 1 deletion app/code/core/Mage/Api/Model/Server/Adapter/Soap.php
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ public function run()
*
* @param int $code
* @param string $message
* @SuppressWarnings(PHPMD.ExitExpression)
* @SuppressWarnings("PHPMD.ExitExpression")
*/
public function fault($code, $message)
{
Expand Down
2 changes: 1 addition & 1 deletion app/code/core/Mage/Api/Model/Server/Handler/Abstract.php
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ protected function _startSession($sessionId = null)
*
* @param stdClass|string|null $sessionId
* @return $this
* @SuppressWarnings(PHPMD.Superglobals)
* @SuppressWarnings("PHPMD.Superglobals")
*/
protected function _instaLogin(&$sessionId)
{
Expand Down
2 changes: 1 addition & 1 deletion app/code/core/Mage/Api2/Model/Acl/Filter.php
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ public function getAttributesToInclude()
* Filter data for write operations
*
* @return array
* @SuppressWarnings(PHPMD.ShortMethodName)
* @SuppressWarnings("PHPMD.ShortMethodName")
*/
public function in(array $requestData)
{
Expand Down
2 changes: 1 addition & 1 deletion app/code/core/Mage/Catalog/Helper/Product/View.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
*
* @category Mage
* @package Mage_Catalog
* @SuppressWarnings(PHPMD.CamelCasePropertyName)
* @SuppressWarnings("PHPMD.CamelCasePropertyName")
*/
class Mage_Catalog_Helper_Product_View extends Mage_Core_Helper_Abstract
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ class Mage_Catalog_Model_Api2_Product_Image_Rest_Admin_V1 extends Mage_Catalog_M
*
* @throws Mage_Api2_Exception
* @return string|void
* @SuppressWarnings(PHPMD.ErrorControlOperator)
* @SuppressWarnings("PHPMD.ErrorControlOperator")
*/
protected function _create(array $data)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -343,7 +343,7 @@ protected function _filterStockData(&$stockData)
} else {
$nonManageStockFields = ['manage_stock', 'use_config_manage_stock', 'min_sale_qty',
'use_config_min_sale_qty', 'max_sale_qty', 'use_config_max_sale_qty'];
foreach ($stockData as $field => $value) {
foreach (array_keys($stockData) as $field) {
if (!in_array($field, $nonManageStockFields)) {
unset($stockData[$field]);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ public function getAllowedExtensions(): array
* Save uploaded file and set its name to category attribute
* @param Varien_Object $object
* @return $this
* @SuppressWarnings(PHPMD.Superglobals)
* @SuppressWarnings("PHPMD.Superglobals")
*/
public function afterSave($object)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ public function info($productId, $file, $store = null, $identifierType = null)
* @return string
* @throws Mage_Api_Exception
*
* @SuppressWarnings(PHPMD.ErrorControlOperator)
* @SuppressWarnings("PHPMD.ErrorControlOperator")
*/
public function create($productId, $data, $store = null, $identifierType = null)
{
Expand Down Expand Up @@ -200,7 +200,7 @@ public function create($productId, $data, $store = null, $identifierType = null)
* @return bool
* @throws Mage_Api_Exception
*
* @SuppressWarnings(PHPMD.ErrorControlOperator)
* @SuppressWarnings("PHPMD.ErrorControlOperator")
*/
public function update($productId, $file, $data, $store = null, $identifierType = null)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ public function prepareTierPrices($product, $tierPrices = null)
}

if (!isset($tierPrice->website) || $tierPrice->website == 'all') {
$tierPrice->website = 0; // @phpstan-ignore-line
$tierPrice->website = 0;
} else {
try {
$tierPrice->website = Mage::app()->getWebsite($tierPrice->website)->getId();
Expand All @@ -60,7 +60,7 @@ public function prepareTierPrices($product, $tierPrices = null)
}

if (!isset($tierPrice->customer_group_id)) {
$tierPrice->customer_group_id = 'all'; // @phpstan-ignore-line
$tierPrice->customer_group_id = 'all';
}

if ($tierPrice->customer_group_id == 'all') {
Expand Down
6 changes: 3 additions & 3 deletions app/code/core/Mage/Catalog/Model/Product/Option/Type/File.php
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ public function validateUserValue($values)
*
* @return $this
* @throws Mage_Core_Exception|Zend_File_Transfer_Exception
* @SuppressWarnings(PHPMD.Superglobals)
* @SuppressWarnings("PHPMD.Superglobals")
*/
protected function _validateUploadedFile()
{
Expand Down Expand Up @@ -614,7 +614,7 @@ public function prepareOptionValueForRequest($optionValue)
*
* @return $this
*
* @SuppressWarnings(PHPMD.ErrorControlOperator)
* @SuppressWarnings("PHPMD.ErrorControlOperator")
*/
public function copyQuoteToOrder()
{
Expand Down Expand Up @@ -797,7 +797,7 @@ protected function _getUploadMaxFilesize()
* @param string $option php.ini Var name
* @return int Setting value
*
* @SuppressWarnings(PHPMD.ErrorControlOperator)
* @SuppressWarnings("PHPMD.ErrorControlOperator")
*/
protected function _getBytesIniValue($option)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ public function getAllowedExtensions(): array
* Save uploaded file and set its name to product attribute
* @param Varien_Object $object
* @return $this
* @SuppressWarnings(PHPMD.Superglobals)
* @SuppressWarnings("PHPMD.Superglobals")
*/
public function afterSave($object)
{
Expand Down
4 changes: 2 additions & 2 deletions app/code/core/Mage/Catalog/controllers/ProductController.php
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ protected function _applyCustomDesignSettings($object, $update)
/**
* Product view action
*
* @SuppressWarnings(PHPMD.Superglobals)
* @SuppressWarnings("PHPMD.Superglobals")
*/
public function viewAction()
{
Expand Down Expand Up @@ -141,7 +141,7 @@ public function viewAction()
/**
* View product gallery action
*
* @SuppressWarnings(PHPMD.Superglobals)
* @SuppressWarnings("PHPMD.Superglobals")
*/
public function galleryAction()
{
Expand Down
2 changes: 1 addition & 1 deletion app/code/core/Mage/Cms/Controller/Router.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ public function initControllerRouters($observer)
* Validate and Match Cms Page and modify request
*
* @return bool
* @SuppressWarnings(PHPMD.ExitExpression)
* @SuppressWarnings("PHPMD.ExitExpression")
*/
public function match(Zend_Controller_Request_Http $request)
{
Expand Down
2 changes: 1 addition & 1 deletion app/code/core/Mage/Cms/Model/Wysiwyg/Images/Storage.php
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ public function getDirsCollection($path)
* @param string $type Type of storage, e.g. image, media etc.
* @return Varien_Data_Collection_Filesystem
*
* @SuppressWarnings(PHPMD.ErrorControlOperator)
* @SuppressWarnings("PHPMD.ErrorControlOperator")
*/
public function getFilesCollection($path, $type = null)
{
Expand Down
2 changes: 1 addition & 1 deletion app/code/core/Mage/ConfigurableSwatches/Helper/Data.php
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ public function isEnabled()
*
* @param string $str
* @return string
* @SuppressWarnings(PHPMD.ErrorControlOperator)
* @SuppressWarnings("PHPMD.ErrorControlOperator")
*/
public function getHyphenatedString($str)
{
Expand Down
4 changes: 2 additions & 2 deletions app/code/core/Mage/Core/Block/Abstract.php
Original file line number Diff line number Diff line change
Expand Up @@ -1171,8 +1171,8 @@ public function getModuleName()
*
* @return string
*
* @SuppressWarnings(PHPMD.CamelCaseMethodName)
* @SuppressWarnings(PHPMD.ShortMethodName)
* @SuppressWarnings("PHPMD.CamelCaseMethodName")
* @SuppressWarnings("PHPMD.ShortMethodName")
*/
public function __()
{
Expand Down
2 changes: 1 addition & 1 deletion app/code/core/Mage/Core/Block/Profiler.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ class Mage_Core_Block_Profiler extends Mage_Core_Block_Abstract
{
/**
* @return string
* @SuppressWarnings(PHPMD.DevelopmentCodeFragment)
* @SuppressWarnings("PHPMD.DevelopmentCodeFragment")
*/
protected function _toHtml()
{
Expand Down
2 changes: 1 addition & 1 deletion app/code/core/Mage/Core/Block/Text/Tag/Css/Admin.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
class Mage_Core_Block_Text_Tag_Css_Admin extends Mage_Core_Block_Text_Tag_Css
{
/**
* @SuppressWarnings(PHPMD.Superglobals)
* @SuppressWarnings("PHPMD.Superglobals")
*/
protected function _construct()
{
Expand Down
2 changes: 1 addition & 1 deletion app/code/core/Mage/Core/Block/Text/Tag/Debug.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ protected function _construct()
/**
* @param mixed $value
* @return $this
* @SuppressWarnings(PHPMD.DevelopmentCodeFragment)
* @SuppressWarnings("PHPMD.DevelopmentCodeFragment")
*/
public function setValue($value)
{
Expand Down
6 changes: 3 additions & 3 deletions app/code/core/Mage/Core/Controller/Front/Action.php
Original file line number Diff line number Diff line change
Expand Up @@ -77,8 +77,8 @@ public function postDispatch()
* Translate a phrase
*
* @return string
* @SuppressWarnings(PHPMD.CamelCaseMethodName)
* @SuppressWarnings(PHPMD.ShortMethodName)
* @SuppressWarnings("PHPMD.CamelCaseMethodName")
* @SuppressWarnings("PHPMD.ShortMethodName")
*/
public function __()
{
Expand All @@ -97,7 +97,7 @@ public function __()
* @param string $contentType
* @param int $contentLength explicit content length, if strlen($content) isn't applicable
* @return $this
* @SuppressWarnings(PHPMD.ExitExpression)
* @SuppressWarnings("PHPMD.ExitExpression")
*/
protected function _prepareDownloadResponse(
$fileName,
Expand Down
6 changes: 3 additions & 3 deletions app/code/core/Mage/Core/Controller/Request/Http.php
Original file line number Diff line number Diff line change
Expand Up @@ -318,8 +318,8 @@ public function getScheme()
* @param bool $trimPort
* @return false|string
*
* @SuppressWarnings(PHPMD.ExitExpression)
* @SuppressWarnings(PHPMD.Superglobals)
* @SuppressWarnings("PHPMD.ExitExpression")
* @SuppressWarnings("PHPMD.Superglobals")
*/
public function getHttpHost($trimPort = true)
{
Expand Down Expand Up @@ -347,7 +347,7 @@ public function getHttpHost($trimPort = true)
* @param string|array $key
* @param mixed $value
* @return $this
* @SuppressWarnings(PHPMD.Superglobals)
* @SuppressWarnings("PHPMD.Superglobals")
*/
public function setPost($key, $value = null)
{
Expand Down
2 changes: 1 addition & 1 deletion app/code/core/Mage/Core/Controller/Response/Http.php
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ public function setRedirect($url, $code = 302)
/**
* Method send already collected headers and exit from script
* @return void
* @SuppressWarnings(PHPMD.ExitExpression)
* @SuppressWarnings("PHPMD.ExitExpression")
*/
public function sendHeadersAndExit()
{
Expand Down
Loading

0 comments on commit db20784

Please sign in to comment.