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

Preliminary PHP 8.4 support: Fixed implicitly nullable parameter deprecation warning #4037

Merged
merged 11 commits into from
Jun 27, 2024
2 changes: 2 additions & 0 deletions .php-cs-fixer.dist.php
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,8 @@
'no_trailing_whitespace_in_comment' => true,
// Remove trailing whitespace at the end of blank lines.
'no_whitespace_in_blank_line' => true,
// Adds or removes ? before single type declarations or |null at the end of union types when parameters have a default null value.
'nullable_type_declaration_for_default_null_value' => true,
// Orders the elements of classes/interfaces/traits.
'ordered_class_elements' => false,
// Ordering `use` statements.
Expand Down
4 changes: 2 additions & 2 deletions app/code/core/Mage/Admin/Model/Acl/Assert/Ip.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@ class Mage_Admin_Model_Acl_Assert_Ip implements Zend_Acl_Assert_Interface
*/
public function assert(
Mage_Admin_Model_Acl $acl,
Mage_Admin_Model_Acl_Role $role = null,
Mage_Admin_Model_Acl_Resource $resource = null,
?Mage_Admin_Model_Acl_Role $role = null,
?Mage_Admin_Model_Acl_Resource $resource = null,
$privilege = null
) {
return $this->_isCleanIP(Mage::helper('core/http')->getRemoteAddr());
Expand Down
4 changes: 2 additions & 2 deletions app/code/core/Mage/Admin/Model/Acl/Assert/Time.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@ class Mage_Admin_Model_Acl_Assert_Time implements Zend_Acl_Assert_Interface
*/
public function assert(
Mage_Admin_Model_Acl $acl,
Mage_Admin_Model_Acl_Role $role = null,
Mage_Admin_Model_Acl_Resource $resource = null,
?Mage_Admin_Model_Acl_Role $role = null,
?Mage_Admin_Model_Acl_Resource $resource = null,
$privilege = null
) {
return $this->_isCleanTime(time());
Expand Down
2 changes: 1 addition & 1 deletion app/code/core/Mage/Admin/Model/Redirectpolicy.php
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ public function __construct($parameters = [])
*/
public function getRedirectUrl(
Mage_Admin_Model_User $user,
Zend_Controller_Request_Http $request = null,
?Zend_Controller_Request_Http $request = null,
$alternativeUrl = null
) {
if (empty($request)) {
Expand Down
2 changes: 1 addition & 1 deletion app/code/core/Mage/Admin/Model/Roles.php
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ public function getRoleUsers()
* @return Varien_Simplexml_Element|false|array
*/
protected function _buildResourcesArray(
Varien_Simplexml_Element $resource = null,
?Varien_Simplexml_Element $resource = null,
$parentName = null,
$level = 0,
$represent2Darray = null,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ public function getProduct()
* @param Mage_Catalog_Model_Product|null $product
* @return $this
*/
public function setProduct(Mage_Catalog_Model_Product $product = null)
public function setProduct(?Mage_Catalog_Model_Product $product = null)
{
$this->_product = $product;
return $this;
Expand Down
2 changes: 1 addition & 1 deletion app/code/core/Mage/Adminhtml/Controller/Action.php
Original file line number Diff line number Diff line change
Expand Up @@ -367,7 +367,7 @@ protected function _redirect($path, $arguments = [])
return $this;
}

protected function _forward($action, $controller = null, $module = null, array $params = null)
protected function _forward($action, $controller = null, $module = null, ?array $params = null)
{
$this->_getSession()->setIsUrlNotice($this->getFlag('', self::FLAG_IS_URLS_CHECKED));
return parent::_forward($action, $controller, $module, $params);
Expand Down
2 changes: 1 addition & 1 deletion app/code/core/Mage/Adminhtml/Helper/Config.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ class Mage_Adminhtml_Helper_Config extends Mage_Core_Helper_Abstract
* @param string $inputType
* @return array
*/
public function getInputTypes(string $inputType = null): array
public function getInputTypes(?string $inputType = null): array
{
$inputTypes = [
'color' => [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ protected function _getUrlModel()
return $this->_url;
}

protected function _buildMenuArray(Varien_Simplexml_Element $parent = null, $path = '', $level = 0)
protected function _buildMenuArray(?Varien_Simplexml_Element $parent = null, $path = '', $level = 0)
{
if (is_null($parent)) {
$parent = Mage::getSingleton('admin/config')->getAdminhtmlConfig()->getNode('menu');
Expand Down
4 changes: 2 additions & 2 deletions app/code/core/Mage/Api/Model/Acl/Assert/Ip.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@ class Mage_Api_Model_Acl_Assert_Ip implements Zend_Acl_Assert_Interface
*/
public function assert(
Mage_Api_Model_Acl $acl,
Mage_Api_Model_Acl_Role $role = null,
Mage_Api_Model_Acl_Resource $resource = null,
?Mage_Api_Model_Acl_Role $role = null,
?Mage_Api_Model_Acl_Resource $resource = null,
$privilege = null
) {
return $this->_isCleanIP(Mage::helper('core/http')->getRemoteAddr());
Expand Down
4 changes: 2 additions & 2 deletions app/code/core/Mage/Api/Model/Acl/Assert/Time.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@ class Mage_Api_Model_Acl_Assert_Time implements Zend_Acl_Assert_Interface
*/
public function assert(
Mage_Api_Model_Acl $acl,
Mage_Api_Model_Acl_Role $role = null,
Mage_Api_Model_Acl_Resource $resource = null,
?Mage_Api_Model_Acl_Role $role = null,
?Mage_Api_Model_Acl_Resource $resource = null,
$privilege = null
) {
return $this->_isCleanTime(time());
Expand Down
2 changes: 1 addition & 1 deletion app/code/core/Mage/Api/Model/Roles.php
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ public function getRoleUsers()
* @return array|false|Varien_Simplexml_Element
*/
protected function _buildResourcesArray(
Varien_Simplexml_Element $resource = null,
?Varien_Simplexml_Element $resource = null,
$parentName = null,
$level = 0,
$represent2Darray = null,
Expand Down
2 changes: 1 addition & 1 deletion app/code/core/Mage/Api2/Model/Route/ApiType.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ public function __construct(
$route,
$defaults = [],
$reqs = [],
Zend_Translate $translator = null,
?Zend_Translate $translator = null,
$locale = null
) {
parent::__construct([Mage_Api2_Model_Route_Abstract::PARAM_ROUTE => str_replace('.php', '', basename(getenv('SCRIPT_FILENAME'))) . '/:api_type']);
Expand Down
2 changes: 1 addition & 1 deletion app/code/core/Mage/Catalog/Block/Product/View/Options.php
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ public function getProduct()
* @param Mage_Catalog_Model_Product|null $product
* @return $this
*/
public function setProduct(Mage_Catalog_Model_Product $product = null)
public function setProduct(?Mage_Catalog_Model_Product $product = null)
{
$this->_product = $product;
return $this;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ abstract class Mage_Catalog_Block_Product_View_Options_Abstract extends Mage_Cor
* @param Mage_Catalog_Model_Product|null $product
* @return $this
*/
public function setProduct(Mage_Catalog_Model_Product $product = null)
public function setProduct(?Mage_Catalog_Model_Product $product = null)
{
$this->_product = $product;
return $this;
Expand Down
2 changes: 1 addition & 1 deletion app/code/core/Mage/Catalog/Model/Product/Compare/Item.php
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@ public function bindCustomerLogin()
* @param Varien_Event_Observer|null $observer
* @return $this
*/
public function bindCustomerLogout(Varien_Event_Observer $observer = null)
public function bindCustomerLogout(?Varien_Event_Observer $observer = null)
{
$this->_getResource()->purgeVisitorByCustomer($this);

Expand Down
2 changes: 1 addition & 1 deletion app/code/core/Mage/Catalog/Model/Product/Option.php
Original file line number Diff line number Diff line change
Expand Up @@ -262,7 +262,7 @@ public function getProduct()
* @param Mage_Catalog_Model_Product|null $product
* @return $this
*/
public function setProduct(Mage_Catalog_Model_Product $product = null)
public function setProduct(?Mage_Catalog_Model_Product $product = null)
{
$this->_product = $product;
return $this;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -311,7 +311,7 @@ public function catalogCategorySave(Mage_Index_Model_Event $event)
* @return $this
* @throws Zend_Db_Adapter_Exception
*/
protected function _refreshNotAnchorRootCategories(array $categoryIds = null)
protected function _refreshNotAnchorRootCategories(?array $categoryIds = null)
{
if (empty($categoryIds)) {
return $this;
Expand Down
2 changes: 1 addition & 1 deletion app/code/core/Mage/CatalogIndex/Model/Indexer/Eav.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ protected function _construct()
* @param Mage_Eav_Model_Entity_Attribute_Abstract|null $attribute
* @return array
*/
public function createIndexData(Mage_Catalog_Model_Product $object, Mage_Eav_Model_Entity_Attribute_Abstract $attribute = null)
public function createIndexData(Mage_Catalog_Model_Product $object, ?Mage_Eav_Model_Entity_Attribute_Abstract $attribute = null)
{
$data = [];

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,5 +24,5 @@ interface Mage_CatalogIndex_Model_Indexer_Interface
* @param Mage_Eav_Model_Entity_Attribute_Abstract|null $attribute
* @return mixed
*/
public function createIndexData(Mage_Catalog_Model_Product $object, Mage_Eav_Model_Entity_Attribute_Abstract $attribute = null);
public function createIndexData(Mage_Catalog_Model_Product $object, ?Mage_Eav_Model_Entity_Attribute_Abstract $attribute = null);
}
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ public function getPriceAttribute()
* @param Mage_Eav_Model_Entity_Attribute_Abstract|null $attribute
* @return array|bool
*/
public function createIndexData(Mage_Catalog_Model_Product $object, Mage_Eav_Model_Entity_Attribute_Abstract $attribute = null)
public function createIndexData(Mage_Catalog_Model_Product $object, ?Mage_Eav_Model_Entity_Attribute_Abstract $attribute = null)
{
$searchEntityId = $object->getId();
$priceAttributeId = $this->getTierPriceAttribute()->getId();
Expand Down
2 changes: 1 addition & 1 deletion app/code/core/Mage/CatalogIndex/Model/Indexer/Price.php
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ protected function _construct()
* @param Mage_Eav_Model_Entity_Attribute_Abstract|null $attribute
* @return array
*/
public function createIndexData(Mage_Catalog_Model_Product $object, Mage_Eav_Model_Entity_Attribute_Abstract $attribute = null)
public function createIndexData(Mage_Catalog_Model_Product $object, ?Mage_Eav_Model_Entity_Attribute_Abstract $attribute = null)
{
$data = [];

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ protected function _construct()
* @param Mage_Eav_Model_Entity_Attribute_Abstract|null $attribute
* @return array
*/
public function createIndexData(Mage_Catalog_Model_Product $object, Mage_Eav_Model_Entity_Attribute_Abstract $attribute = null)
public function createIndexData(Mage_Catalog_Model_Product $object, ?Mage_Eav_Model_Entity_Attribute_Abstract $attribute = null)
{
$data = [];

Expand Down
6 changes: 3 additions & 3 deletions app/code/core/Mage/Checkout/Model/Api/Resource.php
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ protected function _getStoreIdFromQuote($quoteId)
* @param array|null $attributes
* @return $this
*/
protected function _updateAttributes($data, $object, $type, array $attributes = null)
protected function _updateAttributes($data, $object, $type, ?array $attributes = null)
{
foreach ($data as $attribute => $value) {
if ($this->_isAllowedAttribute($attribute, $type, $attributes)) {
Expand All @@ -163,7 +163,7 @@ protected function _updateAttributes($data, $object, $type, array $attributes =
* @param array|null $attributes
* @return array
*/
protected function _getAttributes($object, $type, array $attributes = null)
protected function _getAttributes($object, $type, ?array $attributes = null)
{
$result = [];

Expand Down Expand Up @@ -202,7 +202,7 @@ protected function _getAttributes($object, $type, array $attributes = null)
* @param array|null $attributes
* @return bool
*/
protected function _isAllowedAttribute($attributeCode, $type, array $attributes = null)
protected function _isAllowedAttribute($attributeCode, $type, ?array $attributes = null)
{
if (!empty($attributes)
&& !(in_array($attributeCode, $attributes))
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 @@ -613,7 +613,7 @@ public function noCookiesAction()
* @param string|null $module
* @param array|null $params
*/
protected function _forward($action, $controller = null, $module = null, array $params = null)
protected function _forward($action, $controller = null, $module = null, ?array $params = null)
{
$request = $this->getRequest();

Expand Down
2 changes: 1 addition & 1 deletion app/code/core/Mage/Core/Model/Url/Rewrite.php
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,7 @@ public function removeTag($tags)
* @throws Mage_Core_Model_Store_Exception
* @deprecated since 1.7.0.2. Refactored and moved to Mage_Core_Controller_Request_Rewrite
*/
public function rewrite(Zend_Controller_Request_Http $request = null, Zend_Controller_Response_Http $response = null)
public function rewrite(?Zend_Controller_Request_Http $request = null, ?Zend_Controller_Response_Http $response = null)
{
if (!Mage::isInstalled()) {
return false;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ public function setType(Varien_Object $type)
* @param Mage_Customer_Model_Address_Abstract|null $address
* @return string
*/
public function getFormat(Mage_Customer_Model_Address_Abstract $address = null)
public function getFormat(?Mage_Customer_Model_Address_Abstract $address = null)
{
$countryFormat = is_null($address)
? false
Expand Down
4 changes: 2 additions & 2 deletions app/code/core/Mage/Customer/Model/Api/Resource.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ class Mage_Customer_Model_Api_Resource extends Mage_Api_Model_Resource_Abstract
* @param array|null $filter
* @return bool
*/
protected function _isAllowedAttribute($attribute, array $filter = null)
protected function _isAllowedAttribute($attribute, ?array $filter = null)
{
if (!is_null($filter)
&& !(in_array($attribute->getAttributeCode(), $filter)
Expand All @@ -62,7 +62,7 @@ protected function _isAllowedAttribute($attribute, array $filter = null)
* @param array|null $filter
* @return array
*/
public function getAllowedAttributes($entity, array $filter = null)
public function getAllowedAttributes($entity, ?array $filter = null)
{
$attributes = $entity->getResource()
->loadAllAttributes($entity)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ public function setProfile(Mage_Dataflow_Model_Convert_Profile_Interface $profil
return $this;
}

public function addAction(Mage_Dataflow_Model_Convert_Action_Interface $action = null)
public function addAction(?Mage_Dataflow_Model_Convert_Action_Interface $action = null)
{
if (is_null($action)) {
$action = new $this->_actionDefaultClass();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ abstract class Mage_Dataflow_Model_Convert_Profile_Abstract implements Mage_Data

protected $_dataflow_profile = null;

public function addAction(Mage_Dataflow_Model_Convert_Action_Interface $action = null)
public function addAction(?Mage_Dataflow_Model_Convert_Action_Interface $action = null)
{
if (is_null($action)) {
$action = new $this->_actionDefaultClass();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ public function getProfile($name)
return $this->_profiles[$name];
}

public function addProfile($name, Mage_Dataflow_Model_Convert_Profile_Interface $profile = null)
public function addProfile($name, ?Mage_Dataflow_Model_Convert_Profile_Interface $profile = null)
{
if (is_null($profile)) {
$profile = new $this->_profileDefaultClass();
Expand Down
2 changes: 1 addition & 1 deletion app/code/core/Mage/Newsletter/Model/Template.php
Original file line number Diff line number Diff line change
Expand Up @@ -284,7 +284,7 @@ public function getMail()
* @return bool
* @deprecated since 1.4.0.1
**/
public function send($subscriber, array $variables = [], $name = null, Mage_Newsletter_Model_Queue $queue = null)
public function send($subscriber, array $variables = [], $name = null, ?Mage_Newsletter_Model_Queue $queue = null)
{
if (!$this->isValidForSend()) {
return false;
Expand Down
2 changes: 1 addition & 1 deletion app/code/core/Mage/Oauth/Model/Server.php
Original file line number Diff line number Diff line change
Expand Up @@ -658,7 +658,7 @@ public function initiateToken()
* @return string
* @throws Zend_Controller_Response_Exception
*/
public function reportProblem(Exception $e, Zend_Controller_Response_Http $response = null)
public function reportProblem(Exception $e, ?Zend_Controller_Response_Http $response = null)
{
$eMsg = $e->getMessage();

Expand Down
2 changes: 1 addition & 1 deletion app/code/core/Mage/Payment/Model/Recurring/Profile.php
Original file line number Diff line number Diff line change
Expand Up @@ -302,7 +302,7 @@ public function exportScheduleInfo()
* @return $this
* @throws Zend_Date_Exception
*/
public function setNearestStartDatetime(Zend_Date $minAllowed = null)
public function setNearestStartDatetime(?Zend_Date $minAllowed = null)
{
// TODO: implement proper logic with invoking payment method instance
$date = $minAllowed;
Expand Down
2 changes: 1 addition & 1 deletion app/code/core/Mage/Paypal/Model/Config.php
Original file line number Diff line number Diff line change
Expand Up @@ -1178,7 +1178,7 @@ public function getPaymentMarkImageUrl($localeCode, $orderTotal = null, $pal = n
* @param Mage_Core_Model_Locale|null $locale
* @return string
*/
public function getPaymentMarkWhatIsPaypalUrl(Mage_Core_Model_Locale $locale = null)
public function getPaymentMarkWhatIsPaypalUrl(?Mage_Core_Model_Locale $locale = null)
{
$countryCode = 'US';
if ($locale !== null) {
Expand Down
2 changes: 1 addition & 1 deletion app/code/core/Mage/Paypal/Model/Info.php
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,7 @@ public function importToPayment($from, Mage_Payment_Model_Info $payment)
* @param array|null $map
* @return array|Varien_Object
*/
public function &exportFromPayment(Mage_Payment_Model_Info $payment, $to, array $map = null)
public function &exportFromPayment(Mage_Payment_Model_Info $payment, $to, ?array $map = null)
{
$fullMap = array_merge($this->_paymentMap, $this->_systemMap);
Varien_Object_Mapper::accumulateByMap(
Expand Down
2 changes: 1 addition & 1 deletion app/code/core/Mage/Paypal/Model/Ipn.php
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ public function getRequestData($key = null)
* @param Zend_Http_Client_Adapter_Interface|null $httpAdapter
* @throws Mage_Core_Exception
*/
public function processIpnRequest(array $request, Zend_Http_Client_Adapter_Interface $httpAdapter = null)
public function processIpnRequest(array $request, ?Zend_Http_Client_Adapter_Interface $httpAdapter = null)
{
$this->_request = $request;
$this->_debugData = ['ipn' => $request];
Expand Down
2 changes: 1 addition & 1 deletion app/code/core/Mage/Reports/Model/Resource/Event.php
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ public function applyLogToCollection(
* @return array
* @throws Mage_Core_Model_Store_Exception
*/
public function getCurrentStoreIds(array $predefinedStoreIds = null)
public function getCurrentStoreIds(?array $predefinedStoreIds = null)
{
$stores = [];
// get all or specified stores
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ public function setStoreFilter($storeId)
* @param null|Zend_Db_Select $select
* @return $this
*/
protected function _applyStoresFilterToSelect(Zend_Db_Select $select = null)
protected function _applyStoresFilterToSelect(?Zend_Db_Select $select = null)
{
$adapter = $this->getConnection();
$storesIds = $this->_storesIds;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ protected function _getAssociatedEntityInfo($entityType)
* @deprecated after 1.6.2.0
*
*/
public function setEnv(Mage_Rule_Model_Environment $env = null)
public function setEnv(?Mage_Rule_Model_Environment $env = null)
{
$this->_env = $env;
return $this;
Expand Down
Loading
Loading