Skip to content

Commit 0b1ac4c

Browse files
committed
PhpStan: fix wrong params null given
1 parent 2220264 commit 0b1ac4c

File tree

15 files changed

+293
-270
lines changed

15 files changed

+293
-270
lines changed

.phpstan.dist.baseline.neon

Lines changed: 6 additions & 102 deletions
Original file line numberDiff line numberDiff line change
@@ -1230,12 +1230,6 @@ parameters:
12301230
count: 1
12311231
path: app/code/core/Mage/Catalog/Block/Product/Compare/List.php
12321232

1233-
-
1234-
rawMessage: 'Property Mage_Catalog_Block_Product_List_Toolbar::$_collection (Mage_Core_Model_Resource_Db_Collection_Abstract) does not accept Varien_Data_Collection.'
1235-
identifier: assign.propertyType
1236-
count: 1
1237-
path: app/code/core/Mage/Catalog/Block/Product/List/Toolbar.php
1238-
12391233
-
12401234
rawMessage: 'Parameter #1 $price of method Mage_Core_Model_Store::convertPrice() expects float, string given.'
12411235
identifier: argument.type
@@ -1806,12 +1800,6 @@ parameters:
18061800
count: 1
18071801
path: app/code/core/Mage/Catalog/Model/Resource/Category/Tree.php
18081802

1809-
-
1810-
rawMessage: 'Parameter #2 $alias of method Varien_Db_Adapter_Interface::quoteColumnAs() expects string, null given.'
1811-
identifier: argument.type
1812-
count: 2
1813-
path: app/code/core/Mage/Catalog/Model/Resource/Collection/Abstract.php
1814-
18151803
-
18161804
rawMessage: 'Property Mage_Catalog_Model_Resource_Config::$_storeId (int) on left side of ?? is not nullable.'
18171805
identifier: nullCoalesce.property
@@ -1932,12 +1920,6 @@ parameters:
19321920
count: 1
19331921
path: app/code/core/Mage/Catalog/Model/Resource/Product/Indexer/Price.php
19341922

1935-
-
1936-
rawMessage: 'Parameter #2 $alias of method Varien_Db_Adapter_Interface::quoteColumnAs() expects string, null given.'
1937-
identifier: argument.type
1938-
count: 1
1939-
path: app/code/core/Mage/Catalog/Model/Resource/Product/Link/Collection.php
1940-
19411923
-
19421924
rawMessage: Left side of && is always true.
19431925
identifier: booleanAnd.leftAlwaysTrue
@@ -2154,12 +2136,6 @@ parameters:
21542136
count: 1
21552137
path: app/code/core/Mage/Checkout/Block/Cart/Abstract.php
21562138

2157-
-
2158-
rawMessage: 'Parameter #1 $productThumbnail of method Mage_Checkout_Block_Cart_Item_Renderer::overrideProductThumbnail() expects Mage_Catalog_Helper_Image, null given.'
2159-
identifier: argument.type
2160-
count: 1
2161-
path: app/code/core/Mage/Checkout/Block/Cart/Item/Renderer/Grouped.php
2162-
21632139
-
21642140
rawMessage: PHPDoc tag @var with type Mage_Sales_Model_Quote_Item is not subtype of native type null.
21652141
identifier: varTag.nativeType
@@ -2298,12 +2274,6 @@ parameters:
22982274
count: 2
22992275
path: app/code/core/Mage/ConfigurableSwatches/Model/Resource/Catalog/Product/Type/Configurable/Product/Collection.php
23002276

2301-
-
2302-
rawMessage: 'Parameter #1 $array of function array_unshift expects array, null given.'
2303-
identifier: argument.type
2304-
count: 1
2305-
path: app/code/core/Mage/ConfigurableSwatches/Model/System/Config/Source/Catalog/Product/Configattribute/Select.php
2306-
23072277
-
23082278
rawMessage: 'Method Mage_Core_Block_Abstract::getParentBlock() should return $this(Mage_Core_Block_Abstract) but returns Mage_Core_Block_Abstract.'
23092279
identifier: return.type
@@ -2700,12 +2670,6 @@ parameters:
27002670
count: 1
27012671
path: app/code/core/Mage/Core/Model/Resource/Session.php
27022672

