Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[REF] - Simplify redundant calls to empty() function #32043

Closed
wants to merge 1 commit into from

Conversation

colemanw
Copy link
Member

Overview

Overly-verbose code cleanup.

Technical Details

The empty() function will automatically handle the case where the first part of the expression is not set, so there's no need to add an extra call to empty().

Copy link

civibot bot commented Feb 11, 2025

🤖 Thank you for contributing to CiviCRM! ❤️ We will need to test and review this PR. 👷

Introduction for new contributors...
  • If this is your first PR, an admin will greenlight automated testing with the command ok to test or add to whitelist.
  • A series of tests will automatically run. You can see the results at the bottom of this page (if there are any problems, it will include a link to see what went wrong).
  • A demo site will be built where anyone can try out a version of CiviCRM that includes your changes.
  • If this process needs to be repeated, an admin will issue the command test this please to rerun tests and build a new demo site.
  • Before this PR can be merged, it needs to be reviewed. Please keep in mind that reviewers are volunteers, and their response time can vary from a few hours to a few weeks depending on their availability and their knowledge of this particular part of CiviCRM.
  • A great way to speed up this process is to "trade reviews" with someone - find an open PR that you feel able to review, and leave a comment like "I'm reviewing this now, could you please review mine?" (include a link to yours). You don't have to wait for a response to get started (and you don't have to stop at one!) the more you review, the faster this process goes for everyone 😄
  • To ensure that you are credited properly in the final release notes, please add yourself to contributor-key.yml
  • For more information about contributing, see CONTRIBUTING.md.
Quick links for reviewers...

➡️ Online demo of this PR 🔗

@civibot civibot bot added the master label Feb 11, 2025
The `empty()` function will automatically handle the case where the first part
of the expression is not set, so there's no need to add an extra call to `empty()`.
@colemanw
Copy link
Member Author

@civicrm-builder retest this please

@@ -112,7 +112,7 @@ public static function getTypeAttributes(SimpleXMLElement $fieldXML) {
*/
public static function getSize(SimpleXMLElement $fieldXML): string {
// Extract from <size> tag if supplied
if (!empty($fieldXML->html) && !empty($fieldXML->html->size)) {
if (!empty($fieldXML->html->size)) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

wouldn't this one still get upset?

@@ -39,7 +39,7 @@ public function __construct($title = NULL, $action = CRM_Core_Action::NONE, $mod
if ($mid && $continue) {
//CRM-15979 - check if abtest exist for mailing then redirect accordingly
$abtest = CRM_Mailing_BAO_MailingAB::getABTest($mid);
if (!empty($abtest) && !empty($abtest->id)) {
if (!empty($abtest->id)) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I feel like this would upset php 8.x if $abtest is null

@colemanw colemanw closed this Feb 12, 2025
@colemanw
Copy link
Member Author

@eileenmcnaughton I did a little more research and reports are mixed about how safe this change would be. Better leave it alone.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants