Skip to content

Commit b0b850e

Browse files
authored
phpstan fixes (#4273)
1 parent a5a8527 commit b0b850e

File tree

30 files changed

+107
-218
lines changed

30 files changed

+107
-218
lines changed

.phpstan.dist.baseline.neon

Lines changed: 0 additions & 180 deletions
Large diffs are not rendered by default.

app/code/core/Mage/Adminhtml/Block/Catalog/Product/Edit/Tab/Websites.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -130,6 +130,6 @@ public function getChooseFromStoreHtml($storeTo)
130130
}
131131
$this->_storeFromHtml .= '</select>';
132132
}
133-
return str_replace('__store_identifier__', $storeTo->getId(), $this->_storeFromHtml);
133+
return str_replace('__store_identifier__', (string)$storeTo->getId(), $this->_storeFromHtml);
134134
}
135135
}

app/code/core/Mage/Adminhtml/controllers/System/StoreController.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -442,7 +442,7 @@ public function deleteStorePostAction()
442442
*
443443
* @param string $failPath redirect path if backup failed
444444
* @param array $arguments
445-
* @return $this
445+
* @return $this|void
446446
*/
447447
protected function _backupDatabase($failPath, $arguments = [])
448448
{
@@ -468,11 +468,11 @@ protected function _backupDatabase($failPath, $arguments = [])
468468
} catch (Mage_Core_Exception $e) {
469469
$this->_getSession()->addError($e->getMessage());
470470
$this->_redirect($failPath, $arguments);
471-
return ;
471+
return;
472472
} catch (Exception $e) {
473473
$this->_getSession()->addException($e, Mage::helper('backup')->__('Unable to create backup. Please, try again later.'));
474474
$this->_redirect($failPath, $arguments);
475-
return ;
475+
return;
476476
}
477477
return $this;
478478
}

app/code/core/Mage/Api2/Model/Resource.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -621,6 +621,7 @@ protected function _critical($message, $code = null)
621621
}
622622
$code = $errors[$message];
623623
}
624+
// phpcs:ignore Ecg.Classes.ObjectInstantiation.DirectInstantiation
624625
throw new Mage_Api2_Exception($message, $code);
625626
}
626627

@@ -657,6 +658,7 @@ protected function _getCriticalErrors()
657658
*/
658659
protected function _error($message, $code)
659660
{
661+
// phpcs:ignore Ecg.Classes.ObjectInstantiation.DirectInstantiation
660662
$this->getResponse()->setException(new Mage_Api2_Exception($message, $code));
661663
return $this;
662664
}
@@ -789,7 +791,7 @@ protected function _multicall($resourceInstanceId)
789791
*
790792
* @param string $resourceId Resource identifier
791793
* @param array $requestParams Parameters to be set to request
792-
* @return $this
794+
* @return Mage_Api2_Model_Resource
793795
*/
794796
protected function _getSubModel($resourceId, array $requestParams)
795797
{

app/code/core/Mage/Catalog/Helper/Product/Type/Composite.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ public function registerJsPrice($price)
7676
* @param float $price
7777
* @param bool $round
7878
* @param null|int $storeId
79-
* @return float
79+
* @return int|float
8080
*/
8181
public function convertPrice($price, $round = false, $storeId = null)
8282
{

app/code/core/Mage/Catalog/Model/Category.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -138,6 +138,7 @@ class Mage_Catalog_Model_Category extends Mage_Catalog_Model_Abstract
138138
*
139139
* @var array
140140
*/
141+
// phpcs:ignore Ecg.PHP.PrivateClassMember.PrivateClassMemberError
141142
private $_designAttributes = [
142143
'custom_design',
143144
'custom_design_from',
@@ -629,6 +630,7 @@ public function getDesignAttributes()
629630
* @param string $attributeCode
630631
* @return Mage_Eav_Model_Entity_Attribute_Abstract
631632
*/
633+
// phpcs:ignore Ecg.PHP.PrivateClassMember.PrivateClassMemberError
632634
private function _getAttribute($attributeCode)
633635
{
634636
if (!$this->_useFlatResource) {
@@ -875,7 +877,7 @@ public function getChildrenCategoriesWithInactive()
875877
/**
876878
* Return parent category of current category with own custom design settings
877879
*
878-
* @return $this
880+
* @return Mage_Catalog_Model_Category
879881
*/
880882
public function getParentDesignCategory()
881883
{

app/code/core/Mage/Catalog/Model/Product.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -660,6 +660,7 @@ public function getStoreIds()
660660
* @param bool $skipSuper Not used
661661
* @return array
662662
*/
663+
// phpcs:ignore Generic.CodeAnalysis.UnusedFunctionParameter.FoundInExtendedClassAfterLastUsed
663664
public function getAttributes($groupId = null, $skipSuper = false)
664665
{
665666
/** @var Mage_Catalog_Model_Resource_Eav_Attribute[] $productAttributes */
@@ -1305,7 +1306,7 @@ public function getMediaConfig()
13051306
/**
13061307
* Create duplicate
13071308
*
1308-
* @return $this
1309+
* @return Mage_Catalog_Model_Product
13091310
*/
13101311
public function duplicate()
13111312
{

app/code/core/Mage/Core/Block/Abstract.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -417,7 +417,7 @@ public function getSortedChildren()
417417
*
418418
* Wrapper for method "setData"
419419
*
420-
* @param string $name
420+
* @param array|string $name
421421
* @param mixed $value
422422
* @return $this
423423
*/
@@ -1086,7 +1086,7 @@ public function setMessagesBlock(Mage_Core_Block_Messages $block)
10861086
* Return block helper
10871087
*
10881088
* @param string $type
1089-
* @return $this
1089+
* @return Mage_Core_Block_Abstract
10901090
*/
10911091
public function getHelper($type)
10921092
{

app/code/core/Mage/Core/Block/Profiler.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,8 @@ protected function _toHtml()
5959
}
6060
$out .= '</table>';
6161
$out .= '<pre>';
62-
$out .= print_r(Varien_Profiler::getSqlProfiler(Mage::getSingleton('core/resource')->getConnection('core_write')), 1);
62+
// phpcs:ignore Ecg.Security.ForbiddenFunction.Found
63+
$out .= print_r(Varien_Profiler::getSqlProfiler(Mage::getSingleton('core/resource')->getConnection('core_write')), true);
6364
$out .= '</pre>';
6465
$out .= '</div>';
6566

app/code/core/Mage/Core/Block/Text/Tag/Debug.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,10 +31,11 @@ protected function _construct()
3131

3232
/**
3333
* @param mixed $value
34-
* @return Mage_Core_Block_Text_Tag_Debug
34+
* @return $this
3535
*/
3636
public function setValue($value)
3737
{
38-
return $this->setContents(print_r($value, 1));
38+
// phpcs:ignore Ecg.Security.ForbiddenFunction.Found
39+
return $this->setContents(print_r($value, true));
3940
}
4041
}

0 commit comments

Comments
 (0)