Skip to content

Commit

Permalink
PHPStan: Sitemap, Newsletter and more (#2823)
Browse files Browse the repository at this point in the history
  • Loading branch information
sreichel authored and fballiano committed Dec 20, 2022
1 parent 0d85a8d commit ba4bc23
Show file tree
Hide file tree
Showing 20 changed files with 11,690 additions and 117 deletions.
95 changes: 0 additions & 95 deletions .github/phpstan-baseline.neon
Original file line number Diff line number Diff line change
Expand Up @@ -2680,11 +2680,6 @@ parameters:
count: 2
path: ../app/code/core/Mage/ConfigurableSwatches/Model/Resource/Catalog/Product/Type/Configurable/Product/Collection.php

-
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\\(\\)$#"
count: 1
path: ../app/code/core/Mage/Contacts/controllers/IndexController.php

-
message: "#^Method Mage_Core_Block_Abstract\\:\\:_getUrlModel\\(\\) should return Mage_Core_Model_Url but returns Mage_Core_Model_Abstract\\|false\\.$#"
count: 1
Expand Down Expand Up @@ -3935,16 +3930,6 @@ parameters:
count: 1
path: ../app/code/core/Mage/ImportExport/Model/Export/Entity/Abstract.php

-
message: "#^Call to an undefined method Mage_Customer_Model_Entity_Attribute\\:\\:getFrontendInput\\(\\)\\.$#"
count: 1
path: ../app/code/core/Mage/ImportExport/Model/Export/Entity/Customer.php

-
message: "#^Call to an undefined method Mage_Customer_Model_Entity_Attribute\\:\\:getSource\\(\\)\\.$#"
count: 1
path: ../app/code/core/Mage/ImportExport/Model/Export/Entity/Customer.php

-
message: "#^Method Mage_Eav_Model_Entity_Attribute_Source_Interface\\:\\:getAllOptions\\(\\) invoked with 1 parameter, 0 required\\.$#"
count: 1
Expand Down Expand Up @@ -4000,11 +3985,6 @@ parameters:
count: 1
path: ../app/code/core/Mage/ImportExport/Model/Import/Entity/Abstract.php

-
message: "#^Call to an undefined method Mage_Customer_Model_Entity_Attribute\\:\\:getBackend\\(\\)\\.$#"
count: 3
path: ../app/code/core/Mage/ImportExport/Model/Import/Entity/Customer.php

-
message: "#^Call to an undefined method Varien_Convert_Adapter_Interface\\:\\:insertMultiple\\(\\)\\.$#"
count: 1
Expand All @@ -4030,11 +4010,6 @@ parameters:
count: 4
path: ../app/code/core/Mage/ImportExport/Model/Import/Entity/Customer.php

-
message: "#^Call to an undefined method Mage_Customer_Model_Entity_Attribute\\:\\:getBackend\\(\\)\\.$#"
count: 1
path: ../app/code/core/Mage/ImportExport/Model/Import/Entity/Customer/Address.php

-
message: "#^Call to an undefined method Varien_Convert_Adapter_Interface\\:\\:delete\\(\\)\\.$#"
count: 1
Expand Down Expand Up @@ -4280,26 +4255,6 @@ parameters:
count: 1
path: ../app/code/core/Mage/Media/Model/Image.php

-
message: "#^Method Mage_Newsletter_Model_Problem\\:\\:getSubscriber\\(\\) should return Mage_Newsletter_Model_Subscriber but returns null\\.$#"
count: 1
path: ../app/code/core/Mage/Newsletter/Model/Problem.php

-
message: "#^Call to an undefined method Mage_Customer_Model_Entity_Attribute\\:\\:getAttributeId\\(\\)\\.$#"
count: 3
path: ../app/code/core/Mage/Newsletter/Model/Resource/Subscriber/Collection.php

-
message: "#^Call to an undefined method Mage_Customer_Model_Entity_Attribute\\:\\:getBackend\\(\\)\\.$#"
count: 3
path: ../app/code/core/Mage/Newsletter/Model/Resource/Subscriber/Collection.php

-
message: "#^Property Mage_Newsletter_Model_Template\\:\\:\\$_mail \\(Zend_Mail\\) does not accept null\\.$#"
count: 1
path: ../app/code/core/Mage/Newsletter/Model/Template.php

-
message: "#^Method Mage_Newsletter_ManageController\\:\\:saveAction\\(\\) should return Mage_Newsletter_ManageController but return statement is missing\\.$#"
count: 1
Expand Down Expand Up @@ -4535,46 +4490,6 @@ parameters:
count: 1
path: ../app/code/core/Mage/Paypal/Model/Direct.php

-
message: "#^Call to an undefined method Mage_Payment_Model_Info\\:\\:lookupTransaction\\(\\)\\.$#"
count: 2
path: ../app/code/core/Mage/Paypal/Model/Express.php

-
message: "#^Method Mage_Paypal_Model_Express\\:\\:assignData\\(\\) should return Mage_Payment_Model_Info but returns \\$this\\(Mage_Paypal_Model_Express\\)\\.$#"
count: 1
path: ../app/code/core/Mage/Paypal/Model/Express.php

-
message: "#^Property Mage_Paypal_Model_Express\\:\\:\\$_pro \\(Mage_Paypal_Model_Pro\\) does not accept Mage_Core_Model_Abstract\\|false\\.$#"
count: 1
path: ../app/code/core/Mage/Paypal/Model/Express.php

-
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\\(\\)$#"
count: 1
path: ../app/code/core/Mage/Paypal/Model/Express.php

-
message: "#^Cannot call method getData\\(\\) on array\\.$#"
count: 2
path: ../app/code/core/Mage/Paypal/Model/Express/Checkout.php

-
message: "#^Cannot call method getExportedKeys\\(\\) on array\\.$#"
count: 2
path: ../app/code/core/Mage/Paypal/Model/Express/Checkout.php

-
message: "#^Variable \\$address might not be defined\\.$#"
count: 1
path: ../app/code/core/Mage/Paypal/Model/Express/Checkout.php

-
message: "#^Variable \\$shippingAddress might not be defined\\.$#"
count: 1
path: ../app/code/core/Mage/Paypal/Model/Express/Checkout.php

-
message: "#^Method Mage_Paypal_Model_Hostedpro\\:\\:initialize\\(\\) should return \\$this\\(Mage_Paypal_Model_Hostedpro\\) but return statement is missing\\.$#"
count: 1
Expand Down Expand Up @@ -4650,11 +4565,6 @@ parameters:
count: 1
path: ../app/code/core/Mage/Paypal/Model/Standard.php

-
message: "#^Method Varien_Data_Collection\\:\\:toOptionArray\\(\\) invoked with 1 parameter, 0 required\\.$#"
count: 1
path: ../app/code/core/Mage/Paypal/Model/System/Config/Source/BuyerCountry.php

-
message: "#^Method Varien_Data_Collection\\:\\:toOptionArray\\(\\) invoked with 1 parameter, 0 required\\.$#"
count: 1
Expand Down Expand Up @@ -5570,11 +5480,6 @@ parameters:
count: 1
path: ../app/code/core/Mage/Shipping/Model/Tracking/Result.php

-
message: "#^Call to an undefined method Zend_Db_Adapter_Abstract\\:\\:getCheckSql\\(\\)\\.$#"
count: 1
path: ../app/code/core/Mage/Sitemap/Model/Resource/Catalog/Abstract.php

-
message: "#^Method Mage_Tag_Model_Resource_Tag_Collection\\:\\:addPopularity\\(\\) invoked with 2 parameters, 0\\-1 required\\.$#"
count: 1
Expand Down
2 changes: 1 addition & 1 deletion app/Mage.php
Original file line number Diff line number Diff line change
Expand Up @@ -831,7 +831,7 @@ public static function isInstalled($options = [])
*
* @param array|object|string $message
* @param int $level
* @param string $file
* @param string|null $file
* @param bool $forceLog
*/
public static function log($message, $level = null, $file = '', $forceLog = false)
Expand Down
4 changes: 2 additions & 2 deletions app/code/core/Mage/AdminNotification/Helper/Data.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,14 +33,14 @@ class Mage_AdminNotification_Helper_Data extends Mage_Core_Helper_Abstract
/**
* Last Notice object
*
* @var Mage_AdminNotification_Model_Inbox
* @var Mage_AdminNotification_Model_Inbox|null
*/
protected $_latestNotice;

/**
* count of unread notes by type
*
* @var array
* @var array|null
*/
protected $_unreadNoticeCounts;

Expand Down
2 changes: 1 addition & 1 deletion app/code/core/Mage/AdminNotification/Model/Feed.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ class Mage_AdminNotification_Model_Feed extends Mage_Core_Model_Abstract
/**
* Feed url
*
* @var string
* @var string|null
*/
protected $_feedUrl;

Expand Down
3 changes: 2 additions & 1 deletion app/code/core/Mage/Contacts/controllers/IndexController.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ class Mage_Contacts_IndexController extends Mage_Core_Controller_Front_Action
public const XML_PATH_ENABLED = 'contacts/contacts/enabled';

/**
* @return void
* @return $this
*/
public function preDispatch()
{
Expand All @@ -43,6 +43,7 @@ public function preDispatch()
if (!Mage::getStoreConfigFlag(self::XML_PATH_ENABLED)) {
$this->norouteAction();
}
return $this;
}

public function indexAction()
Expand Down
2 changes: 1 addition & 1 deletion app/code/core/Mage/Core/Controller/Varien/Action.php
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,7 @@ public function getFlag($action, $flag = '')
*
* @param string $action
* @param string $flag
* @param string|int $value
* @param string|int|bool $value
* @return $this
*/
public function setFlag($action, $flag, $value)
Expand Down
2 changes: 1 addition & 1 deletion app/code/core/Mage/Core/Model/Email/Template/Filter.php
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ public function getPlainTemplateMode()
/**
* Setter
*
* @param int $storeId
* @param Mage_Core_Model_Store|int $storeId
* @return $this
*/
public function setStoreId($storeId)
Expand Down
2 changes: 1 addition & 1 deletion app/code/core/Mage/Customer/Model/Customer.php
Original file line number Diff line number Diff line change
Expand Up @@ -463,7 +463,7 @@ public function getAttributes()
* Get customer attribute model object
*
* @param string $attributeCode
* @return Mage_Customer_Model_Entity_Attribute|null
* @return Mage_Customer_Model_Customer|null
* @throws Mage_Core_Exception
*/
public function getAttribute($attributeCode)
Expand Down
4 changes: 2 additions & 2 deletions app/code/core/Mage/Newsletter/Model/Problem.php
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ class Mage_Newsletter_Model_Problem extends Mage_Core_Model_Abstract
/**
* Current Subscriber
*
* @var Mage_Newsletter_Model_Subscriber
* @var Mage_Newsletter_Model_Subscriber|null
*/
protected $_subscriber = null;

Expand Down Expand Up @@ -98,7 +98,7 @@ public function addErrorData(Exception $e)
/**
* Retrieve Subscriber
*
* @return Mage_Newsletter_Model_Subscriber
* @return Mage_Newsletter_Model_Subscriber|null
*/
public function getSubscriber()
{
Expand Down
4 changes: 2 additions & 2 deletions app/code/core/Mage/Newsletter/Model/Queue.php
Original file line number Diff line number Diff line change
Expand Up @@ -56,13 +56,13 @@ class Mage_Newsletter_Model_Queue extends Mage_Core_Model_Template
/**
* Newsletter Template object
*
* @var Mage_Newsletter_Model_Template
* @var Mage_Newsletter_Model_Template|null
*/
protected $_template;

/**
* Subscribers collection
* @var Mage_Newsletter_Model_Resource_Subscriber_Collection
* @var Mage_Newsletter_Model_Resource_Subscriber_Collection|null
*/
protected $_subscribersCollection = null;

Expand Down
2 changes: 1 addition & 1 deletion app/code/core/Mage/Newsletter/Model/Resource/Queue.php
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ public function getStores(Mage_Newsletter_Model_Queue $queue)
/**
* Saving template after saving queue action
*
* @param Mage_Core_Model_Abstract|Mage_Newsletter_Model_Queue $queue
* @param Mage_Newsletter_Model_Queue $queue
* @return $this
*/
protected function _afterSave(Mage_Core_Model_Abstract $queue)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ protected function _construct()
$this->_map['fields']['customer_middlename'] = 'customer_middlename_table.value';
$this->_map['fields']['customer_firstname'] = 'customer_firstname_table.value';
$this->_map['fields']['type'] = $this->getResource()->getReadConnection()
->getCheckSql('main_table.customer_id = 0', 1, 2);
->getCheckSql('main_table.customer_id = 0', '1', '2');
$this->_map['fields']['website_id'] = 'store.website_id';
$this->_map['fields']['group_id'] = 'store.group_id';
$this->_map['fields']['store_id'] = 'main_table.store_id';
Expand Down Expand Up @@ -189,7 +189,7 @@ public function _getFieldTableAlias($field)
}

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

if (in_array($field, ['website_id', 'group_id'])) {
Expand Down
2 changes: 1 addition & 1 deletion app/code/core/Mage/Newsletter/Model/Subscriber.php
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@ public function setStatus($value)
/**
* Set the error messages scope for subscription
*
* @param bool $scope
* @param string $scope
* @return $this
*/

Expand Down
4 changes: 2 additions & 2 deletions app/code/core/Mage/Newsletter/Model/Template.php
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ class Mage_Newsletter_Model_Template extends Mage_Core_Model_Email_Template_Abst
/**
* Mail object
*
* @var Zend_Mail
* @var Zend_Mail|null
*/
protected $_mail;

Expand Down Expand Up @@ -173,7 +173,7 @@ public function isPreprocessed()
/**
* Check Template Text Preprocessed
*
* @return bool
* @return string
*/
public function getTemplateTextPreprocessed()
{
Expand Down
2 changes: 1 addition & 1 deletion app/code/core/Mage/Sitemap/Model/Sitemap.php
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ class Mage_Sitemap_Model_Sitemap extends Mage_Core_Model_Abstract
/**
* Real file path
*
* @var string
* @var string|null
*/
protected $_filePath;

Expand Down
2 changes: 1 addition & 1 deletion app/code/core/Zend/Db/Select.php
Original file line number Diff line number Diff line change
Expand Up @@ -758,7 +758,7 @@ public function reset($part = null)
* Gets the Zend_Db_Adapter_Abstract for this
* particular Zend_Db_Select object.
*
* @return Zend_Db_Adapter_Abstract
* @return Varien_Db_Adapter_Interface|Zend_Db_Adapter_Abstract
*/
public function getAdapter()
{
Expand Down
2 changes: 1 addition & 1 deletion lib/Varien/Data/Collection.php
Original file line number Diff line number Diff line change
Expand Up @@ -440,7 +440,7 @@ public function clear()
*
* Returns array with results of callback for each item
*
* @param callable $callback
* @param string|callable $callback
* @param array $args
* @return array
*/
Expand Down
2 changes: 1 addition & 1 deletion lib/Varien/Http/Adapter/Curl.php
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,7 @@ public function write($method, $url, $http_ver = '1.1', $headers = [], $body = '
/**
* Read response from server
*
* @return string
* @return string|bool
*/
public function read()
{
Expand Down
Loading

0 comments on commit ba4bc23

Please sign in to comment.