Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

phpstan: fixed some unknown types #2538

Merged
merged 6 commits into from
Sep 2, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
54 changes: 0 additions & 54 deletions .github/phpstan-baseline.neon
Original file line number Diff line number Diff line change
Expand Up @@ -390,21 +390,6 @@ parameters:
count: 2
path: ../app/code/core/Mage/Adminhtml/Block/System/Config/Form.php

-
message: "#^Access to property \\$sort_order on an unknown class unknown_type\\.$#"
count: 4
path: ../app/code/core/Mage/Adminhtml/Block/System/Config/Tabs.php

-
message: "#^Parameter \\$a of method Mage_Adminhtml_Block_System_Config_Tabs\\:\\:_sort\\(\\) has invalid type unknown_type\\.$#"
count: 1
path: ../app/code/core/Mage/Adminhtml/Block/System/Config/Tabs.php

-
message: "#^Parameter \\$b of method Mage_Adminhtml_Block_System_Config_Tabs\\:\\:_sort\\(\\) has invalid type unknown_type\\.$#"
count: 1
path: ../app/code/core/Mage/Adminhtml/Block/System/Config/Tabs.php

-
message: "#^Access to an undefined property Mage_Adminhtml_Block_System_Convert_Gui_Edit_Tab_Wizard\\:\\:\\$_filterStores\\.$#"
count: 1
Expand Down Expand Up @@ -525,11 +510,6 @@ parameters:
count: 3
path: ../app/code/core/Mage/Adminhtml/Block/Widget/Grid.php

-
message: "#^Parameter \\$action of method Mage_Adminhtml_Block_Widget_Grid_Column_Renderer_Action\\:\\:_toOptionHtml\\(\\) has invalid type unknown_type\\.$#"
count: 1
path: ../app/code/core/Mage/Adminhtml/Block/Widget/Grid/Column/Renderer/Action.php

-
message: "#^Binary operation \"\\*\" between string and 1 results in an error\\.$#"
count: 1
Expand Down Expand Up @@ -575,11 +555,6 @@ parameters:
count: 1
path: ../app/code/core/Mage/Adminhtml/Helper/Catalog/Product/Composite.php

-
message: "#^Property Mage_Adminhtml_Helper_Dashboard_Abstract\\:\\:\\$_collection has unknown class Mage_Core_Model_Mysql_Collection_Abstract as its type\\.$#"
count: 1
path: ../app/code/core/Mage/Adminhtml/Helper/Dashboard/Abstract.php

-
message: "#^Method Mage_Adminhtml_Model_Config\\:\\:getSection\\(\\) should return Varien_Simplexml_Element but return statement is missing\\.$#"
count: 1
Expand Down Expand Up @@ -1730,11 +1705,6 @@ parameters:
count: 1
path: ../app/code/core/Mage/Catalog/Model/Resource/Product/Flat/Indexer.php

-
message: "#^Call to method fetch\\(\\) on an unknown class PDO_Statement\\.$#"
count: 2
path: ../app/code/core/Mage/Catalog/Model/Resource/Product/Indexer/Eav/Source.php

-
message: "#^Binary operation \"\\*\" between string and 0\\.3 results in an error\\.$#"
count: 1
Expand Down Expand Up @@ -1830,11 +1800,6 @@ parameters:
count: 1
path: ../app/code/core/Mage/CatalogIndex/Model/Indexer/Minimalprice.php

-
message: "#^Call to method fetchAll\\(\\) on an unknown class PDO_Statement\\.$#"
count: 1
path: ../app/code/core/Mage/CatalogIndex/Model/Resource/Data/Grouped.php

-
message: "#^Binary operation \"\\*\" between string and float results in an error\\.$#"
count: 1
Expand All @@ -1860,11 +1825,6 @@ parameters:
count: 1
path: ../app/code/core/Mage/CatalogInventory/Model/Resource/Indexer/Stock.php

