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: updated lib/Varien #2795

Merged
merged 1 commit into from
Dec 15, 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
6 changes: 3 additions & 3 deletions app/code/core/Mage/Core/Model/Layout.php
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,7 @@ public function generateXml()
/**
* Create layout blocks hierarchy from layout xml configuration
*
* @param Mage_Core_Model_Layout_Element|null $parent
* @param Mage_Core_Model_Layout_Element|Varien_Simplexml_Element|null $parent
*/
public function generateBlocks($parent = null)
{
Expand Down Expand Up @@ -223,7 +223,7 @@ public function generateBlocks($parent = null)
* Add block object to layout based on xml node data
*
* @param Varien_Simplexml_Element $node
* @param Mage_Core_Model_Layout_Element $parent
* @param Mage_Core_Model_Layout_Element|Varien_Simplexml_Element $parent
* @return $this
*/
protected function _generateBlock($node, $parent)
Expand Down Expand Up @@ -284,7 +284,7 @@ protected function _generateBlock($node, $parent)

/**
* @param Varien_Simplexml_Element $node
* @param Mage_Core_Model_Layout_Element $parent
* @param Mage_Core_Model_Layout_Element|Varien_Simplexml_Element $parent
* @return $this
*/
protected function _generateAction($node, $parent)
Expand Down
1 change: 0 additions & 1 deletion lib/Varien/Cache/Backend/Memcached.php
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,6 @@ protected function _getChunkId($id, $index)
*
* @param string $id ID of data's info cell
* @param int $chunks Number of chunks to remove (basically, the number after '{splitted}|')
* @return null
*/
protected function _cleanTheMess($id, $chunks)
{
Expand Down
3 changes: 1 addition & 2 deletions lib/Varien/Cache/Core.php
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,6 @@ protected function _getChunkId($id, $index)
*
* @param string $id ID of data's info cell
* @param int $chunks Number of chunks to remove (basically, the number after '{splitted}|')
* @return null
*/
protected function _cleanTheMess($id, $chunks)
{
Expand Down Expand Up @@ -166,7 +165,7 @@ public function load($id, $doNotTestCacheValidity = false, $doNotUnserialize = f
// Some chunk in chain was not found, we can not glue-up the data:
// clean the mess and return nothing

$this->_cleanTheMess($id, $chunks);
$this->_cleanTheMess($id, (int)$chunks);
return false;
}

Expand Down
4 changes: 2 additions & 2 deletions lib/Varien/Data/Collection/Db.php
Original file line number Diff line number Diff line change
Expand Up @@ -69,14 +69,14 @@ class Varien_Data_Collection_Db extends Varien_Data_Collection
* All collection data array
* Used for getData method
*
* @var array
* @var array|null
*/
protected $_data = null;

/**
* Fields map for corellation names & real selected fields
*
* @var array
* @var array|null
*/
protected $_map = null;

Expand Down
2 changes: 1 addition & 1 deletion lib/Varien/Data/Collection/Filesystem.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ class Varien_Data_Collection_Filesystem extends Varien_Data_Collection
/**
* Target directory
*
* @var string
* @var array
*/
protected $_targetDirs = [];

Expand Down
2 changes: 1 addition & 1 deletion lib/Varien/Data/Form/Element/Abstract.php
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ public function setType($type)
}

/**
* @param Varien_Data_Form $form
* @param Varien_Data_Form_Abstract $form
* @return $this
*/
public function setForm($form)
Expand Down
6 changes: 3 additions & 3 deletions lib/Varien/Data/Form/Element/Date.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
class Varien_Data_Form_Element_Date extends Varien_Data_Form_Element_Abstract
{
/**
* @var Zend_Date
* @var Zend_Date|string
*/
protected $_value;

Expand Down Expand Up @@ -79,7 +79,7 @@ protected function _toTimestamp($value)
* @param mixed $value
* @param string $format
* @param string $locale
* @return Varien_Data_Form_Element_Date
* @return $this
*/
public function setValue($value, $format = null, $locale = null)
{
Expand Down Expand Up @@ -138,7 +138,7 @@ public function getValue($format = null)
/**
* Get value instance, if any
*
* @return Zend_Date
* @return Zend_Date|string|null
*/
public function getValueInstance()
{
Expand Down
2 changes: 1 addition & 1 deletion lib/Varien/Data/Form/Element/Multiselect.php
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ public function getJsObjectName()

/**
* @param array $option
* @param string $selected
* @param array $selected
* @return string
*/
protected function _optionToHtml($option, $selected)
Expand Down
7 changes: 4 additions & 3 deletions lib/Varien/Data/Form/Element/Select.php
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,9 @@ public function getElementHtml()
if (!is_array($option)) {
$html .= $this->_optionToHtml(
[
'value' => $key,
'label' => $option],
'value' => $key,
'label' => $option
],
$value
);
} elseif (is_array($option['value'])) {
Expand All @@ -83,7 +84,7 @@ public function getElementHtml()

/**
* @param array $option
* @param string $selected
* @param string|array $selected
* @return string
*/
protected function _optionToHtml($option, $selected)
Expand Down
12 changes: 6 additions & 6 deletions lib/Varien/Db/Adapter/Pdo/Mysql.php
Original file line number Diff line number Diff line change
Expand Up @@ -923,7 +923,7 @@ public function tableColumnExists($tableName, $columnName, $schemaName = null)
* @param string $columnName
* @param array|string $definition string specific or universal array DB Server definition
* @param string $schemaName
* @return int|boolean
* @return int|boolean|Zend_Db_Statement_Interface
* @throws Zend_Db_Exception
*/
public function addColumn($tableName, $columnName, $definition, $schemaName = null)
Expand Down Expand Up @@ -965,7 +965,7 @@ public function addColumn($tableName, $columnName, $definition, $schemaName = nu
* @param string $tableName
* @param string $columnName
* @param string $schemaName
* @return bool
* @return true|Zend_Db_Statement_Interface
*/
public function dropColumn($tableName, $columnName, $schemaName = null)
{
Expand Down Expand Up @@ -1088,7 +1088,7 @@ public function modifyColumn($tableName, $columnName, $definition, $flushData =
*
* @param string $tableName
* @param string $schemaName
* @return array|false
* @return bool
*/
public function showTableStatus($tableName, $schemaName = null)
{
Expand Down Expand Up @@ -2250,7 +2250,7 @@ public function newTable($tableName = null, $schemaName = null)
*
* @param Varien_Db_Ddl_Table $table
* @throws Zend_Db_Exception
* @return Zend_Db_Pdo_Statement
* @return Zend_Db_Statement_Pdo
*/
public function createTable(Varien_Db_Ddl_Table $table)
{
Expand Down Expand Up @@ -2282,7 +2282,7 @@ public function createTable(Varien_Db_Ddl_Table $table)
*
* @param Varien_Db_Ddl_Table $table
* @throws Zend_Db_Exception
* @return Zend_Db_Pdo_Statement
* @return Zend_Db_Statement_Pdo
*/
public function createTemporaryTable(Varien_Db_Ddl_Table $table)
{
Expand Down Expand Up @@ -2632,7 +2632,7 @@ public function dropTable($tableName, $schemaName = null)
*
* @param string $tableName
* @param string $schemaName
* @return boolean
* @return $this
*/
public function dropTemporaryTable($tableName, $schemaName = null)
{
Expand Down
4 changes: 2 additions & 2 deletions lib/Varien/Db/Ddl/Table.php
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ class Varien_Db_Ddl_Table
/**
* Name of table
*
* @var string
* @var string|null
*/
protected $_tableName;

Expand Down Expand Up @@ -597,7 +597,7 @@ public function getForeignKeys()
*
* @param string $key
* @param string $value
* @return string
* @return $this
*/
public function setOption($key, $value)
{
Expand Down
10 changes: 2 additions & 8 deletions lib/Varien/Db/Select.php
Original file line number Diff line number Diff line change
Expand Up @@ -397,13 +397,7 @@ protected function _renderStraightjoin($sql)
}

/**
* Adds to the internal table-to-column mapping array.
*
* @param string $correlationName The table/join the columns come from.
* @param array|string $cols The list of columns; preferably as
* an array, but possibly as a string containing one column.
* @param bool|string $afterCorrelationName True if it should be prepended, a correlation name if it should be inserted
* @return void
* @inheritDoc
*/
protected function _tableCols($correlationName, $cols, $afterCorrelationName = null)
{
Expand All @@ -417,7 +411,7 @@ protected function _tableCols($correlationName, $cols, $afterCorrelationName = n
}
}

return parent::_tableCols($correlationName, $cols, $afterCorrelationName);
parent::_tableCols($correlationName, $cols, $afterCorrelationName);
}

/**
Expand Down
10 changes: 4 additions & 6 deletions lib/Varien/Db/Statement/Parameter.php
Original file line number Diff line number Diff line change
Expand Up @@ -47,22 +47,22 @@ class Varien_Db_Statement_Parameter
*/
protected $_isBlob = false;

/*
/**
* Data type to set to DB driver during parameter bind
*/
protected $_dataType = null;

/*
/**
* Length to set to DB driver during parameter bind
*/
protected $_length = null;

/*
/**
* Specific driver options to set to DB driver during parameter bind
*/
protected $_driverOptions = null;

/*
/**
* Additional information to be used by DB adapter internally
*/
protected $_additional = null;
Expand All @@ -71,13 +71,11 @@ class Varien_Db_Statement_Parameter
* Inits instance
*
* @param mixed $value
* @return Varien_Db_Statement_Parameter
*/
public function __construct($value)
{
$this->_value = $value;
$this->_additional = new Varien_Object();
return $this;
}

/**
Expand Down
2 changes: 0 additions & 2 deletions lib/Varien/Db/Tree/Node.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ class Varien_Db_Tree_Node
private $id;
private $pid;
private $level;
private $title;
private $data;

public $hasChild = false;
Expand Down Expand Up @@ -61,7 +60,6 @@ public function __construct($nodeData, $keys)
$this->hasChild = true;
$this->numChild = ($a - 1) / 2;
}
return $this;
}

public function getData($name)
Expand Down
2 changes: 1 addition & 1 deletion lib/Varien/Debug.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ class Varien_Debug
/**
* Magento Root path
*
* @var string
* @var string|null
*/
protected static $_filePath;

Expand Down
2 changes: 1 addition & 1 deletion lib/Varien/Event/Observer.php
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ public function setEventName($data)
}

/**
* @return string
* @return array
*/
public function getCallback()
{
Expand Down
4 changes: 2 additions & 2 deletions lib/Varien/File/Transfer/Adapter/Http.php
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ public function send($options = null)

$response = new Zend_Controller_Response_Http();

$response->setHeader('Content-length', filesize($filepath));
$response->setHeader('Content-length', (string)filesize($filepath));
$response->setHeader('Content-Type', $mimeType);

$response->sendHeaders();
Expand All @@ -107,7 +107,7 @@ public function send($options = null)
* Internal method to detect the mime type of a file
*
* @param array $value File infos
* @return string Mime type of given file
* @return string|null Mime type of given file
*/
protected function _detectMimeType($value)
{
Expand Down
9 changes: 6 additions & 3 deletions lib/Varien/File/Uploader.php
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ class Varien_File_Uploader
/**
* Upload type. Used to right handle $_FILES array.
*
* @var string Varien_File_Uploader::SINGLE_STYLE|Varien_File_Uploader::MULTIPLE_STYLE
* @var int Varien_File_Uploader::SINGLE_STYLE|Varien_File_Uploader::MULTIPLE_STYLE
* @access protected
*/
protected $_uploadType;
Expand Down Expand Up @@ -141,7 +141,7 @@ class Varien_File_Uploader
/**
* Resulting of uploaded file
*
* @var array|false Array with file info keys: path, file. Result is
* @var array|bool Array with file info keys: path, file. Result is
* FALSE when file not uploaded
*/
protected $_result;
Expand Down Expand Up @@ -504,7 +504,10 @@ private function _setUploadFileId($fileId)
} else {
preg_match("/^(.*?)\[(.*?)\]$/", $fileId, $file);

if (count($file) > 0 && (count($file[0]) > 0) && (count($file[1]) > 0)) {
if (count($file) > 0
&& (count($file[0]) > 0)
&& (count($file[1]) > 0)
) {
array_shift($file);
$this->_uploadType = self::MULTIPLE_STYLE;

Expand Down
4 changes: 2 additions & 2 deletions lib/Varien/Filter/Template.php
Original file line number Diff line number Diff line change
Expand Up @@ -273,7 +273,7 @@ protected function _getIncludeParameters($value)
* Return variable value for var construction
*
* @param string $value raw parameters
* @param string $default default value
* @param string|null $default default value
* @return string
*/
protected function _getVariable($value, $default = '{no_value_defined}')
Expand Down Expand Up @@ -327,7 +327,7 @@ protected function _getVariable($value, $default = '{no_value_defined}')
/**
* Retrieve model object
*
* @return Mage_Core_Model_Abstract
* @return Mage_Adminhtml_Model_Email_PathValidator
*/
protected function getEmailPathValidator()
{
Expand Down
4 changes: 2 additions & 2 deletions lib/Varien/Http/Adapter/Curl.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ class Varien_Http_Adapter_Curl implements Zend_Http_Client_Adapter_Interface
/**
* Curl handle
*
* @var resource
* @var resource|CurlHandle|null
*/
protected $_resource;

Expand Down Expand Up @@ -230,7 +230,7 @@ public function close()
/**
* Returns a cURL handle on success
*
* @return resource
* @return resource|CurlHandle
*/
protected function _getResource()
{
Expand Down
Loading