From ef18fe7e5e209b398f42b7f3028d774478656a93 Mon Sep 17 00:00:00 2001 From: Seamus Lee Date: Mon, 19 Dec 2022 20:54:20 +0000 Subject: [PATCH] [REF][PHP8.2] Further resolve some deprecation issues around dynamic class properties --- CRM/Activity/Form/Activity.php | 7 +++++++ CRM/Activity/Import/Parser/Activity.php | 2 ++ CRM/Case/XMLProcessor/Report.php | 7 +++++++ CRM/Contact/Form/Task/EmailTrait.php | 8 ++++++++ CRM/Contact/Page/View.php | 2 +- CRM/Core/CodeGen/Schema.php | 2 ++ CRM/Core/CodeGen/Specification.php | 2 ++ CRM/Core/Form/Search.php | 2 ++ CRM/Core/Page.php | 7 +++++++ CRM/Core/Selector/Controller.php | 2 ++ CRM/Extension/Browser.php | 15 +++++++++++++++ CRM/Extension/Info.php | 10 ++++++++++ Civi/Test/CiviTestListenerPHPUnit7.php | 2 ++ Civi/WorkflowMessage/FieldSpec.php | 2 ++ .../tests/phpunit/Civi/OAuth/AuthCodeFlowTest.php | 2 ++ .../phpunit/api/v4/OAuthContactTokenTest.php | 2 ++ tests/phpunit/CRM/ACL/ListTest.php | 5 +++++ tests/phpunit/CRM/Activity/BAO/ActivityTest.php | 2 ++ tests/phpunit/CRM/Activity/Form/ActivityTest.php | 5 +++++ tests/phpunit/CRM/Activity/Form/SearchTest.php | 5 +++++ tests/phpunit/Civi/Core/CiviFacadeTest.php | 2 ++ tests/phpunit/Civi/Core/SettingsBagTest.php | 2 ++ tests/phpunit/CiviTest/CiviCaseTestCase.php | 6 ++++++ tests/phpunit/CiviTest/CiviMailUtils.php | 5 +++++ tests/phpunit/CiviTest/CiviTestSMSProvider.php | 1 + 25 files changed, 106 insertions(+), 1 deletion(-) diff --git a/CRM/Activity/Form/Activity.php b/CRM/Activity/Form/Activity.php index ce069e8be4..c2e24fdcdb 100644 --- a/CRM/Activity/Form/Activity.php +++ b/CRM/Activity/Form/Activity.php @@ -127,6 +127,13 @@ class CRM_Activity_Form_Activity extends CRM_Contact_Form_Task { public $submitOnce = TRUE; + /** + * @var array + */ + public $_groupTree; + + public $_entityTagValues; + /** * Explicitly declare the entity api name. * diff --git a/CRM/Activity/Import/Parser/Activity.php b/CRM/Activity/Import/Parser/Activity.php index 13f18fca5a..3f155132f3 100644 --- a/CRM/Activity/Import/Parser/Activity.php +++ b/CRM/Activity/Import/Parser/Activity.php @@ -21,6 +21,8 @@ */ class CRM_Activity_Import_Parser_Activity extends CRM_Import_Parser { + protected $_newActivity; + /** * Get information about the provided job. * - name diff --git a/CRM/Case/XMLProcessor/Report.php b/CRM/Case/XMLProcessor/Report.php index 3eed985011..745a299dd7 100644 --- a/CRM/Case/XMLProcessor/Report.php +++ b/CRM/Case/XMLProcessor/Report.php @@ -23,6 +23,13 @@ class CRM_Case_XMLProcessor_Report extends CRM_Case_XMLProcessor { */ protected $_isRedact; + /** + * Redaction Rules. + * + * @var array + */ + protected $_redactionStringRules = []; + /** */ public function __construct() { diff --git a/CRM/Contact/Form/Task/EmailTrait.php b/CRM/Contact/Form/Task/EmailTrait.php index 268595325f..06764a1c09 100644 --- a/CRM/Contact/Form/Task/EmailTrait.php +++ b/CRM/Contact/Form/Task/EmailTrait.php @@ -80,6 +80,14 @@ trait CRM_Contact_Form_Task_EmailTrait { */ protected $suppressedEmails = []; + public $_contactDetails = []; + + public $_entityTagValues; + + public $_caseId; + + public $_context; + /** * Getter for isSearchContext. * diff --git a/CRM/Contact/Page/View.php b/CRM/Contact/Page/View.php index 36cd8e0c98..76eec14737 100644 --- a/CRM/Contact/Page/View.php +++ b/CRM/Contact/Page/View.php @@ -46,7 +46,7 @@ class CRM_Contact_Page_View extends CRM_Core_Page { * * @var string */ - protected $_permission; + public $_permission; /** * Heart of the viewing process. diff --git a/CRM/Core/CodeGen/Schema.php b/CRM/Core/CodeGen/Schema.php index 7793dc5ae4..bc3e804626 100644 --- a/CRM/Core/CodeGen/Schema.php +++ b/CRM/Core/CodeGen/Schema.php @@ -5,6 +5,8 @@ */ class CRM_Core_CodeGen_Schema extends CRM_Core_CodeGen_BaseTask { + public $locales; + /** * CRM_Core_CodeGen_Schema constructor. * diff --git a/CRM/Core/CodeGen/Specification.php b/CRM/Core/CodeGen/Specification.php index c336ef9ecb..9f3aaea737 100644 --- a/CRM/Core/CodeGen/Specification.php +++ b/CRM/Core/CodeGen/Specification.php @@ -9,6 +9,8 @@ class CRM_Core_CodeGen_Specification { protected $classNames; + public $buildVersion; + /** * Read and parse. * diff --git a/CRM/Core/Form/Search.php b/CRM/Core/Form/Search.php index 001bd72dcd..aa2e13b5b1 100644 --- a/CRM/Core/Form/Search.php +++ b/CRM/Core/Form/Search.php @@ -94,6 +94,8 @@ class CRM_Core_Form_Search extends CRM_Core_Form { */ protected $searchFieldMetadata = ['Contact' => []]; + protected $_reset; + /** * @return array */ diff --git a/CRM/Core/Page.php b/CRM/Core/Page.php index 806393cead..0507bd2dc1 100644 --- a/CRM/Core/Page.php +++ b/CRM/Core/Page.php @@ -134,6 +134,13 @@ class CRM_Core_Page { 'beginHookFormElements', ]; + /** + * The permission we have on this contact + * + * @var string + */ + public $_permission; + /** * Class constructor. * diff --git a/CRM/Core/Selector/Controller.php b/CRM/Core/Selector/Controller.php index 05e1e09a90..a3723979b1 100644 --- a/CRM/Core/Selector/Controller.php +++ b/CRM/Core/Selector/Controller.php @@ -158,6 +158,8 @@ class CRM_Core_Selector_Controller { */ protected $_dynamicAction = FALSE; + protected $_case; + /** * Class constructor. * diff --git a/CRM/Extension/Browser.php b/CRM/Extension/Browser.php index af1a0e84de..f61caf3152 100644 --- a/CRM/Extension/Browser.php +++ b/CRM/Extension/Browser.php @@ -44,6 +44,21 @@ class CRM_Extension_Browser { */ protected $guzzleClient; + /** + * @var string + */ + public $repoUrl; + + /** + * @var string + */ + public $indexPath; + + /** + * @var array + */ + protected $_remotesDiscovered; + /** * @return \GuzzleHttp\Client */ diff --git a/CRM/Extension/Info.php b/CRM/Extension/Info.php index 3feb6af276..2546da5c5c 100644 --- a/CRM/Extension/Info.php +++ b/CRM/Extension/Info.php @@ -160,6 +160,16 @@ class CRM_Extension_Info { */ public $typeInfo; + /** + * @var string + */ + public $url; + + /** + * @var string + */ + public $category; + /** * Load extension info an XML file. * diff --git a/Civi/Test/CiviTestListenerPHPUnit7.php b/Civi/Test/CiviTestListenerPHPUnit7.php index 97c122081a..8b4b9af92e 100644 --- a/Civi/Test/CiviTestListenerPHPUnit7.php +++ b/Civi/Test/CiviTestListenerPHPUnit7.php @@ -25,6 +25,8 @@ class CiviTestListenerPHPUnit7 implements \PHPUnit\Framework\TestListener { */ private $cache = []; + public $errorScope; + /** * @var \CRM_Core_Transaction|null */ diff --git a/Civi/WorkflowMessage/FieldSpec.php b/Civi/WorkflowMessage/FieldSpec.php index 7672ed8802..2e3850f80d 100644 --- a/Civi/WorkflowMessage/FieldSpec.php +++ b/Civi/WorkflowMessage/FieldSpec.php @@ -43,6 +43,8 @@ class FieldSpec { */ public $scope; + public $comment; + /** * @return bool */ diff --git a/ext/oauth-client/tests/phpunit/Civi/OAuth/AuthCodeFlowTest.php b/ext/oauth-client/tests/phpunit/Civi/OAuth/AuthCodeFlowTest.php index 8f30036b6c..bf0d37e50f 100644 --- a/ext/oauth-client/tests/phpunit/Civi/OAuth/AuthCodeFlowTest.php +++ b/ext/oauth-client/tests/phpunit/Civi/OAuth/AuthCodeFlowTest.php @@ -19,6 +19,8 @@ class AuthCodeFlowTest extends \PHPUnit\Framework\TestCase implements private $providers = []; + protected $ids = []; + public function setUpHeadless() { // Civi\Test has many helpers, like install(), uninstall(), sql(), and sqlFile(). // See: https://docs.civicrm.org/dev/en/latest/testing/phpunit/#civitest diff --git a/ext/oauth-client/tests/phpunit/api/v4/OAuthContactTokenTest.php b/ext/oauth-client/tests/phpunit/api/v4/OAuthContactTokenTest.php index 360df66235..389edd8220 100644 --- a/ext/oauth-client/tests/phpunit/api/v4/OAuthContactTokenTest.php +++ b/ext/oauth-client/tests/phpunit/api/v4/OAuthContactTokenTest.php @@ -31,6 +31,8 @@ class api_v4_OAuthContactTokenTest extends \PHPUnit\Framework\TestCase implement private $hookEvents; + protected $ids = []; + public function setUpHeadless(): \Civi\Test\CiviEnvBuilder { // Civi\Test has many helpers, like install(), uninstall(), sql(), and sqlFile(). // See: https://docs.civicrm.org/dev/en/latest/testing/phpunit/#civitest diff --git a/tests/phpunit/CRM/ACL/ListTest.php b/tests/phpunit/CRM/ACL/ListTest.php index f80aba5f49..c959bd46aa 100644 --- a/tests/phpunit/CRM/ACL/ListTest.php +++ b/tests/phpunit/CRM/ACL/ListTest.php @@ -10,6 +10,11 @@ */ class CRM_ACL_ListTest extends CiviUnitTestCase { + /** + * @var array + */ + protected $allowedContactsACL = []; + /** * Set up function. */ diff --git a/tests/phpunit/CRM/Activity/BAO/ActivityTest.php b/tests/phpunit/CRM/Activity/BAO/ActivityTest.php index 11973f735b..14e6d8d8e5 100644 --- a/tests/phpunit/CRM/Activity/BAO/ActivityTest.php +++ b/tests/phpunit/CRM/Activity/BAO/ActivityTest.php @@ -15,6 +15,8 @@ class CRM_Activity_BAO_ActivityTest extends CiviUnitTestCase { private $someContacts = []; + protected $allowedContacts = []; + /** * Set up for test. * diff --git a/tests/phpunit/CRM/Activity/Form/ActivityTest.php b/tests/phpunit/CRM/Activity/Form/ActivityTest.php index 12190a9e18..9a2b84ca75 100644 --- a/tests/phpunit/CRM/Activity/Form/ActivityTest.php +++ b/tests/phpunit/CRM/Activity/Form/ActivityTest.php @@ -8,6 +8,11 @@ use Civi\Test\Invasive; */ class CRM_Activity_Form_ActivityTest extends CiviUnitTestCase { + protected $assignee1; + protected $assignee2; + protected $target; + protected $source; + public function setUp():void { parent::setUp(); $this->assignee1 = $this->individualCreate([ diff --git a/tests/phpunit/CRM/Activity/Form/SearchTest.php b/tests/phpunit/CRM/Activity/Form/SearchTest.php index 812ca7badf..a50099c5bf 100644 --- a/tests/phpunit/CRM/Activity/Form/SearchTest.php +++ b/tests/phpunit/CRM/Activity/Form/SearchTest.php @@ -6,6 +6,11 @@ */ class CRM_Activity_Form_SearchTest extends CiviUnitTestCase { + /** + * @var int + */ + protected $individualID; + public function setUp(): void { parent::setUp(); $this->individualID = $this->individualCreate(); diff --git a/tests/phpunit/Civi/Core/CiviFacadeTest.php b/tests/phpunit/Civi/Core/CiviFacadeTest.php index ef68482906..645937a087 100644 --- a/tests/phpunit/Civi/Core/CiviFacadeTest.php +++ b/tests/phpunit/Civi/Core/CiviFacadeTest.php @@ -5,6 +5,8 @@ class CiviFacadeTest extends \CiviUnitTestCase { protected $origSetting; + protected $mandates; + protected function setUp(): void { $this->origSetting = $GLOBALS['civicrm_setting']; diff --git a/tests/phpunit/Civi/Core/SettingsBagTest.php b/tests/phpunit/Civi/Core/SettingsBagTest.php index 85ca76ffe8..69f58dfcb5 100644 --- a/tests/phpunit/Civi/Core/SettingsBagTest.php +++ b/tests/phpunit/Civi/Core/SettingsBagTest.php @@ -5,6 +5,8 @@ class SettingsBagTest extends \CiviUnitTestCase { protected $origSetting; + public $mandates; + protected function setUp(): void { $this->origSetting = $GLOBALS['civicrm_setting']; diff --git a/tests/phpunit/CiviTest/CiviCaseTestCase.php b/tests/phpunit/CiviTest/CiviCaseTestCase.php index 95088ae658..b23cca88c8 100644 --- a/tests/phpunit/CiviTest/CiviCaseTestCase.php +++ b/tests/phpunit/CiviTest/CiviCaseTestCase.php @@ -28,6 +28,12 @@ class CiviCaseTestCase extends CiviUnitTestCase { protected $_loggedInUser; + /** + * Tables to truncate as part of cleanup + * @var array + */ + protected $tablesToTruncate; + public function setUp(): void { parent::setUp(); diff --git a/tests/phpunit/CiviTest/CiviMailUtils.php b/tests/phpunit/CiviTest/CiviMailUtils.php index 9fe84fbc77..0c4c23eee9 100644 --- a/tests/phpunit/CiviTest/CiviMailUtils.php +++ b/tests/phpunit/CiviTest/CiviMailUtils.php @@ -36,6 +36,11 @@ class CiviMailUtils extends PHPUnit\Framework\TestCase { */ protected $_outBound_option = NULL; + /** + * @var CiviUnitTestCase + */ + protected $_ut; + /** * Constructor. * diff --git a/tests/phpunit/CiviTest/CiviTestSMSProvider.php b/tests/phpunit/CiviTest/CiviTestSMSProvider.php index d0e23e79f2..9d7d80ee9f 100644 --- a/tests/phpunit/CiviTest/CiviTestSMSProvider.php +++ b/tests/phpunit/CiviTest/CiviTestSMSProvider.php @@ -16,6 +16,7 @@ class CiviTestSMSProvider extends CRM_SMS_Provider { protected $sentMessage; protected $_id = 0; static private $_singleton = []; + protected $provider; public function __construct($provider, $skipAuth = TRUE) { $this->provider = $provider; -- 2.25.1