-
message: "#^Call to method fetch\\(\\) on an unknown class PDO_Statement\\.$#"
count: 1
path: ../app/code/core/Mage/CatalogInventory/Model/Resource/Indexer/Stock.php

-
message: "#^Cannot call method setTypeId\\(\\) on Mage_Core_Model_Resource_Db_Collection_Abstract\\|false\\.$#"
count: 1
Expand Down Expand Up @@ -2950,10 +2910,6 @@ parameters:
count: 1
path: ../app/code/core/Mage/Install/Model/Installer/Db.php

-
message: "#^Property Mage_Install_Model_Installer_Db\\:\\:\\$_dbResource has unknown class database as its type\\.$#"
count: 1
path: ../app/code/core/Mage/Install/Model/Installer/Db.php

-
message: "#^Call to an undefined method Varien_Object\\:\\:addError\\(\\)\\.$#"
Expand Down Expand Up @@ -3355,11 +3311,6 @@ parameters:
count: 2
path: ../app/code/core/Mage/Paypal/Model/Express/Checkout.php

-
message: "#^Property Mage_Paypal_Model_Express_Checkout\\:\\:\\$_order has unknown class Mage_Sales_Model_QuoteMage_Sales_Model_Quote as its type\\.$#"
count: 1
path: ../app/code/core/Mage/Paypal/Model/Express/Checkout.php

-
message: "#^Variable \\$address might not be defined\\.$#"
count: 1
Expand Down Expand Up @@ -3575,11 +3526,6 @@ parameters:
count: 1
path: ../app/code/core/Mage/Reports/Model/Resource/Product/Collection.php

-
message: "#^Call to method fetchAll\\(\\) on an unknown class PDO_Statement\\.$#"
count: 1
path: ../app/code/core/Mage/Reports/Model/Resource/Product/Index/Abstract.php

-
message: "#^Comparison operation \"\\!\\=\" between array\\|int and 0 results in an error\\.$#"
count: 1
Expand Down
4 changes: 2 additions & 2 deletions app/code/core/Mage/Adminhtml/Block/System/Config/Tabs.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,8 @@ protected function _construct()
}

