Make WordPress Core


Ignore:
Timestamp:
09/09/2023 09:26:01 AM (17 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/pomo/plural-forms.php

    r54133 r56549  
    111111                    case ' ':
    112112                    case "\t":
    113                         $pos++;
     113                        ++$pos;
    114114                        break;
    115115
     
    117117                    case 'n':
    118118                        $output[] = array( 'var' );
    119                         $pos++;
     119                        ++$pos;
    120120                        break;
    121121
     
    123123                    case '(':
    124124                        $stack[] = $next;
    125                         $pos++;
     125                        ++$pos;
    126126                        break;
    127127
     
    145145                        }
    146146
    147                         $pos++;
     147                        ++$pos;
    148148                        break;
    149149
     
    190190                            if ( '?' !== $o2 ) {
    191191                                $output[] = array( 'op', array_pop( $stack ) );
    192                                 $s_pos--;
     192                                --$s_pos;
    193193                                continue;
    194194                            }
     
    203203                            throw new Exception( 'Missing starting "?" ternary operator' );
    204204                        }
    205                         $pos++;
     205                        ++$pos;
    206206                        break;
    207207
     
    265265            while ( $i < $total ) {
    266266                $next = $this->tokens[ $i ];
    267                 $i++;
     267                ++$i;
    268268                if ( 'var' === $next[0] ) {
    269269                    $stack[] = $n;
Note: See TracChangeset for help on using the changeset viewer.