Skip to:
Content

bbPress.org


Ignore:
Timestamp:
11/14/2025 04:17:43 PM (5 months ago)
Author:
johnjamesjacoby
Message:

Tools - Build: Clean-up PHPCS, and enforce Yoda conditionals.

This commit includes changes to various PHP files, Composer requirements, and PHPCS config, to confirm that the WordPress.PHP.YodaConditions code sniff passes.

Props sirlouen.

In trunk, for 2.7.

Fixes #3613.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/includes/admin/topics.php

    r7190 r7352  
    539539        $anonymous_data = bbp_filter_anonymous_post_data();
    540540        $author_id      = bbp_get_topic_author_id( $topic_id );
    541         $is_edit        = ( isset( $_POST['hidden_post_status'] ) && ( $_POST['hidden_post_status'] !== 'draft' ) );
     541        $is_edit        = ( isset( $_POST['hidden_post_status'] ) && ( 'draft' !== $_POST['hidden_post_status'] ) );
    542542
    543543        // Formally update the topic
     
    710710        switch ( $notice ) {
    711711            case 'opened'    :
    712                 $message = ( $is_failure === true )
     712                $message = ( true === $is_failure )
    713713                    ? sprintf( esc_html__( 'There was a problem opening the topic "%1$s".', 'bbpress' ), $topic_title )
    714714                    : sprintf( esc_html__( 'Topic "%1$s" successfully opened.',             'bbpress' ), $topic_title );
     
    716716
    717717            case 'closed'    :
    718                 $message = ( $is_failure === true )
     718                $message = ( true === $is_failure )
    719719                    ? sprintf( esc_html__( 'There was a problem closing the topic "%1$s".', 'bbpress' ), $topic_title )
    720720                    : sprintf( esc_html__( 'Topic "%1$s" successfully closed.',             'bbpress' ), $topic_title );
     
    722722
    723723            case 'super_sticky' :
    724                 $message = ( $is_failure === true )
     724                $message = ( true ===  $is_failure )
    725725                    ? sprintf( esc_html__( 'There was a problem sticking the topic "%1$s" to front.', 'bbpress' ), $topic_title )
    726726                    : sprintf( esc_html__( 'Topic "%1$s" successfully stuck to front.',               'bbpress' ), $topic_title );
     
    728728
    729729            case 'stuck'   :
    730                 $message = ( $is_failure === true )
     730                $message = ( true === $is_failure )
    731731                    ? sprintf( esc_html__( 'There was a problem sticking the topic "%1$s".', 'bbpress' ), $topic_title )
    732732                    : sprintf( esc_html__( 'Topic "%1$s" successfully stuck.',               'bbpress' ), $topic_title );
     
    734734
    735735            case 'unstuck' :
    736                 $message = ( $is_failure === true )
     736                $message = ( true === $is_failure )
    737737                    ? sprintf( esc_html__( 'There was a problem unsticking the topic "%1$s".', 'bbpress' ), $topic_title )
    738738                    : sprintf( esc_html__( 'Topic "%1$s" successfully unstuck.',               'bbpress' ), $topic_title );
     
    740740
    741741            case 'spammed'   :
    742                 $message = ( $is_failure === true )
     742                $message = ( true === $is_failure )
    743743                    ? sprintf( esc_html__( 'There was a problem marking the topic "%1$s" as spam.', 'bbpress' ), $topic_title )
    744744                    : sprintf( esc_html__( 'Topic "%1$s" successfully marked as spam.',             'bbpress' ), $topic_title );
     
    746746
    747747            case 'unspammed' :
    748                 $message = ( $is_failure === true )
     748                $message = ( true === $is_failure )
    749749                    ? sprintf( esc_html__( 'There was a problem unmarking the topic "%1$s" as spam.', 'bbpress' ), $topic_title )
    750750                    : sprintf( esc_html__( 'Topic "%1$s" successfully unmarked as spam.',             'bbpress' ), $topic_title );
     
    752752
    753753            case 'approved'   :
    754                 $message = ( $is_failure === true )
     754                $message = ( true === $is_failure )
    755755                    ? sprintf( esc_html__( 'There was a problem approving the topic "%1$s".', 'bbpress' ), $topic_title )
    756756                    : sprintf( esc_html__( 'Topic "%1$s" successfully approved.',             'bbpress' ), $topic_title );
     
    758758
    759759            case 'unapproved' :
    760                 $message = ( $is_failure === true )
     760                $message = ( true === $is_failure )
    761761                    ? sprintf( esc_html__( 'There was a problem unapproving the topic "%1$s".', 'bbpress' ), $topic_title )
    762762                    : sprintf( esc_html__( 'Topic "%1$s" successfully unapproved.',             'bbpress' ), $topic_title );
     
    766766        // Do additional topic toggle notice filters (admin side)
    767767        $message = apply_filters( 'bbp_toggle_topic_notice_admin', $message, $topic_id, $notice, $is_failure );
    768         $class   = ( $is_failure === true )
     768        $class   = ( true === $is_failure )
    769769            ? 'error'
    770770            : 'updated';
Note: See TracChangeset for help on using the changeset viewer.