Skip to content

Commit ba4bc23

Browse files
sreichelfballiano
authored andcommitted
PHPStan: Sitemap, Newsletter and more (#2823)
1 parent 0d85a8d commit ba4bc23

File tree

20 files changed

+11690
-117
lines changed

20 files changed

+11690
-117
lines changed

.github/phpstan-baseline.neon

Lines changed: 0 additions & 95 deletions
Original file line numberDiff line numberDiff line change
@@ -2680,11 +2680,6 @@ parameters:
26802680
count: 2
26812681
path: ../app/code/core/Mage/ConfigurableSwatches/Model/Resource/Catalog/Product/Type/Configurable/Product/Collection.php
26822682

2683-
-
2684-
message: "#^Return type \\(void\\) of method Mage_Contacts_IndexController\\:\\:preDispatch\\(\\) should be compatible with return type \\(\\$this\\(Mage_Core_Controller_Front_Action\\)\\) of method Mage_Core_Controller_Front_Action\\:\\:preDispatch\\(\\)$#"
2685-
count: 1
2686-
path: ../app/code/core/Mage/Contacts/controllers/IndexController.php
2687-
26882683
-
26892684
message: "#^Method Mage_Core_Block_Abstract\\:\\:_getUrlModel\\(\\) should return Mage_Core_Model_Url but returns Mage_Core_Model_Abstract\\|false\\.$#"
26902685
count: 1
@@ -3935,16 +3930,6 @@ parameters:
39353930
count: 1
39363931
path: ../app/code/core/Mage/ImportExport/Model/Export/Entity/Abstract.php
39373932

3938-
-
3939-
message: "#^Call to an undefined method Mage_Customer_Model_Entity_Attribute\\:\\:getFrontendInput\\(\\)\\.$#"
3940-
count: 1
3941-
path: ../app/code/core/Mage/ImportExport/Model/Export/Entity/Customer.php
3942-
3943-
-
3944-
message: "#^Call to an undefined method Mage_Customer_Model_Entity_Attribute\\:\\:getSource\\(\\)\\.$#"
3945-
count: 1
3946-
path: ../app/code/core/Mage/ImportExport/Model/Export/Entity/Customer.php
3947-
39483933
-
39493934
message: "#^Method Mage_Eav_Model_Entity_Attribute_Source_Interface\\:\\:getAllOptions\\(\\) invoked with 1 parameter, 0 required\\.$#"
39503935
count: 1
@@ -4000,11 +3985,6 @@ parameters:
40003985
count: 1
40013986
path: ../app/code/core/Mage/ImportExport/Model/Import/Entity/Abstract.php
40023987

4003-
-
4004-
message: "#^Call to an undefined method Mage_Customer_Model_Entity_Attribute\\:\\:getBackend\\(\\)\\.$#"
4005-
count: 3
4006-
path: ../app/code/core/Mage/ImportExport/Model/Import/Entity/Customer.php
4007-
40083988
-
40093989
message: "#^Call to an undefined method Varien_Convert_Adapter_Interface\\:\\:insertMultiple\\(\\)\\.$#"
40103990
count: 1
@@ -4030,11 +4010,6 @@ parameters:
40304010
count: 4
40314011
path: ../app/code/core/Mage/ImportExport/Model/Import/Entity/Customer.php
40324012

4033-
-
4034-
message: "#^Call to an undefined method Mage_Customer_Model_Entity_Attribute\\:\\:getBackend\\(\\)\\.$#"
4035-
count: 1
4036-
path: ../app/code/core/Mage/ImportExport/Model/Import/Entity/Customer/Address.php
4037-
40384013
-
40394014
message: "#^Call to an undefined method Varien_Convert_Adapter_Interface\\:\\:delete\\(\\)\\.$#"
40404015
count: 1
@@ -4280,26 +4255,6 @@ parameters:
42804255
count: 1
42814256
path: ../app/code/core/Mage/Media/Model/Image.php
42824257

4283-
-
4284-
message: "#^Method Mage_Newsletter_Model_Problem\\:\\:getSubscriber\\(\\) should return Mage_Newsletter_Model_Subscriber but returns null\\.$#"
4285-
count: 1
4286-
path: ../app/code/core/Mage/Newsletter/Model/Problem.php
4287-
4288-
-
4289-
message: "#^Call to an undefined method Mage_Customer_Model_Entity_Attribute\\:\\:getAttributeId\\(\\)\\.$#"
4290-
count: 3
4291-
path: ../app/code/core/Mage/Newsletter/Model/Resource/Subscriber/Collection.php
4292-
4293-
-
4294-
message: "#^Call to an undefined method Mage_Customer_Model_Entity_Attribute\\:\\:getBackend\\(\\)\\.$#"
4295-
count: 3
4296-
path: ../app/code/core/Mage/Newsletter/Model/Resource/Subscriber/Collection.php
4297-
4298-
-
4299-
message: "#^Property Mage_Newsletter_Model_Template\\:\\:\\$_mail \\(Zend_Mail\\) does not accept null\\.$#"
4300-
count: 1
4301-
path: ../app/code/core/Mage/Newsletter/Model/Template.php
4302-
43034258
-
43044259
message: "#^Method Mage_Newsletter_ManageController\\:\\:saveAction\\(\\) should return Mage_Newsletter_ManageController but return statement is missing\\.$#"
43054260
count: 1
@@ -4535,46 +4490,6 @@ parameters:
45354490
count: 1
45364491
path: ../app/code/core/Mage/Paypal/Model/Direct.php
45374492

4538-
-
4539-
message: "#^Call to an undefined method Mage_Payment_Model_Info\\:\\:lookupTransaction\\(\\)\\.$#"
4540-
count: 2
4541-
path: ../app/code/core/Mage/Paypal/Model/Express.php
4542-
4543-
-
4544-
message: "#^Method Mage_Paypal_Model_Express\\:\\:assignData\\(\\) should return Mage_Payment_Model_Info but returns \\$this\\(Mage_Paypal_Model_Express\\)\\.$#"
4545-
count: 1
4546-
path: ../app/code/core/Mage/Paypal/Model/Express.php
4547-
4548-
-
4549-
message: "#^Property Mage_Paypal_Model_Express\\:\\:\\$_pro \\(Mage_Paypal_Model_Pro\\) does not accept Mage_Core_Model_Abstract\\|false\\.$#"
4550-
count: 1
4551-
path: ../app/code/core/Mage/Paypal/Model/Express.php
4552-
4553-
-
4554-
message: "#^Return type \\(Mage_Payment_Model_Info\\) of method Mage_Paypal_Model_Express\\:\\:assignData\\(\\) should be compatible with return type \\(\\$this\\(Mage_Payment_Model_Method_Abstract\\)\\) of method Mage_Payment_Model_Method_Abstract\\:\\:assignData\\(\\)$#"
4555-
count: 1
4556-
path: ../app/code/core/Mage/Paypal/Model/Express.php
4557-
4558-
-
4559-
message: "#^Cannot call method getData\\(\\) on array\\.$#"
4560-
count: 2
4561-
path: ../app/code/core/Mage/Paypal/Model/Express/Checkout.php
4562-
4563-
-
4564-
message: "#^Cannot call method getExportedKeys\\(\\) on array\\.$#"
4565-
count: 2
4566-
path: ../app/code/core/Mage/Paypal/Model/Express/Checkout.php
4567-
4568-
-
4569-
message: "#^Variable \\$address might not be defined\\.$#"
4570-
count: 1
4571-
path: ../app/code/core/Mage/Paypal/Model/Express/Checkout.php
4572-
4573-
-
4574-
message: "#^Variable \\$shippingAddress might not be defined\\.$#"
4575-
count: 1
4576-
path: ../app/code/core/Mage/Paypal/Model/Express/Checkout.php
4577-
45784493
-
45794494
message: "#^Method Mage_Paypal_Model_Hostedpro\\:\\:initialize\\(\\) should return \\$this\\(Mage_Paypal_Model_Hostedpro\\) but return statement is missing\\.$#"
45804495
count: 1
@@ -4650,11 +4565,6 @@ parameters:
46504565
count: 1
46514566
path: ../app/code/core/Mage/Paypal/Model/Standard.php
46524567

4653-
-
4654-
message: "#^Method Varien_Data_Collection\\:\\:toOptionArray\\(\\) invoked with 1 parameter, 0 required\\.$#"
4655-
count: 1
4656-
path: ../app/code/core/Mage/Paypal/Model/System/Config/Source/BuyerCountry.php
4657-
46584568
-
46594569
message: "#^Method Varien_Data_Collection\\:\\:toOptionArray\\(\\) invoked with 1 parameter, 0 required\\.$#"
46604570
count: 1
@@ -5570,11 +5480,6 @@ parameters:
55705480
count: 1
55715481
path: ../app/code/core/Mage/Shipping/Model/Tracking/Result.php
55725482

5573-
-
5574-
message: "#^Call to an undefined method Zend_Db_Adapter_Abstract\\:\\:getCheckSql\\(\\)\\.$#"
5575-
count: 1
5576-
path: ../app/code/core/Mage/Sitemap/Model/Resource/Catalog/Abstract.php
5577-
55785483
-
55795484
message: "#^Method Mage_Tag_Model_Resource_Tag_Collection\\:\\:addPopularity\\(\\) invoked with 2 parameters, 0\\-1 required\\.$#"
55805485
count: 1

app/Mage.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -831,7 +831,7 @@ public static function isInstalled($options = [])
831831
*
832832
* @param array|object|string $message
833833
* @param int $level
834-
* @param string $file
834+
* @param string|null $file
835835
* @param bool $forceLog
836836
*/
837837
public static function log($message, $level = null, $file = '', $forceLog = false)

app/code/core/Mage/AdminNotification/Helper/Data.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,14 +33,14 @@ class Mage_AdminNotification_Helper_Data extends Mage_Core_Helper_Abstract
3333
/**
3434
* Last Notice object
3535
*
36-
* @var Mage_AdminNotification_Model_Inbox
36+
* @var Mage_AdminNotification_Model_Inbox|null
3737
*/
3838
protected $_latestNotice;
3939

4040
/**
4141
* count of unread notes by type
4242
*
43-
* @var array
43+
* @var array|null
4444
*/
4545
protected $_unreadNoticeCounts;
4646

app/code/core/Mage/AdminNotification/Model/Feed.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ class Mage_AdminNotification_Model_Feed extends Mage_Core_Model_Abstract
3636
/**
3737
* Feed url
3838
*
39-
* @var string
39+
* @var string|null
4040
*/
4141
protected $_feedUrl;
4242

app/code/core/Mage/Contacts/controllers/IndexController.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ class Mage_Contacts_IndexController extends Mage_Core_Controller_Front_Action
3434
public const XML_PATH_ENABLED = 'contacts/contacts/enabled';
3535

3636
/**
37-
* @return void
37+
* @return $this
3838
*/
3939
public function preDispatch()
4040
{
@@ -43,6 +43,7 @@ public function preDispatch()
4343
if (!Mage::getStoreConfigFlag(self::XML_PATH_ENABLED)) {
4444
$this->norouteAction();
4545
}
46+
return $this;
4647
}
4748

4849
public function indexAction()

app/code/core/Mage/Core/Controller/Varien/Action.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -196,7 +196,7 @@ public function getFlag($action, $flag = '')
196196
*
197197
* @param string $action
198198
* @param string $flag
199-
* @param string|int $value
199+
* @param string|int|bool $value
200200
* @return $this
201201
*/
202202
public function setFlag($action, $flag, $value)

app/code/core/Mage/Core/Model/Email/Template/Filter.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ public function getPlainTemplateMode()
131131
/**
132132
* Setter
133133
*
134-
* @param int $storeId
134+
* @param Mage_Core_Model_Store|int $storeId
135135
* @return $this
136136
*/
137137
public function setStoreId($storeId)

app/code/core/Mage/Customer/Model/Customer.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -463,7 +463,7 @@ public function getAttributes()
463463
* Get customer attribute model object
464464
*
465465
* @param string $attributeCode
466-
* @return Mage_Customer_Model_Entity_Attribute|null
466+
* @return Mage_Customer_Model_Customer|null
467467
* @throws Mage_Core_Exception
468468
*/
469469
public function getAttribute($attributeCode)

app/code/core/Mage/Newsletter/Model/Problem.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ class Mage_Newsletter_Model_Problem extends Mage_Core_Model_Abstract
4646
/**
4747
* Current Subscriber
4848
*
49-
* @var Mage_Newsletter_Model_Subscriber
49+
* @var Mage_Newsletter_Model_Subscriber|null
5050
*/
5151
protected $_subscriber = null;
5252

@@ -98,7 +98,7 @@ public function addErrorData(Exception $e)
9898
/**
9999
* Retrieve Subscriber
100100
*
101-
* @return Mage_Newsletter_Model_Subscriber
101+
* @return Mage_Newsletter_Model_Subscriber|null
102102
*/
103103
public function getSubscriber()
104104
{

app/code/core/Mage/Newsletter/Model/Queue.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,13 +56,13 @@ class Mage_Newsletter_Model_Queue extends Mage_Core_Model_Template
5656
/**
5757
* Newsletter Template object
5858
*
59-
* @var Mage_Newsletter_Model_Template
59+
* @var Mage_Newsletter_Model_Template|null
6060
*/
6161
protected $_template;
6262

6363
/**
6464
* Subscribers collection
65-
* @var Mage_Newsletter_Model_Resource_Subscriber_Collection
65+
* @var Mage_Newsletter_Model_Resource_Subscriber_Collection|null
6666
*/
6767
protected $_subscribersCollection = null;
6868

app/code/core/Mage/Newsletter/Model/Resource/Queue.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,7 @@ public function getStores(Mage_Newsletter_Model_Queue $queue)
169169
/**
170170
* Saving template after saving queue action
171171
*
172-
* @param Mage_Core_Model_Abstract|Mage_Newsletter_Model_Queue $queue
172+
* @param Mage_Newsletter_Model_Queue $queue
173173
* @return $this
174174
*/
175175
protected function _afterSave(Mage_Core_Model_Abstract $queue)

app/code/core/Mage/Newsletter/Model/Resource/Subscriber/Collection.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ protected function _construct()
7575
$this->_map['fields']['customer_middlename'] = 'customer_middlename_table.value';
7676
$this->_map['fields']['customer_firstname'] = 'customer_firstname_table.value';
7777
$this->_map['fields']['type'] = $this->getResource()->getReadConnection()
78-
->getCheckSql('main_table.customer_id = 0', 1, 2);
78+
->getCheckSql('main_table.customer_id = 0', '1', '2');
7979
$this->_map['fields']['website_id'] = 'store.website_id';
8080
$this->_map['fields']['group_id'] = 'store.group_id';
8181
$this->_map['fields']['store_id'] = 'main_table.store_id';
@@ -189,7 +189,7 @@ public function _getFieldTableAlias($field)
189189
}
190190

191191
if ($field == 'type') {
192-
return $this->getConnection()->getCheckSql('main_table.customer_id = 0', 1, 2);
192+
return $this->getConnection()->getCheckSql('main_table.customer_id = 0', '1', '2');
193193
}
194194

195195
if (in_array($field, ['website_id', 'group_id'])) {

app/code/core/Mage/Newsletter/Model/Subscriber.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -186,7 +186,7 @@ public function setStatus($value)
186186
/**
187187
* Set the error messages scope for subscription
188188
*
189-
* @param bool $scope
189+
* @param string $scope
190190
* @return $this
191191
*/
192192

app/code/core/Mage/Newsletter/Model/Template.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ class Mage_Newsletter_Model_Template extends Mage_Core_Model_Email_Template_Abst
6565
/**
6666
* Mail object
6767
*
68-
* @var Zend_Mail
68+
* @var Zend_Mail|null
6969
*/
7070
protected $_mail;
7171

@@ -173,7 +173,7 @@ public function isPreprocessed()
173173
/**
174174
* Check Template Text Preprocessed
175175
*
176-
* @return bool
176+
* @return string
177177
*/
178178
public function getTemplateTextPreprocessed()
179179
{

app/code/core/Mage/Sitemap/Model/Sitemap.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ class Mage_Sitemap_Model_Sitemap extends Mage_Core_Model_Abstract
4747
/**
4848
* Real file path
4949
*
50-
* @var string
50+
* @var string|null
5151
*/
5252
protected $_filePath;
5353

app/code/core/Zend/Db/Select.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -758,7 +758,7 @@ public function reset($part = null)
758758
* Gets the Zend_Db_Adapter_Abstract for this
759759
* particular Zend_Db_Select object.
760760
*
761-
* @return Zend_Db_Adapter_Abstract
761+
* @return Varien_Db_Adapter_Interface|Zend_Db_Adapter_Abstract
762762
*/
763763
public function getAdapter()
764764
{

lib/Varien/Data/Collection.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -440,7 +440,7 @@ public function clear()
440440
*
441441
* Returns array with results of callback for each item
442442
*
443-
* @param callable $callback
443+
* @param string|callable $callback
444444
* @param array $args
445445
* @return array
446446
*/

lib/Varien/Http/Adapter/Curl.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -196,7 +196,7 @@ public function write($method, $url, $http_ver = '1.1', $headers = [], $body = '
196196
/**
197197
* Read response from server
198198
*
199-
* @return string
199+
* @return string|bool
200200
*/
201201
public function read()
202202
{

0 commit comments

Comments
 (0)