From 3b64e8cb54aeefe52f134019f5d3570a941762b4 Mon Sep 17 00:00:00 2001 From: Serge Rodovnichenko Date: Sat, 5 Apr 2025 02:08:56 +0300 Subject: [PATCH 1/2] fix 8.4 deprecations in framework system classes --- wa-system/api/waAPIRightsMethod.class.php | 2 +- wa-system/contact/waContactAddressField.class.php | 2 +- wa-system/contact/waContactBirthdayField.class.php | 2 +- wa-system/contact/waContactField.class.php | 2 +- wa-system/contact/waContactNameField.class.php | 2 +- wa-system/controller/waViewAction.class.php | 2 +- wa-system/controller/waViewController.class.php | 2 +- wa-system/database/waModel.class.php | 2 +- wa-system/layout/waLayout.class.php | 2 +- wa-system/mail/waMail.class.php | 2 +- wa-system/payment/waAppPayment.class.php | 2 +- wa-system/payment/waPayment.class.php | 4 ++-- wa-system/shipping/waShipping.class.php | 4 ++-- wa-system/waSystem.class.php | 2 +- wa-system/webasyst/lib/config/webasystConfig.class.php | 2 +- 15 files changed, 17 insertions(+), 17 deletions(-) diff --git a/wa-system/api/waAPIRightsMethod.class.php b/wa-system/api/waAPIRightsMethod.class.php index 7122e3f67..bd9fcdd19 100644 --- a/wa-system/api/waAPIRightsMethod.class.php +++ b/wa-system/api/waAPIRightsMethod.class.php @@ -12,7 +12,7 @@ public function execute() $this->response = self::getAppRights($this->app); } - public static function getAppRights($app_id, waContact $contact = null) + public static function getAppRights($app_id, ?waContact $contact = null) { $contact = ifset($contact, wa()->getUser()); /** diff --git a/wa-system/contact/waContactAddressField.class.php b/wa-system/contact/waContactAddressField.class.php index 39c03b748..e147f2e2d 100644 --- a/wa-system/contact/waContactAddressField.class.php +++ b/wa-system/contact/waContactAddressField.class.php @@ -107,7 +107,7 @@ private function setGeoCoords($value) return $value; } - public function prepareSave($value, waContact $contact = null) + public function prepareSave($value, ?waContact $contact = null) { if (isset($value[0])) { foreach ($value as &$v) { diff --git a/wa-system/contact/waContactBirthdayField.class.php b/wa-system/contact/waContactBirthdayField.class.php index ca03ef712..382830cbf 100644 --- a/wa-system/contact/waContactBirthdayField.class.php +++ b/wa-system/contact/waContactBirthdayField.class.php @@ -125,7 +125,7 @@ public function set(waContact $contact, $value, $params = array(), $add = false) return $value; } - public function prepareSave($value, waContact $contact = null) + public function prepareSave($value, ?waContact $contact = null) { $prefix = $this->options['prefix']; if (is_string($value)) { diff --git a/wa-system/contact/waContactField.class.php b/wa-system/contact/waContactField.class.php index 69b714a87..619d71621 100644 --- a/wa-system/contact/waContactField.class.php +++ b/wa-system/contact/waContactField.class.php @@ -883,7 +883,7 @@ public static function __set_state($state) return new $state['_type']($state['id'], $state['name'], $state['options']); } - public function prepareSave($value, waContact $contact = null) + public function prepareSave($value, ?waContact $contact = null) { return $value; } diff --git a/wa-system/contact/waContactNameField.class.php b/wa-system/contact/waContactNameField.class.php index a46c1fa52..7372df4bc 100644 --- a/wa-system/contact/waContactNameField.class.php +++ b/wa-system/contact/waContactNameField.class.php @@ -50,7 +50,7 @@ public function get(waContact $contact, $format = null) return $this->format($name, $format); } - public function prepareSave($value, waContact $contact = null) { + public function prepareSave($value, ?waContact $contact = null) { if (!$contact) { return $value; diff --git a/wa-system/controller/waViewAction.class.php b/wa-system/controller/waViewAction.class.php index a6f2f7dd8..fdfea1193 100644 --- a/wa-system/controller/waViewAction.class.php +++ b/wa-system/controller/waViewAction.class.php @@ -104,7 +104,7 @@ public function getController() return $this->controller; } - public function setLayout(waLayout $layout = null) + public function setLayout(?waLayout $layout = null) { if ($this->controller !== null && $this->controller instanceof waViewController) { $this->controller->setLayout($layout); diff --git a/wa-system/controller/waViewController.class.php b/wa-system/controller/waViewController.class.php index 7590faa8e..6cf91642a 100644 --- a/wa-system/controller/waViewController.class.php +++ b/wa-system/controller/waViewController.class.php @@ -31,7 +31,7 @@ public function __construct() * * @param waLayout $layout */ - public function setLayout(waLayout $layout=null) + public function setLayout(?waLayout $layout=null) { $this->layout = $layout; } diff --git a/wa-system/database/waModel.class.php b/wa-system/database/waModel.class.php index fa91d47c4..47e2835bb 100644 --- a/wa-system/database/waModel.class.php +++ b/wa-system/database/waModel.class.php @@ -233,7 +233,7 @@ public function rollback() * Set cache * @param waiCache $cache */ - public function setCache(waiCache $cache = null) + public function setCache(?waiCache $cache = null) { $this->cache = $cache; } diff --git a/wa-system/layout/waLayout.class.php b/wa-system/layout/waLayout.class.php index 4987c6685..c967c502c 100644 --- a/wa-system/layout/waLayout.class.php +++ b/wa-system/layout/waLayout.class.php @@ -73,7 +73,7 @@ public function setBlock($name, $content) * @param waViewAction $action * @param waDecorator $decorator */ - public function executeAction($name, $action, waDecorator $decorator = null) + public function executeAction($name, $action, ?waDecorator $decorator = null) { $action->setLayout($this); $content = $decorator ? $decorator->display($action) : $action->display(); diff --git a/wa-system/mail/waMail.class.php b/wa-system/mail/waMail.class.php index aa64d27d4..5acab6dad 100644 --- a/wa-system/mail/waMail.class.php +++ b/wa-system/mail/waMail.class.php @@ -7,7 +7,7 @@ class waMail extends Swift_Mailer protected static $wa_config = array(); private $wa_set_transport = false; - public function __construct(Swift_Transport $transport = null) + public function __construct(?Swift_Transport $transport = null) { if (!$transport) { $transport = Swift_MailTransport::newInstance(); diff --git a/wa-system/payment/waAppPayment.class.php b/wa-system/payment/waAppPayment.class.php index 76afd00ab..cba7afff9 100644 --- a/wa-system/payment/waAppPayment.class.php +++ b/wa-system/payment/waAppPayment.class.php @@ -229,7 +229,7 @@ public function uninstall($plugin_id) } /** @since 3.2.0 */ - public function declareFiscalization($order_id, waPayment $plugin, array $custom_data = null) + public function declareFiscalization($order_id, waPayment $plugin, ?array $custom_data = null) { ; } diff --git a/wa-system/payment/waPayment.class.php b/wa-system/payment/waPayment.class.php index 1aedc7890..bbfc59dd7 100644 --- a/wa-system/payment/waPayment.class.php +++ b/wa-system/payment/waPayment.class.php @@ -973,12 +973,12 @@ public static function settingCurrencySelect() } /** - * @param waOrder $order + * @param waOrder|null $order * @return array[string]array * @return array[string]['name']string Printable form name * @return array[string]['description']string Printable form description */ - public function getPrintForms(waOrder $order = null) + public function getPrintForms(?waOrder $order = null) { return array(); } diff --git a/wa-system/shipping/waShipping.class.php b/wa-system/shipping/waShipping.class.php index e39f4d950..cd333406f 100644 --- a/wa-system/shipping/waShipping.class.php +++ b/wa-system/shipping/waShipping.class.php @@ -510,7 +510,7 @@ public function setPackageState(waOrder $order, $state, $params = array()) * @param array $params * @return array */ - public function getStateFields($state, waOrder $order = null, $params = array()) + public function getStateFields($state, ?waOrder $order = null, $params = array()) { $this->addItems($order->items); $this->setAddress($order->shipping_address); @@ -569,7 +569,7 @@ protected function readyPackage(waOrder $order, $shipping_data = array()) * @return array[string]['name']string printform's name * @return array[string]['description']string printform's description */ - public function getPrintForms(waOrder $order = null) + public function getPrintForms(?waOrder $order = null) { return array(); } diff --git a/wa-system/waSystem.class.php b/wa-system/waSystem.class.php index d031d63c7..e95bbb39a 100644 --- a/wa-system/waSystem.class.php +++ b/wa-system/waSystem.class.php @@ -72,7 +72,7 @@ public function getConfig() * @throws waException * @see wa() */ - public static function getInstance($name = null, waSystemConfig $config = null, $set_current = false) + public static function getInstance($name = null, ?waSystemConfig $config = null, $set_current = false) { if ($name === null) { if ($config && $config instanceof waAppConfig) { diff --git a/wa-system/webasyst/lib/config/webasystConfig.class.php b/wa-system/webasyst/lib/config/webasystConfig.class.php index c7091c3b1..4f98eb891 100644 --- a/wa-system/webasyst/lib/config/webasystConfig.class.php +++ b/wa-system/webasyst/lib/config/webasystConfig.class.php @@ -40,7 +40,7 @@ public function onCount() return $counts; } - public function initUserWidgets($force = false, waContact $contact = null) + public function initUserWidgets($force = false, ?waContact $contact = null) { if (!$contact) { $contact = wa()->getUser(); From 6274c021b578ee509d640c25d6a883614b786840 Mon Sep 17 00:00:00 2001 From: Serge Rodovnichenko Date: Sat, 5 Apr 2025 02:08:56 +0300 Subject: [PATCH 2/2] fix 8.4 deprecations in framework system classes --- wa-system/api/waAPIRightsMethod.class.php | 2 +- wa-system/contact/waContactAddressField.class.php | 2 +- wa-system/contact/waContactBirthdayField.class.php | 2 +- wa-system/contact/waContactField.class.php | 2 +- wa-system/contact/waContactNameField.class.php | 2 +- wa-system/controller/waViewAction.class.php | 2 +- wa-system/controller/waViewController.class.php | 6 +++--- wa-system/database/waModel.class.php | 2 +- wa-system/layout/waLayout.class.php | 2 +- wa-system/mail/waMail.class.php | 2 +- wa-system/payment/waAppPayment.class.php | 2 +- wa-system/payment/waPayment.class.php | 4 ++-- wa-system/shipping/waShipping.class.php | 4 ++-- wa-system/waSystem.class.php | 2 +- wa-system/webasyst/lib/config/webasystConfig.class.php | 2 +- 15 files changed, 19 insertions(+), 19 deletions(-) diff --git a/wa-system/api/waAPIRightsMethod.class.php b/wa-system/api/waAPIRightsMethod.class.php index 7122e3f67..bd9fcdd19 100644 --- a/wa-system/api/waAPIRightsMethod.class.php +++ b/wa-system/api/waAPIRightsMethod.class.php @@ -12,7 +12,7 @@ public function execute() $this->response = self::getAppRights($this->app); } - public static function getAppRights($app_id, waContact $contact = null) + public static function getAppRights($app_id, ?waContact $contact = null) { $contact = ifset($contact, wa()->getUser()); /** diff --git a/wa-system/contact/waContactAddressField.class.php b/wa-system/contact/waContactAddressField.class.php index 39c03b748..e147f2e2d 100644 --- a/wa-system/contact/waContactAddressField.class.php +++ b/wa-system/contact/waContactAddressField.class.php @@ -107,7 +107,7 @@ private function setGeoCoords($value) return $value; } - public function prepareSave($value, waContact $contact = null) + public function prepareSave($value, ?waContact $contact = null) { if (isset($value[0])) { foreach ($value as &$v) { diff --git a/wa-system/contact/waContactBirthdayField.class.php b/wa-system/contact/waContactBirthdayField.class.php index ca03ef712..382830cbf 100644 --- a/wa-system/contact/waContactBirthdayField.class.php +++ b/wa-system/contact/waContactBirthdayField.class.php @@ -125,7 +125,7 @@ public function set(waContact $contact, $value, $params = array(), $add = false) return $value; } - public function prepareSave($value, waContact $contact = null) + public function prepareSave($value, ?waContact $contact = null) { $prefix = $this->options['prefix']; if (is_string($value)) { diff --git a/wa-system/contact/waContactField.class.php b/wa-system/contact/waContactField.class.php index 69b714a87..619d71621 100644 --- a/wa-system/contact/waContactField.class.php +++ b/wa-system/contact/waContactField.class.php @@ -883,7 +883,7 @@ public static function __set_state($state) return new $state['_type']($state['id'], $state['name'], $state['options']); } - public function prepareSave($value, waContact $contact = null) + public function prepareSave($value, ?waContact $contact = null) { return $value; } diff --git a/wa-system/contact/waContactNameField.class.php b/wa-system/contact/waContactNameField.class.php index a46c1fa52..7372df4bc 100644 --- a/wa-system/contact/waContactNameField.class.php +++ b/wa-system/contact/waContactNameField.class.php @@ -50,7 +50,7 @@ public function get(waContact $contact, $format = null) return $this->format($name, $format); } - public function prepareSave($value, waContact $contact = null) { + public function prepareSave($value, ?waContact $contact = null) { if (!$contact) { return $value; diff --git a/wa-system/controller/waViewAction.class.php b/wa-system/controller/waViewAction.class.php index a6f2f7dd8..fdfea1193 100644 --- a/wa-system/controller/waViewAction.class.php +++ b/wa-system/controller/waViewAction.class.php @@ -104,7 +104,7 @@ public function getController() return $this->controller; } - public function setLayout(waLayout $layout = null) + public function setLayout(?waLayout $layout = null) { if ($this->controller !== null && $this->controller instanceof waViewController) { $this->controller->setLayout($layout); diff --git a/wa-system/controller/waViewController.class.php b/wa-system/controller/waViewController.class.php index 7590faa8e..eba71ab35 100644 --- a/wa-system/controller/waViewController.class.php +++ b/wa-system/controller/waViewController.class.php @@ -31,7 +31,7 @@ public function __construct() * * @param waLayout $layout */ - public function setLayout(waLayout $layout=null) + public function setLayout(?waLayout $layout=null) { $this->layout = $layout; } @@ -77,7 +77,7 @@ public function getLayout() * @param waDecorator $decorator * @param string $name */ - public function executeAction(waViewAction $action, $name = 'content', waDecorator $decorator = null) + public function executeAction(waViewAction $action, $name = 'content', ?waDecorator $decorator = null) { $action->setController($this); if ($action->getLayout()) { @@ -118,4 +118,4 @@ public function display() } -// EOF \ No newline at end of file +// EOF diff --git a/wa-system/database/waModel.class.php b/wa-system/database/waModel.class.php index fa91d47c4..47e2835bb 100644 --- a/wa-system/database/waModel.class.php +++ b/wa-system/database/waModel.class.php @@ -233,7 +233,7 @@ public function rollback() * Set cache * @param waiCache $cache */ - public function setCache(waiCache $cache = null) + public function setCache(?waiCache $cache = null) { $this->cache = $cache; } diff --git a/wa-system/layout/waLayout.class.php b/wa-system/layout/waLayout.class.php index 4987c6685..c967c502c 100644 --- a/wa-system/layout/waLayout.class.php +++ b/wa-system/layout/waLayout.class.php @@ -73,7 +73,7 @@ public function setBlock($name, $content) * @param waViewAction $action * @param waDecorator $decorator */ - public function executeAction($name, $action, waDecorator $decorator = null) + public function executeAction($name, $action, ?waDecorator $decorator = null) { $action->setLayout($this); $content = $decorator ? $decorator->display($action) : $action->display(); diff --git a/wa-system/mail/waMail.class.php b/wa-system/mail/waMail.class.php index aa64d27d4..5acab6dad 100644 --- a/wa-system/mail/waMail.class.php +++ b/wa-system/mail/waMail.class.php @@ -7,7 +7,7 @@ class waMail extends Swift_Mailer protected static $wa_config = array(); private $wa_set_transport = false; - public function __construct(Swift_Transport $transport = null) + public function __construct(?Swift_Transport $transport = null) { if (!$transport) { $transport = Swift_MailTransport::newInstance(); diff --git a/wa-system/payment/waAppPayment.class.php b/wa-system/payment/waAppPayment.class.php index 76afd00ab..cba7afff9 100644 --- a/wa-system/payment/waAppPayment.class.php +++ b/wa-system/payment/waAppPayment.class.php @@ -229,7 +229,7 @@ public function uninstall($plugin_id) } /** @since 3.2.0 */ - public function declareFiscalization($order_id, waPayment $plugin, array $custom_data = null) + public function declareFiscalization($order_id, waPayment $plugin, ?array $custom_data = null) { ; } diff --git a/wa-system/payment/waPayment.class.php b/wa-system/payment/waPayment.class.php index 1aedc7890..bbfc59dd7 100644 --- a/wa-system/payment/waPayment.class.php +++ b/wa-system/payment/waPayment.class.php @@ -973,12 +973,12 @@ public static function settingCurrencySelect() } /** - * @param waOrder $order + * @param waOrder|null $order * @return array[string]array * @return array[string]['name']string Printable form name * @return array[string]['description']string Printable form description */ - public function getPrintForms(waOrder $order = null) + public function getPrintForms(?waOrder $order = null) { return array(); } diff --git a/wa-system/shipping/waShipping.class.php b/wa-system/shipping/waShipping.class.php index e39f4d950..cd333406f 100644 --- a/wa-system/shipping/waShipping.class.php +++ b/wa-system/shipping/waShipping.class.php @@ -510,7 +510,7 @@ public function setPackageState(waOrder $order, $state, $params = array()) * @param array $params * @return array */ - public function getStateFields($state, waOrder $order = null, $params = array()) + public function getStateFields($state, ?waOrder $order = null, $params = array()) { $this->addItems($order->items); $this->setAddress($order->shipping_address); @@ -569,7 +569,7 @@ protected function readyPackage(waOrder $order, $shipping_data = array()) * @return array[string]['name']string printform's name * @return array[string]['description']string printform's description */ - public function getPrintForms(waOrder $order = null) + public function getPrintForms(?waOrder $order = null) { return array(); } diff --git a/wa-system/waSystem.class.php b/wa-system/waSystem.class.php index d031d63c7..e95bbb39a 100644 --- a/wa-system/waSystem.class.php +++ b/wa-system/waSystem.class.php @@ -72,7 +72,7 @@ public function getConfig() * @throws waException * @see wa() */ - public static function getInstance($name = null, waSystemConfig $config = null, $set_current = false) + public static function getInstance($name = null, ?waSystemConfig $config = null, $set_current = false) { if ($name === null) { if ($config && $config instanceof waAppConfig) { diff --git a/wa-system/webasyst/lib/config/webasystConfig.class.php b/wa-system/webasyst/lib/config/webasystConfig.class.php index c7091c3b1..4f98eb891 100644 --- a/wa-system/webasyst/lib/config/webasystConfig.class.php +++ b/wa-system/webasyst/lib/config/webasystConfig.class.php @@ -40,7 +40,7 @@ public function onCount() return $counts; } - public function initUserWidgets($force = false, waContact $contact = null) + public function initUserWidgets($force = false, ?waContact $contact = null) { if (!$contact) { $contact = wa()->getUser();