Make WordPress Core


Ignore:
Timestamp:
09/09/2023 09:26:01 AM (15 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-includes/class-wpdb.php

    r56476 r56549  
    15401540                $l = strlen( $s );
    15411541                while ( $k <= $l && '%' === $s[ $l - $k ] ) {
    1542                     $k++;
     1542                    ++$k;
    15431543                }
    15441544
     
    16011601
    16021602            $key += 3;
    1603             $arg_id++;
     1603            ++$arg_id;
    16041604        }
    16051605
     
    16331633
    16341634                $key += 3;
    1635                 $arg_id++;
     1635                ++$arg_id;
    16361636            }
    16371637
     
    23052305                while ( $row = mysqli_fetch_object( $this->result ) ) {
    23062306                    $this->last_result[ $num_rows ] = $row;
    2307                     $num_rows++;
     2307                    ++$num_rows;
    23082308                }
    23092309            }
     
    23352335        }
    23362336
    2337         $this->num_queries++;
     2337        ++$this->num_queries;
    23382338
    23392339        if ( defined( 'SAVEQUERIES' ) && SAVEQUERIES ) {
     
    38793879                foreach ( (array) $this->col_info as $col ) {
    38803880                    $new_array[ $i ] = $col->{$info_type};
    3881                     $i++;
     3881                    ++$i;
    38823882                }
    38833883                return $new_array;
Note: See TracChangeset for help on using the changeset viewer.