2703-
-
2704-
rawMessage: 'Parameter #1 $hook of method Varien_Db_Adapter_Pdo_Mysql::setQueryHook() expects array, null given.'
2705-
identifier: argument.type
2706-
count: 1
2707-
path: app/code/core/Mage/Core/Model/Resource/Setup.php
2708-
27092673
-
27102674
rawMessage: 'Property Mage_Core_Model_Resource_Setup::$_resourceConfig (Mage_Core_Model_Config_Element) does not accept SimpleXMLElement.'
27112675
identifier: assign.propertyType
@@ -3312,12 +3276,6 @@ parameters:
33123276
count: 1
33133277
path: app/code/core/Mage/Eav/Model/Entity/Collection/Abstract.php
33143278

3315-
-
3316-
rawMessage: 'Parameter #2 $alias of method Varien_Db_Adapter_Interface::quoteColumnAs() expects string, null given.'
3317-
identifier: argument.type
3318-
count: 4
3319-
path: app/code/core/Mage/Eav/Model/Entity/Collection/Abstract.php
3320-
33213279
-
33223280
rawMessage: 'Property Mage_Eav_Model_Entity_Collection_Abstract::$_entity (Mage_Eav_Model_Entity_Abstract) in empty() is not falsy.'
33233281
identifier: empty.property
@@ -3426,12 +3384,6 @@ parameters:
34263384
count: 4
34273385
path: app/code/core/Mage/ImportExport/Block/Adminhtml/Export/Filter.php
34283386

3429-
-
3430-
rawMessage: 'Parameter #1 $limit of method Mage_Adminhtml_Block_Widget_Grid::setDefaultLimit() expects int, null given.'
3431-
identifier: argument.type
3432-
count: 1
3433-
path: app/code/core/Mage/ImportExport/Block/Adminhtml/Export/Filter.php
3434-
34353387
-
34363388
rawMessage: 'Method Mage_Eav_Model_Entity_Attribute_Source_Interface::getAllOptions() invoked with 1 parameter, 0 required.'
34373389
identifier: arguments.count
@@ -3480,6 +3432,12 @@ parameters:
34803432
count: 1
34813433
path: app/code/core/Mage/ImportExport/Model/Import/Entity/Product.php
34823434

3435+
-
3436+
rawMessage: 'Method Mage_ImportExport_Model_Resource_Import_Data::getIterator() should return IteratorIterator but returns Traversable<mixed, mixed>.'
3437+
identifier: return.type
3438+
count: 1
3439+
path: app/code/core/Mage/ImportExport/Model/Resource/Import/Data.php
3440+
34833441
-
34843442
rawMessage: 'Parameter #3 ...$values of function sprintf expects bool|float|int|string|null, array<string, int|string>|null given.'
34853443
identifier: argument.type
@@ -3552,24 +3510,12 @@ parameters:
35523510
count: 1
35533511
path: app/code/core/Mage/Newsletter/Model/Subscriber.php
35543512

3555-
-
3556-
rawMessage: 'Parameter #2 $idFieldName of method Mage_Core_Model_Resource_Db_Abstract::_init() expects string, null given.'
3557-
identifier: argument.type
3558-
count: 1
3559-
path: app/code/core/Mage/Oauth/Model/Resource/Nonce.php
3560-
35613513
-
35623514
rawMessage: 'Parameter #2 $value of method Varien_Data_Collection::addFilter() expects array|string, int given.'
35633515
identifier: argument.type
35643516
count: 4
35653517
path: app/code/core/Mage/Oauth/Model/Resource/Token/Collection.php
35663518

3567-
-
3568-
rawMessage: 'Parameter #1 $data of method Mage_Oauth_Adminhtml_Oauth_ConsumerController::_setFormData() expects array, null given.'
3569-
identifier: argument.type
3570-
count: 2
3571-
path: app/code/core/Mage/Oauth/controllers/Adminhtml/Oauth/ConsumerController.php
3572-
35733519
-
35743520
rawMessage: 'Call to an undefined method Mage_Payment_Model_Method_Abstract::isPartialAuthorization().'
35753521
identifier: method.notFound
@@ -4164,12 +4110,6 @@ parameters:
41644110
count: 1
41654111
path: app/code/core/Mage/Sales/Model/Order/Creditmemo.php
41664112

4167-
-
4168-
rawMessage: 'Parameter #2 $options of method Mage_Directory_Model_Currency::format() expects array, null given.'
4169-
identifier: argument.type
4170-
count: 1
4171-
path: app/code/core/Mage/Sales/Model/Order/Creditmemo/Total/Shipping.php
4172-
41734113
-
41744114
rawMessage: 'Parameter #1 $incrementId of method Mage_Sales_Model_Order_Invoice::loadByIncrementId() expects string, int given.'
41754115
identifier: argument.type
@@ -4512,12 +4452,6 @@ parameters:
45124452
count: 2
45134453
path: app/code/core/Mage/SalesRule/Model/Validator.php
45144454

4515-
-
4516-
rawMessage: 'Parameter #2 $title of method Mage_Weee_Helper_Data::setWeeeTaxesAppliedProperty() expects string, null given.'
4517-
identifier: argument.type
4518-
count: 2
4519-
path: app/code/core/Mage/SalesRule/Model/Validator.php
4520-
45214455
-
45224456
rawMessage: 'Parameter #4 $value of method Mage_Weee_Helper_Data::setWeeeTaxesAppliedProperty() expects string, (float|int) given.'
45234457
identifier: argument.type
@@ -4674,18 +4608,6 @@ parameters:
46744608
count: 1
46754609
path: app/code/core/Mage/Tax/Helper/Data.php
46764610

4677-
-
4678-
rawMessage: 'Parameter #1 $request of method Mage_Tax_Model_Resource_Calculation::getCalculationProcess() expects Varien_Object, null given.'
4679-
identifier: argument.type
4680-
count: 1
4681-
path: app/code/core/Mage/Tax/Model/Calculation.php
4682-
4683-
-
4684-
rawMessage: 'Property Mage_Tax_Model_Calculation::$_defaultCustomerTaxClass (string) does not accept int.'
4685-
identifier: assign.propertyType
4686-
count: 1
4687-
path: app/code/core/Mage/Tax/Model/Calculation.php
4688-
46894611
-
46904612
rawMessage: 'Property Mage_Tax_Model_Calculation_Rate::$_titles (array|null) does not accept Mage_Tax_Model_Resource_Calculation_Rate_Title_Collection.'
46914613
identifier: assign.propertyType
@@ -5268,12 +5190,6 @@ parameters:
52685190
count: 2
52695191
path: app/design/frontend/base/default/template/catalog/product/compare/list.phtml
52705192

5271-
-
5272-
rawMessage: 'Parameter #1 $order of method Mage_Catalog_Block_Product_List_Toolbar::getOrderUrl() expects string, null given.'
5273-
identifier: argument.type
5274-
count: 2
5275-
path: app/design/frontend/base/default/template/catalog/product/list/toolbar.phtml
5276-
52775193
-
52785194
rawMessage: Left side of && is always true.
52795195
identifier: booleanAnd.leftAlwaysTrue
@@ -5604,12 +5520,6 @@ parameters:
56045520
count: 2
56055521
path: app/design/frontend/rwd/default/template/catalog/product/compare/list.phtml
56065522

5607-
-
5608-
rawMessage: 'Parameter #1 $order of method Mage_Catalog_Block_Product_List_Toolbar::getOrderUrl() expects string, null given.'
5609-
identifier: argument.type
5610-
count: 2
5611-
path: app/design/frontend/rwd/default/template/catalog/product/list/toolbar.phtml
5612-
56135523
-
56145524
rawMessage: Left side of && is always true.
56155525
identifier: booleanAnd.leftAlwaysTrue
@@ -5988,12 +5898,6 @@ parameters:
59885898
count: 2
59895899
path: lib/Varien/Db/Adapter/Pdo/Mysql.php
59905900

5991-
-
5992-
rawMessage: 'Method Varien_Db_Adapter_Pdo_Mysql::query() should return Zend_Db_Statement_Pdo but returns PDOStatement|Zend_Db_Statement_Interface.'
5993-
identifier: return.type
5994-
count: 1
5995-
path: lib/Varien/Db/Adapter/Pdo/Mysql.php
5996-
59975901
-
59985902
rawMessage: 'Parameter #4 $result of method Varien_Db_Adapter_Pdo_Mysql::_debugStat() expects Zend_Db_Statement_Pdo|null, PDOStatement|Zend_Db_Statement_Interface given.'
59995903
identifier: argument.type

