From 0e044d89e02a8ddf395de4e342db7c1ccc5167df Mon Sep 17 00:00:00 2001 From: eileen Date: Tue, 10 Mar 2020 22:29:36 +1300 Subject: [PATCH] [REF] Minor code simplification Move the return earlier, simplify the IF --- CRM/Core/PseudoConstant.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/CRM/Core/PseudoConstant.php b/CRM/Core/PseudoConstant.php index fbea0cefd5..064cad9797 100644 --- a/CRM/Core/PseudoConstant.php +++ b/CRM/Core/PseudoConstant.php @@ -211,15 +211,15 @@ class CRM_Core_PseudoConstant { $dao = new $daoName(); $fieldSpec = $dao->getFieldSpec($fieldName); - // Ensure we have the canonical name for this field - $fieldName = CRM_Utils_Array::value('name', $fieldSpec, $fieldName); - // Return false if field doesn't exist. if (empty($fieldSpec)) { return FALSE; } - elseif (!empty($fieldSpec['pseudoconstant'])) { + // Ensure we have the canonical name for this field + $fieldName = $fieldSpec['name'] ?? $fieldName; + + if (!empty($fieldSpec['pseudoconstant'])) { $pseudoconstant = $fieldSpec['pseudoconstant']; // if callback is specified.. -- 2.25.1