Make WordPress Core

Changeset 55130


Ignore:
Timestamp:
01/24/2023 03:53:46 PM (21 months ago)
Author:
SergeyBiryukov
Message:

Code Modernization: Rename parameters that use reserved keywords in phpunit/tests/functions/wpRefererField.php.

While using reserved PHP keywords as parameter name labels is allowed, in the context of function calls using named parameters in PHP 8.0+, this will easily lead to confusion. To avoid that, it is recommended not to use reserved keywords as function parameter names.

This commit renames the $echo parameter to $display in Tests_Functions_wpRefererField::test_wp_referer_field_should_respect_display_arg().

Follow-up to [54420], [54929].

Props jrf, aristath, poena, justinahinon, SergeyBiryukov.
See #56788.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/tests/phpunit/tests/functions/wpRefererField.php

    r54855 r55130  
    3131
    3232    /**
    33      * Tests that the echo argument is respected.
     33     * Tests that the display argument is respected.
    3434     *
    3535     * @ticket 54106
    3636     *
    37      * @dataProvider data_wp_referer_field_should_respect_echo_arg
     37     * @dataProvider data_wp_referer_field_should_respect_display_arg
    3838     *
    39      * @param mixed $echo Whether to echo or return the referer field.
     39     * @param mixed $display Whether to echo or return the referer field.
    4040     */
    41     public function test_wp_referer_field_should_respect_echo_arg( $echo ) {
    42         $actual = $echo ? get_echo( 'wp_referer_field' ) : wp_referer_field( false );
     41    public function test_wp_referer_field_should_respect_display_arg( $display ) {
     42        $actual = $display ? get_echo( 'wp_referer_field' ) : wp_referer_field( false );
    4343
    4444        $this->assertSame( '<input type="hidden" name="_wp_http_referer" value="" />', $actual );
     
    4646
    4747    /**
    48      * Data provider for test_wp_referer_field_should_respect_echo_arg().
     48     * Data provider for test_wp_referer_field_should_respect_display_arg().
    4949     *
    5050     * @return array
    5151     */
    52     public function data_wp_referer_field_should_respect_echo_arg() {
     52    public function data_wp_referer_field_should_respect_display_arg() {
    5353        return array(
    5454            'true'         => array( true ),
Note: See TracChangeset for help on using the changeset viewer.