app/code/core/Mage/Catalog/Block/Product/List/Toolbar.php

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -199,7 +199,8 @@ protected function _memorizeParam($param, $value)
199199
/**
200200
* Set collection to pager
201201
*
202-
* @param Varien_Data_Collection $collection
202+
* @param Mage_Core_Model_Resource_Db_Collection_Abstract $collection
203+
* @throws Exception
203204
* @return $this
204205
*/
205206
public function setCollection($collection)
@@ -284,6 +285,7 @@ public function getLimitVarName()
284285
/**
285286
* Return current page from request
286287
*
288+
* @throws Exception
287289
* @return int
288290
*/
289291
public function getCurrentPage()
@@ -298,6 +300,7 @@ public function getCurrentPage()
298300
/**
299301
* Get grit products sort order field
300302
*
303+
* @throws Exception
301304
* @return string
302305
*/
303306
public function getCurrentOrder()
@@ -338,6 +341,7 @@ public function getCurrentOrder()
338341
/**
339342
* Retrieve current direction
340343
*
344+
* @throws Exception
341345
* @return string
342346
*/
343347
public function getCurrentDirection()
@@ -452,6 +456,7 @@ public function removeOrderFromAvailableOrders($order)
452456
* Compare defined order field vith current order field
453457
*
454458
* @param string $order
459+
* @throws Exception
455460
* @return bool
456461
*/
457462
public function isOrderCurrent($order)
@@ -462,8 +467,9 @@ public function isOrderCurrent($order)
462467
/**
463468
* Retrieve Pager URL
464469
*
465-
* @param string $order
470+
* @param null|string $order
466471
* @param string $direction
472+
* @throws Exception
467473
* @return string
468474
*/
469475
public function getOrderUrl($order, $direction)
@@ -498,6 +504,7 @@ public function getPagerUrl($params = [])
498504
/**
499505
* Retrieve current View mode
500506
*
507+
* @throws Exception
501508
* @return string
502509
*/
503510
public function getCurrentMode()
@@ -532,6 +539,7 @@ public function getCurrentMode()
532539
* Compare defined view mode with current active mode
533540
*
534541
* @param string $mode
542+
* @throws Exception
535543
* @return bool
536544
*/
537545
public function isModeActive($mode)
@@ -642,6 +650,7 @@ public function isExpanded()
642650
/**
643651
* Retrieve default per page values
644652
*
653+
* @throws Exception
645654
* @return string (comma separated)
646655
*/
647656
public function getDefaultPerPageValue()
@@ -684,6 +693,7 @@ public function addPagerLimit($mode, $value, $label = '')
684693
/**
685694
* Retrieve available limits for current view mode
686695
*
696+
* @throws Exception
687697
* @return array
688698
*/
689699
public function getAvailableLimit()
@@ -722,6 +732,7 @@ protected function _getAvailableLimit($mode)
722732
/**
723733
* Get specified products limit display per page
724734
*
735+
* @throws Exception
725736
* @return string
726737
*/
727738
public function getLimit()
@@ -773,6 +784,7 @@ public function getLimitUrl($limit)
773784

774785
/**
775786
* @param int $limit
787+
* @throws Exception
776788
* @return bool
777789
*/
778790
public function isLimitCurrent($limit)
@@ -825,6 +837,7 @@ public function getLastPageNum()
825837
/**
826838
* Render pagination HTML
827839
*
840+
* @throws Exception
828841
* @return string
829842
*/
830843
public function getPagerHtml()

app/code/core/Mage/Checkout/Block/Cart/Item/Renderer.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ public function getProduct()
7575
}
7676

7777
/**
78-
* @param Mage_Catalog_Helper_Image $productThumbnail
78+
* @param null|Mage_Catalog_Helper_Image $productThumbnail
7979
* @return $this
8080
*/
8181
public function overrideProductThumbnail($productThumbnail)
@@ -179,7 +179,7 @@ public function getProductName()
179179
/**
180180
* Get product customize options
181181
*
182-
* @return array|false
182+
* @return array
183183
*/
184184
public function getProductOptions()
185185
{

app/code/core/Mage/ConfigurableSwatches/Model/System/Config/Source/Catalog/Product/Configattribute.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ class Mage_ConfigurableSwatches_Model_System_Config_Source_Catalog_Product_Confi
1515
/**
1616
* Attributes array
1717
*
18-
* @var null|array
18+
* @var array
1919
*/
2020
protected $_attributes = null;
2121

app/code/core/Mage/ConfigurableSwatches/Model/System/Config/Source/Catalog/Product/Configattribute/Select.php

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,13 +21,17 @@ public function toOptionArray()
2121
{
2222
if (is_null($this->_attributes)) {
2323
parent::toOptionArray();
24+
$attributes = $this->_attributes;
25+
2426
array_unshift(
25-
$this->_attributes,
27+
$attributes,
2628
[
2729
'value' => '',
2830
'label' => Mage::helper('configurableswatches')->__('-- Please Select --'),
2931
],
3032
);
33+
34+
$this->_attributes = $attributes;
3135
}
3236

3337
return $this->_attributes;

0 commit comments

Comments
 (0)