Make WordPress Core


Ignore:
Timestamp:
09/09/2023 09:26:01 AM (8 months ago)
Author:
SergeyBiryukov
Message:

Coding Standards: Use pre-increment/decrement for stand-alone statements.

Note: This is enforced by WPCS 3.0.0:

  1. There should be no space between an increment/decrement operator and the variable it applies to.
  2. Pre-increment/decrement should be favoured over post-increment/decrement for stand-alone statements. “Pre” will in/decrement and then return, “post” will return and then in/decrement. Using the “pre” version is slightly more performant and can prevent future bugs when code gets moved around.

References:

Props jrf.
See #59161, #58831.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-admin/includes/class-wp-site-health.php

    r56547 r56549  
    382382        // Loop over the available plugins and check their versions and active state.
    383383        foreach ( $plugins as $plugin_path => $plugin ) {
    384             $plugins_total++;
     384            ++$plugins_total;
    385385
    386386            if ( is_plugin_active( $plugin_path ) ) {
    387                 $plugins_active++;
     387                ++$plugins_active;
    388388            }
    389389
    390390            if ( array_key_exists( $plugin_path, $plugin_updates ) ) {
    391                 $plugins_need_update++;
     391                ++$plugins_need_update;
    392392            }
    393393        }
     
    544544
    545545        foreach ( $all_themes as $theme_slug => $theme ) {
    546             $themes_total++;
     546            ++$themes_total;
    547547
    548548            if ( array_key_exists( $theme_slug, $theme_updates ) ) {
    549                 $themes_need_updates++;
     549                ++$themes_need_updates;
    550550            }
    551551        }
     
    553553        // If this is a child theme, increase the allowed theme count by one, to account for the parent.
    554554        if ( is_child_theme() ) {
    555             $allowed_theme_count++;
     555            ++$allowed_theme_count;
    556556        }
    557557
    558558        // If there's a default theme installed and not in use, we count that as allowed as well.
    559559        if ( $has_default_theme && ! $using_default_theme ) {
    560             $allowed_theme_count++;
     560            ++$allowed_theme_count;
    561561        }
    562562
     
    32943294        foreach ( $results as $result ) {
    32953295            if ( 'critical' === $result['status'] ) {
    3296                 $site_status['critical']++;
     3296                ++$site_status['critical'];
    32973297            } elseif ( 'recommended' === $result['status'] ) {
    3298                 $site_status['recommended']++;
     3298                ++$site_status['recommended'];
    32993299            } else {
    3300                 $site_status['good']++;
     3300                ++$site_status['good'];
    33013301            }
    33023302        }
Note: See TracChangeset for help on using the changeset viewer.