original_string: public static function get_customfields_data_contexts(string $component, string $area,
              string $itemidstest = 'IS NOT NULL', string $instanceidstest = 'IS NOT NULL', array $params = []) : contextlist {
  
          $sql = "SELECT d.contextid FROM {customfield_category} c
              JOIN {customfield_field} f ON f.categoryid = c.id
              JOIN {customfield_data} d ON d.fieldid = f.id AND d.instanceid $instanceidstest
              WHERE c.component = :cfcomponent AND c.area = :cfarea AND c.itemid $itemidstest";
  
          $contextlist = new contextlist();
          $contextlist->add_from_sql($sql, self::get_params($component, $area, $params));
  
          return $contextlist;
      }
code: public static function get_customfields_data_contexts(string $component, string $area,
              string $itemidstest = 'IS NOT NULL', string $instanceidstest = 'IS NOT NULL', array $params = []) : contextlist {
  
          $sql = "SELECT d.contextid FROM {customfield_category} c
              JOIN {customfield_field} f ON f.categoryid = c.id
              JOIN {customfield_data} d ON d.fieldid = f.id AND d.instanceid $instanceidstest
              WHERE c.component = :cfcomponent AND c.area = :cfarea AND c.itemid $itemidstest";
  
          $contextlist = new contextlist();
          $contextlist->add_from_sql($sql, self::get_params($component, $area, $params));
  
          return $contextlist;
      }
code_tokens: public static function get_customfields_data_contexts ( string $ component , string $ area , string $ itemidstest = 'IS NOT NULL' , string $ instanceidstest = 'IS NOT NULL' , array $ params = [ ] ) : contextlist { $ sql = "SELECT d.contextid FROM {customfield_category} c
              JOIN {customfield_field} f ON f.categoryid = c.id
              JOIN {customfield_data} d ON d.fieldid = f.id AND d.instanceid $instanceidstest
              WHERE c.component = :cfcomponent AND c.area = :cfarea AND c.itemid $itemidstest" ; $ contextlist = new contextlist ( ) ; $ contextlist -> add_from_sql ( $ sql , self :: get_params ( $ component , $ area , $ params ) ) ; return $ contextlist ; }
docstring: Returns contexts that have customfields data
  
  To be used in implementations of core_user_data_provider::get_contexts_for_userid
  Caller needs to transfer the $userid to the select subqueries for
  customfield_category->itemid and/or customfield_data->instanceid
  
  @param string $component
  @param string $area
  @param string $itemidstest subquery for selecting customfield_category->itemid
  @param string $instanceidstest subquery for selecting customfield_data->instanceid
  @param array $params array of named parameters
  @return contextlist
docstring_tokens: Returns contexts that have customfields data