Merge pull request #24162 from colemanw/savedSearchLabel
[civicrm-core.git] / CRM / Core / Component.php
index 6c655ae0ff8faa8cafe1dcf7c85cbebf77be27c6..10d4e9c9bcfa46228cd351e9a1375942c42d3551 100644 (file)
@@ -24,11 +24,6 @@ class CRM_Core_Component {
    */
   const COMPONENT_INFO_CLASS = 'Info';
 
-  /**
-   * @var array
-   */
-  public static $_contactSubTypes = NULL;
-
   /**
    * @param bool $force
    *
@@ -349,29 +344,36 @@ class CRM_Core_Component {
   }
 
   /**
+   * Unused function.
+   *
    * @return array|null
+   *
+   * @deprecated
    */
-  public static function &contactSubTypes() {
-    if (self::$_contactSubTypes == NULL) {
-      self::$_contactSubTypes = [];
-    }
-    return self::$_contactSubTypes;
+  public static function contactSubTypes() {
+    CRM_Core_Error::deprecatedWarning('unused');
+    return [];
   }
 
   /**
-   * @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,14 +407,13 @@ 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;
         }
 
         $infoFile = $crmFolderDir . "/{$subDir}/" . self::COMPONENT_INFO_CLASS . '.php';
         if (file_exists($infoFile)) {
           $infoClass = 'CRM_' . $subDir . '_' . self::COMPONENT_INFO_CLASS;
-          require_once str_replace('_', DIRECTORY_SEPARATOR, $infoClass) . '.php';
           $infoObject = new $infoClass(NULL, NULL, NULL);
           $components[$infoObject->info['name']] = $infoObject;
           unset($infoObject);