From: colemanw Date: Thu, 24 Aug 2023 17:47:42 +0000 (-0400) Subject: REF/ext - Simplify inline conditionals with Elvis X-Git-Url: https://vcs.fsf.org/?a=commitdiff_plain;h=7c8155f53bcad1f2004e2cf1cb39b908edaf9b84;p=civicrm-core.git REF/ext - Simplify inline conditionals with Elvis --- diff --git a/ext/authx/Civi/Authx/Backdrop.php b/ext/authx/Civi/Authx/Backdrop.php index c2d248f180..1252f92f96 100644 --- a/ext/authx/Civi/Authx/Backdrop.php +++ b/ext/authx/Civi/Authx/Backdrop.php @@ -19,7 +19,7 @@ class Backdrop implements AuthxInterface { public function checkPassword(string $username, string $password) { $uid = user_authenticate($username, $password); // Ensure strict nullness. - return $uid ? $uid : NULL; + return $uid ?: NULL; } /** diff --git a/ext/authx/Civi/Authx/Drupal.php b/ext/authx/Civi/Authx/Drupal.php index e9722cab20..f43e5b14a8 100644 --- a/ext/authx/Civi/Authx/Drupal.php +++ b/ext/authx/Civi/Authx/Drupal.php @@ -19,7 +19,7 @@ class Drupal implements AuthxInterface { public function checkPassword(string $username, string $password) { $uid = user_authenticate($username, $password); // Ensure strict nullness. - return $uid ? $uid : NULL; + return $uid ?: NULL; } /** diff --git a/ext/authx/Civi/Authx/Drupal8.php b/ext/authx/Civi/Authx/Drupal8.php index 54f8c122a6..89ff2d8d07 100644 --- a/ext/authx/Civi/Authx/Drupal8.php +++ b/ext/authx/Civi/Authx/Drupal8.php @@ -19,7 +19,7 @@ class Drupal8 implements AuthxInterface { public function checkPassword(string $username, string $password) { $uid = \Drupal::service('user.auth')->authenticate($username, $password); // Ensure strict nullness. - return $uid ? $uid : NULL; + return $uid ?: NULL; } /** diff --git a/ext/flexmailer/src/FlexMailer.php b/ext/flexmailer/src/FlexMailer.php index c46160a738..844ee66659 100644 --- a/ext/flexmailer/src/FlexMailer.php +++ b/ext/flexmailer/src/FlexMailer.php @@ -133,7 +133,7 @@ class FlexMailer { */ public function __construct($context = array(), EventDispatcherInterface $dispatcher = NULL) { $this->context = $context; - $this->dispatcher = $dispatcher ? $dispatcher : \Civi::service('dispatcher'); + $this->dispatcher = $dispatcher ?: \Civi::service('dispatcher'); } /** diff --git a/ext/flexmailer/src/Validator.php b/ext/flexmailer/src/Validator.php index 455d6f0538..549d028e3c 100644 --- a/ext/flexmailer/src/Validator.php +++ b/ext/flexmailer/src/Validator.php @@ -54,7 +54,7 @@ class Validator { * @param \Symfony\Component\EventDispatcher\EventDispatcherInterface $dispatcher */ public function __construct(EventDispatcherInterface $dispatcher = NULL) { - $this->dispatcher = $dispatcher ? $dispatcher : \Civi::service('dispatcher'); + $this->dispatcher = $dispatcher ?: \Civi::service('dispatcher'); } /** diff --git a/ext/legacycustomsearches/CRM/Contact/Form/Search/Custom.php b/ext/legacycustomsearches/CRM/Contact/Form/Search/Custom.php index 2e5d19a28e..942cfea4aa 100644 --- a/ext/legacycustomsearches/CRM/Contact/Form/Search/Custom.php +++ b/ext/legacycustomsearches/CRM/Contact/Form/Search/Custom.php @@ -138,7 +138,7 @@ class CRM_Contact_Form_Search_Custom extends CRM_Contact_Form_Search { $fileName = $this->_customClass->templateFile(); } - return $fileName ? $fileName : parent::getTemplateFileName(); + return $fileName ?: parent::getTemplateFileName(); } public function postProcess() {