/**
* @param unknown_type $a
* @param unknown_type $b
* @param Mage_Core_Model_Config_Element $a
* @param Mage_Core_Model_Config_Element $b
* @return int
*/
protected function _sort($a, $b)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ public function render(Varien_Object $row)
/**
* Render single action as dropdown option html
*
* @param unknown_type $action
* @param array $action
* @param Varien_Object $row
* @return string
*/
Expand Down
131 changes: 65 additions & 66 deletions app/code/core/Mage/Adminhtml/Helper/Dashboard/Abstract.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,88 +25,87 @@
* @package Mage_Adminhtml
* @author Magento Core Team <core@magentocommerce.com>
*/
abstract class Mage_Adminhtml_Helper_Dashboard_Abstract extends Mage_Core_Helper_Data
{
/**
* Helper collection
*
* @var Mage_Core_Model_Mysql_Collection_Abstract|Mage_Eav_Model_Entity_Collection_Abstract|array
*/
protected $_collection;
abstract class Mage_Adminhtml_Helper_Dashboard_Abstract extends Mage_Core_Helper_Data
{
/**
* Helper collection
*
* @var Mage_Core_Model_Resource_Db_Collection_Abstract|Mage_Eav_Model_Entity_Collection_Abstract|array
*/
protected $_collection;

/**
* Parameters for helper
*
* @var array
*/
protected $_params = [];
/**
* Parameters for helper
*
* @var array
*/
protected $_params = [];

public function getCollection()
{
if(is_null($this->_collection)) {
$this->_initCollection();
}
return $this->_collection;
public function getCollection()
{
if (is_null($this->_collection)) {
$this->_initCollection();
}
return $this->_collection;
}

abstract protected function _initCollection();
abstract protected function _initCollection();

/**
* Returns collection items
*
* @return array
*/
public function getItems()
{
return is_array($this->getCollection()) ? $this->getCollection() : $this->getCollection()->getItems();
}
/**
* Returns collection items
*
* @return array
*/
public function getItems()
{
return is_array($this->getCollection()) ? $this->getCollection() : $this->getCollection()->getItems();
}

public function getCount()
{
return count($this->getItems());
}
public function getCount()
{
return count($this->getItems());
}

public function getColumn($index)
{
$result = [];
foreach ($this->getItems() as $item) {
if (is_array($item)) {
if(isset($item[$index])) {
$result[] = $item[$index];
} else {
$result[] = null;
}
} elseif ($item instanceof Varien_Object) {
$result[] = $item->getData($index);
public function getColumn($index)
{
$result = [];
foreach ($this->getItems() as $item) {
if (is_array($item)) {
if(isset($item[$index])) {
$result[] = $item[$index];
} else {
$result[] = null;
}
} elseif ($item instanceof Varien_Object) {
$result[] = $item->getData($index);
} else {
$result[] = null;
}
return $result;
}

public function setParam($name, $value)
{
$this->_params[$name] = $value;
}
return $result;
}

public function setParams(array $params)
{
$this->_params = $params;
}
public function setParam($name, $value)
{
$this->_params[$name] = $value;
}

public function getParam($name)
{
if(isset($this->_params[$name])) {
return $this->_params[$name];
}
public function setParams(array $params)
{
$this->_params = $params;
}

return null;
public function getParam($name)
{
if(isset($this->_params[$name])) {
return $this->_params[$name];
}

public function getParams()
{
return $this->_params;
}
return null;
}

public function getParams()
{
return $this->_params;
}
}
2 changes: 1 addition & 1 deletion app/code/core/Mage/Install/Model/Installer/Db.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
class Mage_Install_Model_Installer_Db extends Mage_Install_Model_Installer_Abstract
{
/**
* @var database resource
* @var resource database
*/
protected $_dbResource;

Expand Down
2 changes: 1 addition & 1 deletion app/code/core/Mage/Paypal/Model/Express/Checkout.php
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ class Mage_Paypal_Model_Express_Checkout
/**
* Order
*
* @var Mage_Sales_Model_QuoteMage_Sales_Model_Quote
* @var Mage_Sales_Model_Order
*/
protected $_order = null;

Expand Down
2 changes: 1 addition & 1 deletion app/code/core/Mage/PaypalUk/Model/Express/Checkout.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ class Mage_PaypalUk_Model_Express_Checkout extends Mage_Paypal_Model_Express_Che

/**
* Payment method tpye
* @var unknown_type
* @var string
*/
protected $_methodType = Mage_Paypal_Model_Config::METHOD_WPP_PE_EXPRESS;

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 @@ -707,7 +707,7 @@ public function getPart($part)
*
* @param integer $fetchMode OPTIONAL
* @param mixed $bind An array of data to bind to the placeholders.
* @return PDO_Statement|Zend_Db_Statement
* @return Zend_Db_Statement
*/
public function query($fetchMode = null, $bind = array())
{
Expand Down
2 changes: 1 addition & 1 deletion app/code/core/Zend/Db/Statement.php
Original file line number Diff line number Diff line change
Expand Up @@ -466,7 +466,7 @@ public function getAdapter()
/**
* Gets the resource or object setup by the
* _parse
* @return unknown_type
* @return resource|object
*/
public function getDriverStatement()
{
Expand Down
2 changes: 1 addition & 1 deletion app/code/core/Zend/Validate/EmailAddress.php
Original file line number Diff line number Diff line change
Expand Up @@ -324,7 +324,7 @@ public function setDeepMxCheck($deep)
/**
* Returns the set domainCheck option
*
* @return unknown
* @return bool
*/
public function getDomainCheck()
{
Expand Down