From 5b864f3112b5af8aa7b51c6db910da1f88cf02ce Mon Sep 17 00:00:00 2001 From: Bradley Taylor Date: Sat, 23 Sep 2023 11:38:11 +0100 Subject: [PATCH] [REF][PHP8.2] Declare properties in CRM_Queue_ErrorPolicy --- CRM/Queue/ErrorPolicy.php | 26 +++++++++++++++++++------- 1 file changed, 19 insertions(+), 7 deletions(-) diff --git a/CRM/Queue/ErrorPolicy.php b/CRM/Queue/ErrorPolicy.php index 178591bbd2..9246036f9b 100644 --- a/CRM/Queue/ErrorPolicy.php +++ b/CRM/Queue/ErrorPolicy.php @@ -26,7 +26,21 @@ * will be necessary to get reuse from the other parts of this class. */ class CRM_Queue_ErrorPolicy { - public $active; + + /** + * @var bool + */ + protected $active; + + /** + * @var int + */ + protected $level; + + /** + * @var array + */ + protected $backup; /** * @param null|int $level @@ -43,7 +57,7 @@ class CRM_Queue_ErrorPolicy { /** * Enable the error policy. */ - public function activate() { + protected function activate() { $this->active = TRUE; $this->backup = []; foreach ([ @@ -55,14 +69,12 @@ class CRM_Queue_ErrorPolicy { ini_set($key, 0); } set_error_handler([$this, 'onError'], $this->level); - // FIXME make this temporary/reversible } /** * Disable the error policy. */ - public function deactivate() { - $this->errorScope = NULL; + protected function deactivate() { restore_error_handler(); foreach ([ 'display_errors', @@ -137,7 +149,7 @@ class CRM_Queue_ErrorPolicy { * @param array $error * The PHP error (with "type", "message", etc). */ - public function reportError($error) { + protected function reportError($error) { $response = [ 'is_error' => 1, 'is_continue' => 0, @@ -158,7 +170,7 @@ class CRM_Queue_ErrorPolicy { * @param Exception $e * The unhandled exception. */ - public function reportException(Exception $e) { + protected function reportException(Exception $e) { CRM_Core_Error::debug_var('CRM_Queue_ErrorPolicy_reportException', CRM_Core_Error::formatTextException($e)); $response = [ -- 2.25.1