WordPress.org

Make WordPress Core


Ignore:
Timestamp:
11/30/2017 11:09:33 PM (3 years ago)
Author:
pento
Message:

Code is Poetry.
WordPress' code just... wasn't.
This is now dealt with.

Props jrf, pento, netweb, GaryJ, jdgrimes, westonruter, Greg Sherwood from PHPCS, and everyone who's ever contributed to WPCS and PHPCS.
Fixes #41057.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/tests/phpunit/tests/actions/closures.php

    r38763 r42343  
    1212     */
    1313    function test_action_closure() {
    14         $tag = 'test_action_closure';
    15         $closure = function($a, $b) { $GLOBALS[$a] = $b;};
    16         add_action($tag, $closure, 10, 2);
     14        $tag     = 'test_action_closure';
     15        $closure = function( $a, $b ) {
     16            $GLOBALS[ $a ] = $b;
     17        };
     18        add_action( $tag, $closure, 10, 2 );
    1719
    18         $this->assertSame( 10, has_action($tag, $closure) );
     20        $this->assertSame( 10, has_action( $tag, $closure ) );
    1921
    2022        $context = array( 'val1', 'val2' );
    21         do_action($tag, $context[0], $context[1]);
     23        do_action( $tag, $context[0], $context[1] );
    2224
    23         $this->assertSame($GLOBALS[$context[0]], $context[1]);
     25        $this->assertSame( $GLOBALS[ $context[0] ], $context[1] );
    2426
    25         $tag2 = 'test_action_closure_2';
    26         $closure2 = function() { $GLOBALS['closure_no_args'] = true;};
    27         add_action($tag2, $closure2);
     27        $tag2     = 'test_action_closure_2';
     28        $closure2 = function() {
     29            $GLOBALS['closure_no_args'] = true;
     30        };
     31        add_action( $tag2, $closure2 );
    2832
    29         $this->assertSame( 10, has_action($tag2, $closure2) );
     33        $this->assertSame( 10, has_action( $tag2, $closure2 ) );
    3034
    31         do_action($tag2);
     35        do_action( $tag2 );
    3236
    33         $this->assertTrue($GLOBALS['closure_no_args']);
     37        $this->assertTrue( $GLOBALS['closure_no_args'] );
    3438
    3539        remove_action( $tag, $closure );
Note: See TracChangeset for help on using the changeset viewer.