Skip to content

Commit

Permalink
Merge pull request #710 from equalizedigital/william/no-issue/inline-…
Browse files Browse the repository at this point in the history
…single-use-vars-before-returns

Inline some single use variables at function returns
  • Loading branch information
pattonwebz authored Jul 12, 2024
2 parents 79b9fa2 + a563dee commit e63742f
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 18 deletions.
4 changes: 1 addition & 3 deletions admin/class-helpers.php
Original file line number Diff line number Diff line change
Expand Up @@ -120,9 +120,7 @@ public static function format_date( $date, $include_time = false ) {
}
}

$formatted_date = $datetime->format( $format );

return $formatted_date;
return $datetime->format( $format );
}

/**
Expand Down
4 changes: 1 addition & 3 deletions admin/class-issues-query.php
Original file line number Diff line number Diff line change
Expand Up @@ -125,9 +125,7 @@ public function __construct( $filter = [], $record_limit = 100000, $flags = self
* @return string $sql .
*/
public function get_sql() {
$sql = $this->query['select'] . ' ' . $this->query['from'] . ' ' . $this->query['where_base'] . ' ' . $this->query['filters'] . ' ' . $this->query['limit'];

return $sql;
return $this->query['select'] . ' ' . $this->query['from'] . ' ' . $this->query['where_base'] . ' ' . $this->query['filters'] . ' ' . $this->query['limit'];
}


Expand Down
18 changes: 6 additions & 12 deletions includes/helper-functions.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,8 @@ function edac_compare_strings( $string1, $string2 ) {
$content = str_ireplace( $remove_text, '', $content );
$content = wp_strip_all_tags( $content );
$content = trim( $content, " \t\n\r\0\x0B\xC2\xA0" );
$content = html_entity_decode( $content );

return $content;
return html_entity_decode( $content );
};

return $prepare_strings( $string1 ) === $prepare_strings( $string2 );
Expand Down Expand Up @@ -138,8 +137,7 @@ function edac_ordinal( $number ) {
function edac_simple_dom_remove_child( simple_html_dom_node $parent_node ) {
$parent_node->innertext = '';

$error = $parent_node->save();
return $error;
return $parent_node->save();
}

/**
Expand Down Expand Up @@ -210,9 +208,7 @@ function edac_is_gutenberg_active() {
return true;
}

$use_block_editor = ( get_option( 'classic-editor-replace' ) === 'no-replace' );

return $use_block_editor;
return ( get_option( 'classic-editor-replace' ) === 'no-replace' );
}

/**
Expand Down Expand Up @@ -275,9 +271,7 @@ function edac_custom_post_types() {
$output = 'names'; // names or objects, note names is the default.
$operator = 'and'; // Options 'and' or 'or'.

$post_types = get_post_types( $args, $output, $operator );

return $post_types;
return get_post_types( $args, $output, $operator );
}

/**
Expand Down Expand Up @@ -477,8 +471,8 @@ function edac_generate_nonce( $secret, $timeout_seconds = 120 ) {

$time = time();
$max_time = $time + $timeout_seconds;
$nonce = $salt . ',' . $max_time . ',' . sha1( $salt . $secret . $max_time );
return $nonce;

return $salt . ',' . $max_time . ',' . sha1( $salt . $secret . $max_time );
}

/**
Expand Down

0 comments on commit e63742f

Please sign in to comment.