PHP8.1 - Fix deprecated passing null to glob
[civicrm-core.git] / CRM / Core / Resources.php
index 6d83c2aa97da9ca0855af70d17b03fd7062b0e44..bd54a0507ceb2d9c913ba7acb308a12f9b02e6a9 100644 (file)
@@ -307,7 +307,7 @@ class CRM_Core_Resources implements CRM_Core_Resources_CollectionAdderInterface
    *   List of matching files, relative to the extension base dir.
    * @see glob()
    */
-  public function glob($ext, $patterns, $flags = NULL) {
+  public function glob($ext, $patterns, $flags = 0) {
     $path = $this->getPath($ext);
     $patterns = (array) $patterns;
     $files = [];
@@ -496,16 +496,15 @@ class CRM_Core_Resources implements CRM_Core_Resources_CollectionAdderInterface
    *
    * @return array
    */
-  public static function getEntityRefMetadata() {
+  protected static function getEntityRefMetadata() {
     $data = [
       'filters' => [],
       'links' => [],
     ];
-    $enabledComponents = Civi::settings()->get('enable_components');
 
     foreach (CRM_Core_DAO_AllCoreTables::daoToClass() as $entity => $daoName) {
       // Skip DAOs of disabled components
-      if (defined("$daoName::COMPONENT") && !in_array($daoName::COMPONENT, $enabledComponents, TRUE)) {
+      if (defined("$daoName::COMPONENT") && !CRM_Core_Component::isEnabled($daoName::COMPONENT)) {
         continue;
       }
       $baoName = str_replace('_DAO_', '_BAO_', $daoName);
@@ -570,7 +569,7 @@ class CRM_Core_Resources implements CRM_Core_Resources_CollectionAdderInterface
   }
 
   /**
-   * @param string|NULL $region
+   * @param string|null $region
    *   Optional request for a specific region. If NULL/omitted, use global default.
    * @return \CRM_Core_Region
    */