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

Fix PHP8 Deprecated: Required parameter $A follows optional parameter #1392

Merged
merged 2 commits into from
May 23, 2021
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
8 changes: 4 additions & 4 deletions app/code/core/Mage/Adminhtml/Block/Widget/Container.php
Original file line number Diff line number Diff line change
Expand Up @@ -131,11 +131,11 @@ public function removeButton($id)
* Update specified button property
*
* @param string $id
* @param string|null $key
* @param string $key
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it still accepts null as a param for this

* @param mixed $data
* @return $this
*/
protected function _updateButton($id, $key=null, $data)
protected function _updateButton($id, $key, $data)
{
foreach ($this->_buttons as $level => $buttons) {
if (isset($buttons[$id])) {
Expand All @@ -162,11 +162,11 @@ protected function _updateButton($id, $key=null, $data)
* Public wrapper for protected _updateButton method
*
* @param string $id
* @param string|null $key
* @param string $key
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it still accepts null as a param here

* @param mixed $data
* @return $this
*/
public function updateButton($id, $key=null, $data)
public function updateButton($id, $key, $data)
{
return $this->_updateButton($id, $key, $data);
}
Expand Down
12 changes: 6 additions & 6 deletions app/code/core/Mage/Bundle/Model/Product/Price.php
Original file line number Diff line number Diff line change
Expand Up @@ -117,11 +117,11 @@ public function getTotalBundleItemsPrice($product, $qty = null)
/**
* Get product final price
*
* @param double $qty
* @param Mage_Catalog_Model_Product $product
* @param float|null $qty
* @param Mage_Catalog_Model_Product $product
* @return double
*/
public function getFinalPrice($qty = null, $product)
public function getFinalPrice($qty, $product)
{
if (is_null($qty) && !is_null($product->getCalculatedFinalPrice())) {
return $product->getCalculatedFinalPrice();
Expand Down Expand Up @@ -688,11 +688,11 @@ protected function _applyTierPrice($product, $qty, $finalPrice)
/**
* Get product tier price by qty
*
* @param float $qty
* @param Mage_Catalog_Model_Product $product
* @param float|null $qty
* @param Mage_Catalog_Model_Product $product
* @return float|array
*/
public function getTierPrice($qty = null, $product)
public function getTierPrice($qty, $product)
{
$allGroups = Mage_Customer_Model_Group::CUST_GROUP_ALL;
$prices = $product->getData('tier_price');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,11 +36,11 @@ class Mage_Catalog_Model_Product_Type_Configurable_Price extends Mage_Catalog_Mo
/**
* Get product final price
*
* @param double $qty
* @param Mage_Catalog_Model_Product $product
* @param float|null $qty
* @param Mage_Catalog_Model_Product $product
* @return double
*/
public function getFinalPrice($qty = null, $product)
public function getFinalPrice($qty, $product)
{
if (is_null($qty) && !is_null($product->getCalculatedFinalPrice())) {
return $product->getCalculatedFinalPrice();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,11 +36,11 @@ class Mage_Catalog_Model_Product_Type_Grouped_Price extends Mage_Catalog_Model_P
/**
* Returns product final price depending on options chosen
*
* @param double $qty
* @param Mage_Catalog_Model_Product $product
* @param float|null $qty
* @param Mage_Catalog_Model_Product $product
* @return double
*/
public function getFinalPrice($qty = null, $product)
public function getFinalPrice($qty, $product)
{
if (is_null($qty) && !is_null($product->getCalculatedFinalPrice())) {
return $product->getCalculatedFinalPrice();
Expand Down
14 changes: 7 additions & 7 deletions app/code/core/Mage/Catalog/Model/Product/Type/Price.php
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ public function getBasePrice($product, $qty = null)
* @param Mage_Catalog_Model_Product $product
* @return float
*/
public function getFinalPrice($qty = null, $product)
public function getFinalPrice($qty, $product)
{
if (is_null($qty) && !is_null($product->getCalculatedFinalPrice())) {
return $product->getCalculatedFinalPrice();
Expand Down Expand Up @@ -181,11 +181,11 @@ protected function _applyTierPrice($product, $qty, $finalPrice)
/**
* Get product tier price by qty
*
* @param float $qty
* @param Mage_Catalog_Model_Product $product
* @param float|null $qty
* @param Mage_Catalog_Model_Product $product
* @return float|array
*/
public function getTierPrice($qty = null, $product)
public function getTierPrice($qty, $product)
{
$allGroups = Mage_Customer_Model_Group::CUST_GROUP_ALL;
$prices = $product->getData('tier_price');
Expand Down Expand Up @@ -307,11 +307,11 @@ public function getTierPriceCount($product)
/**
* Get formatted by currency tier price
*
* @param float $qty
* @param Mage_Catalog_Model_Product $product
* @param float|null $qty
* @param Mage_Catalog_Model_Product $product
* @return array|float
*/
public function getFormatedTierPrice($qty = null, $product)
public function getFormatedTierPrice($qty, $product)
{
$price = $product->getTierPrice($qty);
if (is_array($price)) {
Expand Down
2 changes: 1 addition & 1 deletion app/code/core/Mage/Centinel/Model/Api/Client.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
*/
class Mage_Centinel_Model_Api_Client extends CentinelClient
{
public function sendHttp($url, $connectTimeout = "", $timeout)
public function sendHttp($url, $connectTimeout, $timeout)
{
// verify that the URL uses a supported protocol.
if ((strpos($url, "http://") === 0) || (strpos($url, "https://") === 0)) {
Expand Down
4 changes: 2 additions & 2 deletions app/code/core/Mage/ConfigurableSwatches/Helper/Productimg.php
Original file line number Diff line number Diff line change
Expand Up @@ -178,8 +178,8 @@ public function indexProductImages($product, $preValues = null)
public function getSwatchUrl(
$product,
$value,
$width = self::SWATCH_DEFAULT_WIDTH,
$height = self::SWATCH_DEFAULT_HEIGHT,
$width,
$height,
&$swatchType,
$fallbackFileExt = null
) {
Expand Down
2 changes: 1 addition & 1 deletion app/code/core/Mage/Core/Model/Locale.php
Original file line number Diff line number Diff line change
Expand Up @@ -575,7 +575,7 @@ public function storeDate($store = null, $date = null, $includeTime = false, $fo
* @param null|string $format
* @return Zend_Date
*/
public function utcDate($store = null, $date, $includeTime = false, $format = null)
public function utcDate($store, $date, $includeTime = false, $format = null)
{
$dateObj = $this->storeDate($store, $date, $includeTime);
$dateObj->set($date, $format);
Expand Down
4 changes: 2 additions & 2 deletions app/code/core/Mage/Downloadable/Model/Product/Price.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,11 +36,11 @@ class Mage_Downloadable_Model_Product_Price extends Mage_Catalog_Model_Product_T
/**
* Retrieve product final price
*
* @param integer $qty
* @param integer|null $qty
* @param Mage_Catalog_Model_Product $product
* @return float
*/
public function getFinalPrice($qty = null, $product)
public function getFinalPrice($qty, $product)
{
if (is_null($qty) && !is_null($product->getCalculatedFinalPrice())) {
return $product->getCalculatedFinalPrice();
Expand Down
2 changes: 1 addition & 1 deletion app/code/core/Mage/Eav/Model/Convert/Adapter/Entity.php
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,7 @@ public function getFilter()
* @param string $name
* @return array|bool
*/
protected function getFieldValue($fields = array(), $name)
protected function getFieldValue($fields = array(), $name = '')
{
$result = array();
if ($fields && $name) {
Expand Down
8 changes: 4 additions & 4 deletions app/code/core/Mage/Rule/Model/Resource/Abstract.php
Original file line number Diff line number Diff line change
Expand Up @@ -197,16 +197,16 @@ public function bindRuleToEntity($ruleIds, $entityIds, $entityType, $deleteOldRe
*
* @return Mage_Rule_Model_Resource_Abstract
*/
public function unbindRuleFromEntity($ruleIds = array(), $entityIds = array(), $entityType)
public function unbindRuleFromEntity($ruleIds, $entityIds, $entityType)
{
$writeAdapter = $this->_getWriteAdapter();
$entityInfo = $this->_getAssociatedEntityInfo($entityType);
$entityInfo = $this->_getAssociatedEntityInfo($entityType);

if (!is_array($entityIds)) {
$entityIds = array((int) $entityIds);
$entityIds = array((int)$entityIds);
}
if (!is_array($ruleIds)) {
$ruleIds = array((int) $ruleIds);
$ruleIds = array((int)$ruleIds);
}

$where = array();
Expand Down
4 changes: 2 additions & 2 deletions app/code/core/Mage/Sales/Model/Quote.php
Original file line number Diff line number Diff line change
Expand Up @@ -1681,7 +1681,7 @@ public function addErrorInfo($type = 'error', $origin = null, $code = null, $mes
* @param array $params
* @return $this
*/
public function removeErrorInfosByParams($type = 'error', $params)
public function removeErrorInfosByParams($type, $params)
{
if ($type && !isset($this->_errorInfoGroups[$type])) {
return $this;
Expand Down Expand Up @@ -1724,7 +1724,7 @@ public function removeErrorInfosByParams($type = 'error', $params)
* @param string $text
* @return $this
*/
public function removeMessageByText($type = 'error', $text)
public function removeMessageByText($type, $text)
{
$messages = $this->getData('messages');
if (is_null($messages)) {
Expand Down
6 changes: 3 additions & 3 deletions app/code/core/Mage/Tag/Model/Tag/Relation.php
Original file line number Diff line number Diff line change
Expand Up @@ -103,13 +103,13 @@ public function afterCommitCallback()
/**
* Load relation by Product (optional), tag, customer and store
*
* @param int $productId
* @param int|null $productId
* @param int $tagId
* @param int $customerId
* @param int $storeId
* @param int|null $storeId
* @return $this
*/
public function loadByTagCustomer($productId = null, $tagId, $customerId, $storeId = null)
public function loadByTagCustomer($productId, $tagId, $customerId, $storeId = null)
{
$this->setProductId($productId);
$this->setTagId($tagId);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ class Login extends Form
* @param Mapper $mapper
* @param BrowserInterface $browser
* @param SequenceSorterInterface $sequenceSorter
* @param array $config [optional]
* @param array $config
* @param Dashboard $dashboard
*/
public function __construct(
Expand All @@ -70,7 +70,7 @@ public function __construct(
Mapper $mapper,
BrowserInterface $browser,
SequenceSorterInterface $sequenceSorter,
array $config = [],
array $config,
Dashboard $dashboard
) {
parent::__construct($element, $blockFactory, $mapper, $browser, $sequenceSorter, $config);
Expand Down
84 changes: 43 additions & 41 deletions lib/3Dsecure/CentinelClient.php
Original file line number Diff line number Diff line change
Expand Up @@ -48,61 +48,63 @@ function getValue($name) {
}


/////////////////////////////////////////////////////////////////////////////////////////////
// Function getRequestXml(name)
//
// Serialize all elements of the request collection into a XML message, and format the required
// form payload according to the Centinel XML Message APIs. The form payload is returned from
// the function.
/////////////////////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////////////////////
// Function getRequestXml(name)
//
// Serialize all elements of the request collection into a XML message, and format the required
// form payload according to the Centinel XML Message APIs. The form payload is returned from
// the function.
/////////////////////////////////////////////////////////////////////////////////////////////


function getRequestXml(){
$queryString = "<CardinalMPI>";
foreach ($this->request as $name => $value) {
$queryString = $queryString."<".($name).">".($value)."</".($name).">" ;
}
$queryString = $queryString."</CardinalMPI>";
return "cmpi_msg=".urlencode($queryString);
}
function getRequestXml()
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

unrelated style change

{
$queryString = "<CardinalMPI>";
foreach ($this->request as $name => $value) {
$queryString = $queryString . "<" . ($name) . ">" . ($value) . "</" . ($name) . ">";
}
$queryString = $queryString . "</CardinalMPI>";
return "cmpi_msg=" . urlencode($queryString);
}

/////////////////////////////////////////////////////////////////////////////////////////////
// Function sendHttp(url, "", $timeout)
//
// HTTP POST the form payload to the url using cURL.
// form payload according to the Centinel XML Message APIs. The form payload is returned from
// the function.
/////////////////////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////////////////////
// Function sendHttp(url, "", $timeout)
//
// HTTP POST the form payload to the url using cURL.
// form payload according to the Centinel XML Message APIs. The form payload is returned from
// the function.
/////////////////////////////////////////////////////////////////////////////////////////////

function sendHttp($url, $connectTimeout="", $timeout) {
function sendHttp($url, $connectTimeout, $timeout)
{

// verify that the URL uses a supported protocol.
// verify that the URL uses a supported protocol.

if( (strpos($url, "http://")=== 0) || (strpos($url, "https://")=== 0) ) {
if ((strpos($url, "http://") === 0) || (strpos($url, "https://") === 0)) {

//Construct the payload to POST to the url.
//Construct the payload to POST to the url.

$data = $this->getRequestXml();
// create a new cURL resource
$data = $this->getRequestXml();
// create a new cURL resource

$ch = curl_init($url);
$ch = curl_init($url);

// set URL and other appropriate options
curl_setopt($ch, CURLOPT_POST,1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 2);
curl_setopt($ch, CURLOPT_RETURNTRANSFER,1);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE);
curl_setopt($ch, CURLOPT_TIMEOUT, $timeout);
// set URL and other appropriate options
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 2);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE);
curl_setopt($ch, CURLOPT_TIMEOUT, $timeout);

// Execute the request.
// Execute the request.

$result = curl_exec($ch);
$succeeded = curl_errno($ch) == 0 ? true : false;
$result = curl_exec($ch);
$succeeded = curl_errno($ch) == 0 ? true : false;

// close cURL resource, and free up system resources
// close cURL resource, and free up system resources

curl_close($ch);
curl_close($ch);

// If Communication was not successful set error result, otherwise

Expand Down
2 changes: 1 addition & 1 deletion lib/Varien/Data/Tree.php
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ public function loadNode($nodeId)
* @param Varien_Data_Tree_Node $prevNode
* @return Varien_Data_Tree_Node
*/
public function appendChild($data=array(), $parentNode, $prevNode=null)
public function appendChild($data, $parentNode, $prevNode = null)
{
if (is_array($data)) {
$node = $this->addNode(
Expand Down
10 changes: 5 additions & 5 deletions lib/Varien/Data/Tree/Db.php
Original file line number Diff line number Diff line change
Expand Up @@ -191,16 +191,16 @@ public function loadNode($nodeId)
* @return Varien_Data_Tree_Node
* @throws Zend_Db_Adapter_Exception
*/
public function appendChild($data=array(), $parentNode, $prevNode=null)
public function appendChild($data, $parentNode, $prevNode = null)
{
$orderSelect = $this->_conn->select();
$orderSelect->from($this->_table, new Zend_Db_Expr('MAX('.$this->_conn->quoteIdentifier($this->_orderField).')'))
->where($this->_conn->quoteIdentifier($this->_parentField).'='.$parentNode->getId());
$orderSelect->from($this->_table, new Zend_Db_Expr('MAX(' . $this->_conn->quoteIdentifier($this->_orderField) . ')'))
->where($this->_conn->quoteIdentifier($this->_parentField) . '=' . $parentNode->getId());

$order = $this->_conn->fetchOne($orderSelect);
$data[$this->_parentField] = $parentNode->getId();
$data[$this->_levelField] = $parentNode->getData($this->_levelField)+1;
$data[$this->_orderField] = $order+1;
$data[$this->_levelField] = $parentNode->getData($this->_levelField) + 1;
$data[$this->_orderField] = $order + 1;

$this->_conn->insert($this->_table, $data);
$data[$this->_idField] = $this->_conn->lastInsertId();
Expand Down
Loading