Ensure all api3 functions have documented types
authorBradley Taylor <hello@brad-taylor.co.uk>
Tue, 1 Feb 2022 19:36:08 +0000 (19:36 +0000)
committerBradley Taylor <hello@brad-taylor.co.uk>
Tue, 1 Feb 2022 19:36:08 +0000 (19:36 +0000)
12 files changed:
api/class.api.php
api/v3/Case.php
api/v3/Contribution.php
api/v3/Extension.php
api/v3/Generic.php
api/v3/Generic/Getlist.php
api/v3/Job.php
api/v3/MailingContact.php
api/v3/Membership.php
api/v3/Pledge.php
api/v3/Profile.php
api/v3/utils.php

index 77c1e986c826a8555bfe5e71a10d2b9f2b8fb1e7..21a4190b70c6d523083edb0ad08f7d7b8ff439c1 100644 (file)
@@ -153,8 +153,8 @@ class civicrm_api3 {
   /**
    * Perform action.
    *
-   * @param $action
-   * @param $params
+   * @param string $action
+   * @param array $params
    *
    * @return bool
    */
@@ -171,8 +171,8 @@ class civicrm_api3 {
   /**
    * Call via rest.
    *
-   * @param $entity
-   * @param $action
+   * @param string $entity
+   * @param string $action
    * @param array $params
    *
    * @return \stdClass
@@ -228,7 +228,7 @@ class civicrm_api3 {
   /**
    * Call api function.
    *
-   * @param $entity
+   * @param string $entity
    * @param string $action
    * @param array $params
    *
@@ -298,8 +298,8 @@ class civicrm_api3 {
   /**
    * Get attribute.
    *
-   * @param $name
-   * @param null $value
+   * @param string $name
+   * @param mixed $value
    *
    * @return $this
    */
index 5249010c45b372c98e6b31117e6af0cadf9cff09..21082e6330c8f99e308b5c61bfe477d3a5b8f1d4 100644 (file)
@@ -131,8 +131,8 @@ function civicrm_api3_case_create($params) {
  * When creating a new case, run the xmlProcessor to get all necessary params/configuration
  *  for the new case, as cases use an xml file to store their configuration.
  *
- * @param $params
- * @param $caseBAO
+ * @param array $params
+ * @param CRM_Case_DAO_Case $caseBAO
  *
  * @throws \Exception
  */
@@ -762,8 +762,8 @@ function civicrm_api3_case_getList($params) {
 
 /**
  * Needed due to the above override
- * @param $params
- * @param $apiRequest
+ * @param array $params
+ * @param array $apiRequest
  */
 function _civicrm_api3_case_getlist_spec(&$params, $apiRequest) {
   require_once 'api/v3/Generic/Getlist.php';
index e3d49c086c09bb6ddb2bc7a3944c0fd8f1602f96..6396535fb3553515a0a1a509b2f82c91696d81ea 100644 (file)
@@ -290,7 +290,7 @@ function _civicrm_api3_contribution_get_support_nonunique_returns($params) {
 /**
  * Support for supported output variables.
  *
- * @param $contribution
+ * @param array $contribution
  */
 function _civicrm_api3_contribution_add_supported_fields(&$contribution) {
   // These are output fields that are supported in our test contract.
@@ -329,7 +329,7 @@ function civicrm_api3_contribution_getcount($params) {
  * As of v4.4 we support multiple soft credit, so now contribution returns array with 'soft_credit' as key
  * but we still return first soft credit as a part of contribution array
  *
- * @param $contribution
+ * @param array $contribution
  */
 function _civicrm_api3_format_soft_credit(&$contribution) {
   if (!empty($contribution['soft_credit'])) {
index ce46a5dfb4c7e2bc65a22194a8f33ca9617964f0..0b654bf642e7d37e6740ff9eedc5b73076168e02 100644 (file)
@@ -50,7 +50,7 @@ function civicrm_api3_extension_install($params) {
 
 /**
  * Spec function for getfields
- * @param $fields
+ * @param array $fields
  */
 function _civicrm_api3_extension_install_spec(&$fields) {
   $fields['keys'] = [
@@ -122,7 +122,7 @@ function civicrm_api3_extension_enable($params) {
 
 /**
  * Spec function for getfields
- * @param $fields
+ * @param array $fields
  */
 function _civicrm_api3_extension_enable_spec(&$fields) {
   _civicrm_api3_extension_install_spec($fields);
@@ -153,7 +153,7 @@ function civicrm_api3_extension_disable($params) {
 
 /**
  * Spec function for getfields
- * @param $fields
+ * @param array $fields
  */
 function _civicrm_api3_extension_disable_spec(&$fields) {
   _civicrm_api3_extension_install_spec($fields);
@@ -186,7 +186,7 @@ function civicrm_api3_extension_uninstall($params) {
 
 /**
  * Spec function for getfields
- * @param $fields
+ * @param array $fields
  */
 function _civicrm_api3_extension_uninstall_spec(&$fields) {
   _civicrm_api3_extension_install_spec($fields);
@@ -250,7 +250,7 @@ function civicrm_api3_extension_download($params) {
 
 /**
  * Spec function for getfields
- * @param $fields
+ * @param array $fields
  */
 function _civicrm_api3_extension_download_spec(&$fields) {
   $fields['key'] = [
@@ -305,7 +305,7 @@ function civicrm_api3_extension_refresh($params) {
 
 /**
  * Spec function for getfields
- * @param $fields
+ * @param array $fields
  */
 function _civicrm_api3_extension_refresh_spec(&$fields) {
   $fields['local'] = [
index 34ba7db2a139588a0e4c8370774090d07ff31ce7..9188bcff50eca4afd536cc6d7c678b009b4c8d43 100644 (file)
@@ -454,8 +454,8 @@ function civicrm_api3_generic_getoptions($apiRequest) {
 /**
  * Provide metadata for this generic action
  *
- * @param $params
- * @param $apiRequest
+ * @param array $params
+ * @param array $apiRequest
  */
 function _civicrm_api3_generic_getoptions_spec(&$params, $apiRequest) {
   $params += [
index 3d993c70b54dce75fcd432d2c2432a075d9d56bb..af8fb61c3b91b63decbb779515b4ce0fd5219e68 100644 (file)
@@ -246,9 +246,9 @@ function _civicrm_api3_generic_getlist_output($result, $request, $entity, $field
 /**
  * Common postprocess for getlist output
  *
- * @param $result
- * @param $request
- * @param $values
+ * @param array $result
+ * @param array $request
+ * @param array $values
  */
 function _civicrm_api3_generic_getlist_postprocess($result, $request, &$values) {
   $chains = [];
index dd9a9ca1e789ffc2120bddf1d578218d69a7dad3..4210e43a695fee44c9b983144e69472dc5ad9f3f 100644 (file)
@@ -555,7 +555,7 @@ function civicrm_api3_job_process_batch_merge($params) {
 /**
  * Metadata for batch merge function.
  *
- * @param $params
+ * @param array $params
  */
 function _civicrm_api3_job_process_batch_merge_spec(&$params) {
   $params['rule_group_id'] = [
index 4875e79340423624cab3d2cd4c7f953c492fe076..2ef5194da77674e0f6d8aff6f79fce69ba2b503c 100644 (file)
@@ -84,13 +84,13 @@ function _civicrm_api3_mailing_contact_get_spec(&$params) {
  * Helper function for mailing contact queries.
  *
  * @param int $contactID
- * @param $offset
- * @param $limit
- * @param $selectFields
- * @param $fromClause
- * @param $whereClause
- * @param $sort
- * @param $getCount
+ * @param int $offset
+ * @param int $limit
+ * @param array|null $selectFields
+ * @param string|null $fromClause
+ * @param string|null $whereClause
+ * @param string|null $sort
+ * @param bool $getCount
  *
  * @return array
  */
@@ -196,10 +196,10 @@ LIMIT %2, %3
  * Get delivered mailing contacts.
  *
  * @param int $contactID
- * @param $offset
- * @param $limit
- * @param $sort
- * @param $getCount
+ * @param int $offset
+ * @param int $limit
+ * @param string|null $sort
+ * @param bool $getCount
  *
  * @return array
  */
@@ -237,10 +237,10 @@ AND        meb.id IS NULL
  * Get bounced mailing contact records.
  *
  * @param int $contactID
- * @param $offset
- * @param $limit
- * @param $sort
- * @param $getCount
+ * @param int $offset
+ * @param int $limit
+ * @param string|null $sort
+ * @param bool $getCount
  *
  * @return array
  */
index c7a3b1d5e478cba39c8a0fc6575f83f75a370d92..689f880ec4ce16ae51e83202bb66047df1e5cf81 100644 (file)
@@ -250,7 +250,7 @@ function civicrm_api3_membership_get($params) {
  * @param array $params
  *   Parameters passed into get function.
  * @param int $membershipTypeId
- * @param $activeOnly
+ * @param bool $activeOnly
  *
  * @return array
  *   result for calling function
@@ -271,7 +271,7 @@ function _civicrm_api3_membership_get_customv2behaviour(&$params, $membershipTyp
  *
  * @param array $params
  *   Parameters passed into get function.
- * @param $membershipValues
+ * @param array $membershipValues
  * @param int $contactID
  *
  * @return array
index 25f661502e103b972ed68eca37ac59541ebe13fc..571924b1930e251edf8285a4cc9cc4079da2d2fd 100644 (file)
@@ -18,7 +18,7 @@
 /**
  * Create or updates an Pledge.
  *
- * @param $params
+ * @param array $params
  *
  * @return array
  *   Array containing 'is_error' to denote success or failure and details of the created pledge
index 742af495fad6e4cd76f7ca3d64b3890066139fe4..a20bd48e1e813b387600d0e3ecc23c692123def9 100644 (file)
@@ -485,7 +485,7 @@ function _civicrm_api3_profile_getbillingpseudoprofile(&$params) {
  * @param int $profileID
  * @param int $optionsBehaviour
  *   0 = don't resolve, 1 = resolve non-aggressively, 2 = resolve aggressively - ie include country & state.
- * @param $is_flush
+ * @param bool $is_flush
  *
  * @return array|void
  */
@@ -623,7 +623,7 @@ function _civicrm_api3_order_by_weight($a, $b) {
  * Here we map the profile fields as stored in the uf_field table to their 'real entity'
  * we also return the profile fieldname
  *
- * @param $field
+ * @param array $field
  *
  * @return array
  */
@@ -716,7 +716,7 @@ function _civicrm_api3_profile_getProfileID($profileID) {
  *
  * e.g getfields response incl 'membership_type_id' - with api.aliases = 'membership_type'
  * returned array will include both as keys (with the same values)
- * @param $entity
+ * @param string $entity
  *
  * @return array
  */
index 03a25ae1ec9988b53d007ee975bba09ebfa47329..1bbc77ef459fb4bc9970cd99007db506c12fd292 100644 (file)
@@ -273,7 +273,7 @@ function civicrm_api3_create_success($values = 1, $params = [], $entity = NULL,
 /**
  * Load the DAO of the entity.
  *
- * @param $entity
+ * @param string $entity
  *
  * @return bool
  */
@@ -405,7 +405,7 @@ function _civicrm_api3_get_BAO($name) {
 /**
  * Recursive function to explode value-separated strings into arrays.
  *
- * @param $values
+ * @param array $values
  */
 function _civicrm_api3_separate_values(&$values) {
   $sp = CRM_Core_DAO::VALUE_SEPARATOR;
@@ -498,7 +498,7 @@ function _civicrm_api3_field_names($fields) {
  * Ideally this would be merged with _civicrm_get_query_object but we need to resolve differences in what the
  * 2 variants call
  *
- * @param $entity
+ * @param string $entity
  * @param array $params
  *   As passed into api get or getcount function.
  * @param array $additional_options
@@ -898,7 +898,7 @@ function _civicrm_api3_get_options_from_params($params, $queryObject = FALSE, $e
  *   Params array as passed into civicrm_api.
  * @param object $dao
  *   DAO object.
- * @param $entity
+ * @param string $entity
  *
  * @throws \API_Exception
  * @throws \CRM_Core_Exception
@@ -1068,8 +1068,8 @@ function _civicrm_api3_object_to_array(&$dao, &$values, $uniqueFields = FALSE) {
 /**
  * Wrapper for _civicrm_object_to_array when api supports unique fields.
  *
- * @param $dao
- * @param $values
+ * @param CRM_Core_DAO $dao
+ * @param array $values
  *
  * @return array
  */
@@ -1125,7 +1125,7 @@ function _civicrm_api3_custom_format_params($params, &$values, $extends, $entity
  * Format parameters for create action.
  *
  * @param array $params
- * @param $entity
+ * @param string $entity
  */
 function _civicrm_api3_format_params_for_create(&$params, $entity) {
   $nonGenericEntities = array_merge(['Contact'], CRM_Contact_BAO_ContactType::basicTypes(TRUE));
@@ -1401,7 +1401,7 @@ function _civicrm_api3_basic_delete($bao_name, &$params) {
  *
  * @param array $returnArray
  *   Array to append custom data too - generally $result[4] where 4 is the entity id.
- * @param $checkPermission
+ * @param bool $checkPermission
  * @param string $entity
  *   E.g membership, event.
  * @param int $entity_id
@@ -1505,7 +1505,7 @@ function _civicrm_api3_validate($entity, $action, $params) {
 
 /**
  * Used by the Validate API.
- * @param $fieldName
+ * @param string $fieldName
  * @param array $fieldInfo
  * @param string $entity
  * @param array $params
@@ -1705,7 +1705,7 @@ function _civicrm_api3_validate_date(&$params, &$fieldName, &$fieldInfo) {
  *
  * @param string $dateValue
  * @param string $fieldName
- * @param $fieldType
+ * @param int $fieldType
  *
  * @throws Exception
  * @return mixed
@@ -1876,7 +1876,7 @@ function _civicrm_api3_generic_replace_base_params($params) {
 /**
  * Returns fields allowable by api.
  *
- * @param $entity
+ * @param string $entity
  *   String Entity to query.
  * @param bool $unique
  *   Index by unique fields?.
@@ -1952,7 +1952,7 @@ function _civicrm_api_get_fields($entity, $unique = FALSE, &$params = []) {
  *
  * This is the same as the BAO function but fields are prefixed with 'custom_' to represent api params.
  *
- * @param $entity
+ * @param string $entity
  * @param array $params
  *
  * @return array
@@ -1996,8 +1996,8 @@ function _civicrm_api_get_custom_fields($entity, &$params) {
  *
  * Function also swaps unique fields for non-unique fields & vice versa.
  *
- * @param $apiRequest
- * @param $fields
+ * @param array $apiRequest
+ * @param array $fields
  */
 function _civicrm_api3_swap_out_aliases(&$apiRequest, $fields) {
   foreach ($fields as $field => $values) {
@@ -2118,7 +2118,7 @@ function _civicrm_api3_validate_integer(&$params, $fieldName, &$fieldInfo, $enti
 
 /**
  * Helper function to determine country_id given the myriad of values for country_id or country that are supported
- * @param $params
+ * @param array $params
  *
  * @return int|null
  */
@@ -2394,9 +2394,9 @@ function _civicrm_api3_api_match_pseudoconstant_value(&$value, $options, $fieldN
 /**
  * Returns the canonical name of a field.
  *
- * @param $entity
+ * @param string $entity
  *   api entity name (string should already be standardized - no camelCase).
- * @param $fieldName
+ * @param string $fieldName
  *   any variation of a field's name (name, unique_name, api.alias).
  *
  * @param string $action
@@ -2489,7 +2489,7 @@ function _civicrm_api3_field_value_check(&$params, $fieldName, $type = NULL) {
  * _civicrm_api3_basic_get but does not use DAO/BAO. This is useful for
  * small/mid-size data loaded from external JSON or XML documents.
  *
- * @param $entity
+ * @param string $entity
  * @param array $params
  *   API parameters.
  * @param array $records