Make WordPress Core


Ignore:
Timestamp:
06/15/2021 03:21:50 PM (3 years ago)
Author:
SergeyBiryukov
Message:

Coding Standards: Remove a one-time $message variable in some _doing_it_wrong() calls.

This brings some consistency with most other calls.

Follow-up to [23378], [25605], [34745], [36219], [44108], [46111], [48156].

See #52627.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/class-wp-block-type-registry.php

    r50419 r51154  
    5353
    5454        if ( ! is_string( $name ) ) {
    55             $message = __( 'Block type names must be strings.' );
    56             _doing_it_wrong( __METHOD__, $message, '5.0.0' );
     55            _doing_it_wrong(
     56                __METHOD__,
     57                __( 'Block type names must be strings.' ),
     58                '5.0.0'
     59            );
    5760            return false;
    5861        }
    5962
    6063        if ( preg_match( '/[A-Z]+/', $name ) ) {
    61             $message = __( 'Block type names must not contain uppercase characters.' );
    62             _doing_it_wrong( __METHOD__, $message, '5.0.0' );
     64            _doing_it_wrong(
     65                __METHOD__,
     66                __( 'Block type names must not contain uppercase characters.' ),
     67                '5.0.0'
     68            );
    6369            return false;
    6470        }
     
    6672        $name_matcher = '/^[a-z0-9-]+\/[a-z0-9-]+$/';
    6773        if ( ! preg_match( $name_matcher, $name ) ) {
    68             $message = __( 'Block type names must contain a namespace prefix. Example: my-plugin/my-custom-block-type' );
    69             _doing_it_wrong( __METHOD__, $message, '5.0.0' );
     74            _doing_it_wrong(
     75                __METHOD__,
     76                __( 'Block type names must contain a namespace prefix. Example: my-plugin/my-custom-block-type' ),
     77                '5.0.0'
     78            );
    7079            return false;
    7180        }
    7281
    7382        if ( $this->is_registered( $name ) ) {
    74             /* translators: %s: Block name. */
    75             $message = sprintf( __( 'Block type "%s" is already registered.' ), $name );
    76             _doing_it_wrong( __METHOD__, $message, '5.0.0' );
     83            _doing_it_wrong(
     84                __METHOD__,
     85                /* translators: %s: Block name. */
     86                sprintf( __( 'Block type "%s" is already registered.' ), $name ),
     87                '5.0.0'
     88            );
    7789            return false;
    7890        }
     
    102114
    103115        if ( ! $this->is_registered( $name ) ) {
    104             /* translators: %s: Block name. */
    105             $message = sprintf( __( 'Block type "%s" is not registered.' ), $name );
    106             _doing_it_wrong( __METHOD__, $message, '5.0.0' );
     116            _doing_it_wrong(
     117                __METHOD__,
     118                /* translators: %s: Block name. */
     119                sprintf( __( 'Block type "%s" is not registered.' ), $name ),
     120                '5.0.0'
     121            );
    107122            return false;
    108123        }
Note: See TracChangeset for help on using the changeset viewer.