From b5f8992ae581e9288cdd570334ed5f86a7abeb64 Mon Sep 17 00:00:00 2001 From: Eileen McNaughton Date: Wed, 19 Jan 2022 10:44:44 +1300 Subject: [PATCH] Deprecate unused functions --- CRM/Core/Component.php | 26 ++++++++++++++++++-------- CRM/Core/Invoke.php | 4 ++++ 2 files changed, 22 insertions(+), 8 deletions(-) diff --git a/CRM/Core/Component.php b/CRM/Core/Component.php index ea28963554..d33157adb6 100644 --- a/CRM/Core/Component.php +++ b/CRM/Core/Component.php @@ -27,7 +27,7 @@ class CRM_Core_Component { /** * @var array */ - public static $_contactSubTypes = NULL; + public static $_contactSubTypes; /** * @param bool $force @@ -349,9 +349,14 @@ class CRM_Core_Component { } /** + * Unused function. + * * @return array|null + * + * @deprecated */ - public static function &contactSubTypes() { + public static function contactSubTypes() { + CRM_Core_Error::deprecatedWarning('unused'); if (self::$_contactSubTypes == NULL) { self::$_contactSubTypes = []; } @@ -359,19 +364,24 @@ class CRM_Core_Component { } /** - * @param $subType - * @param $op + * Unused function. * - * @return null + * @param string $subType + * @param string $op + * + * @return null|string + * + * @deprecated */ - public static function &contactSubTypeProperties($subType, $op) { + public static function contactSubTypeProperties($subType, $op): ?string { + CRM_Core_Error::deprecatedWarning('unused'); $properties = self::contactSubTypes(); if (array_key_exists($subType, $properties) && array_key_exists($op, $properties[$subType]) ) { return $properties[$subType][$op]; } - return CRM_Core_DAO::$_nullObject; + return NULL; } /** @@ -405,7 +415,7 @@ class CRM_Core_Component { if (is_dir($crmFolderDir) && $dir = opendir($crmFolderDir)) { while ($subDir = readdir($dir)) { // skip the extensions diretory since it has an Info.php file also - if ($subDir == 'Extension') { + if ($subDir === 'Extension') { continue; } diff --git a/CRM/Core/Invoke.php b/CRM/Core/Invoke.php index 48bf206c62..1255fd3285 100644 --- a/CRM/Core/Invoke.php +++ b/CRM/Core/Invoke.php @@ -331,13 +331,17 @@ class CRM_Core_Invoke { /** * This function contains the default action. * + * Unused function. + * * @param $action * * @param $contact_type * @param $contact_sub_type * + * @Deprecated */ public static function form($action, $contact_type, $contact_sub_type) { + CRM_Core_Error::deprecatedWarning('unused'); CRM_Utils_System::setUserContext(['civicrm/contact/search/basic', 'civicrm/contact/view']); $wrapper = new CRM_Utils_Wrapper(); -- 2.25.1