NFC - Update code comments
authorColeman Watts <coleman@civicrm.org>
Thu, 30 Sep 2021 19:08:50 +0000 (15:08 -0400)
committerColeman Watts <coleman@civicrm.org>
Thu, 30 Sep 2021 19:08:50 +0000 (15:08 -0400)
First docblock to use the new array shapes annotation

Civi/Api4/Generic/Traits/DAOActionTrait.php

index 7e0b356ac219686f8b434327f72aa8e8c2d6c2f5..c032e762f5e35eb127cb3f3258950887a0d2e616 100644 (file)
@@ -195,6 +195,9 @@ trait DAOActionTrait {
   }
 
   /**
+   * Converts params from flat array e.g. ['GroupName.Fieldname' => value] to the
+   * hierarchy expected by the BAO, nested within $params['custom'].
+   *
    * @param array $params
    * @param int $entityId
    *
@@ -204,8 +207,6 @@ trait DAOActionTrait {
   protected function formatCustomParams(&$params, $entityId) {
     $customParams = [];
 
-    // $customValueID is the ID of the custom value in the custom table for this
-    // entity (i guess this assumes it's not a multi value entity)
     foreach ($params as $name => $value) {
       $field = $this->getCustomFieldInfo($name);
       if (!$field) {
@@ -259,7 +260,7 @@ trait DAOActionTrait {
    *
    * @param string $fieldExpr
    *   Field identifier with possible suffix, e.g. MyCustomGroup.MyField1:label
-   * @return array|NULL
+   * @return array{id: int, name: string, entity: string, suffix: string, html_type: string, data_type: string}|NULL
    */
   protected function getCustomFieldInfo(string $fieldExpr) {
     if (strpos($fieldExpr, '.') === FALSE) {