Skip to content

Commit 355cff5

Browse files
authored
PHPStan: Sitemap, Newsletter and more (#2823)
1 parent 21d66ed commit 355cff5

File tree

19 files changed

+75
-4137
lines changed

19 files changed

+75
-4137
lines changed

app/Mage.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -829,7 +829,7 @@ public static function isInstalled($options = [])
829829
*
830830
* @param array|object|string $message
831831
* @param int $level
832-
* @param string $file
832+
* @param string|null $file
833833
* @param bool $forceLog
834834
*/
835835
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)