Merge pull request #15463 from eileenmcnaughton/status_fix
[civicrm-core.git] / CRM / Dedupe / Finder.php
index 19658cb898848af0e99298b9d3a68334a852af60..63725439a91682537e8bbe6a607bcfffb67bbb2c 100644 (file)
@@ -61,7 +61,7 @@ class CRM_Dedupe_Finder {
     $rgBao->id = $rgid;
     $rgBao->contactIds = $cids;
     if (!$rgBao->find(TRUE)) {
-      CRM_Core_Error::fatal("Dedupe rule not found for selected contacts");
+      throw new CRM_Core_Exception('Dedupe rule not found for selected contacts');
     }
 
     $rgBao->fillTable();
@@ -99,6 +99,7 @@ class CRM_Dedupe_Finder {
    *
    * @return array
    *   matching contact ids
+   * @throws \CRM_Core_Exception
    */
   public static function dupesByParams(
     $params,
@@ -130,7 +131,7 @@ class CRM_Dedupe_Finder {
       $rgBao->contact_type = $ctype;
       $rgBao->used = $used;
       if (!$rgBao->find(TRUE)) {
-        CRM_Core_Error::fatal("$used rule for $ctype does not exist");
+        throw new CRM_Core_Exception("$used rule for $ctype does not exist");
       }
     }
 
@@ -167,6 +168,7 @@ class CRM_Dedupe_Finder {
    *
    * @return array
    *   array of (cid1, cid2, weight) dupe triples
+   * @throws \CiviCRM_API3_Exception
    */
   public static function dupesInGroup($rgid, $gid, $searchLimit = 0) {
     $cids = array_keys(CRM_Contact_BAO_Group::getMember($gid, TRUE, $searchLimit));
@@ -187,6 +189,7 @@ class CRM_Dedupe_Finder {
    *
    * @return array
    *   valid $params array for dedupe
+   * @throws \CRM_Core_Exception
    */
   public static function formatParams($fields, $ctype) {
     $flat = [];
@@ -292,7 +295,7 @@ class CRM_Dedupe_Finder {
             }
           }
         }
-        if ($table == 'civicrm_phone') {
+        if ($table === 'civicrm_phone') {
           $fixes = [
             'phone' => 'phone_numeric',
           ];
@@ -326,8 +329,6 @@ class CRM_Dedupe_Finder {
    *   -dstName
    *   -weight
    *   -canMerge
-   *
-   * @throws CRM_Core_Exception
    */
   public static function parseAndStoreDupePairs($foundDupes, $cacheKeyString) {
     $cids = [];