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/edit-comments.php

    r55942 r56549  
    8585            case 'approve':
    8686                wp_set_comment_status( $comment_id, 'approve' );
    87                 $approved++;
     87                ++$approved;
    8888                break;
    8989            case 'unapprove':
    9090                wp_set_comment_status( $comment_id, 'hold' );
    91                 $unapproved++;
     91                ++$unapproved;
    9292                break;
    9393            case 'spam':
    9494                wp_spam_comment( $comment_id );
    95                 $spammed++;
     95                ++$spammed;
    9696                break;
    9797            case 'unspam':
    9898                wp_unspam_comment( $comment_id );
    99                 $unspammed++;
     99                ++$unspammed;
    100100                break;
    101101            case 'trash':
    102102                wp_trash_comment( $comment_id );
    103                 $trashed++;
     103                ++$trashed;
    104104                break;
    105105            case 'untrash':
    106106                wp_untrash_comment( $comment_id );
    107                 $untrashed++;
     107                ++$untrashed;
    108108                break;
    109109            case 'delete':
    110110                wp_delete_comment( $comment_id );
    111                 $deleted++;
     111                ++$deleted;
    112112                break;
    113113        }
Note: See TracChangeset for help on using the changeset viewer.