Skip to content

Commit f719f69

Browse files
committed
PHPCS: Fix up errors in entity-command.php and tests directory
1 parent 7087a84 commit f719f69

File tree

2 files changed

+72
-52
lines changed

2 files changed

+72
-52
lines changed

entity-command.php

Lines changed: 59 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -4,63 +4,83 @@
44
return;
55
}
66

7-
$autoload = dirname( __FILE__ ) . '/vendor/autoload.php';
8-
if ( file_exists( $autoload ) ) {
9-
require_once $autoload;
7+
$wpcli_entity_autoloader = dirname( __FILE__ ) . '/vendor/autoload.php';
8+
if ( file_exists( $wpcli_entity_autoloader ) ) {
9+
require_once $wpcli_entity_autoloader;
1010
}
1111

1212
WP_CLI::add_command( 'comment', 'Comment_Command' );
1313
WP_CLI::add_command( 'comment meta', 'Comment_Meta_Command' );
1414
WP_CLI::add_command( 'menu', 'Menu_Command' );
1515
WP_CLI::add_command( 'menu item', 'Menu_Item_Command' );
1616
WP_CLI::add_command( 'menu location', 'Menu_Location_Command' );
17-
WP_CLI::add_command( 'network meta', 'Network_Meta_Command', array(
18-
'before_invoke' => function () {
19-
if ( !is_multisite() ) {
20-
WP_CLI::error( 'This is not a multisite installation.' );
21-
}
22-
}
23-
) );
17+
WP_CLI::add_command(
18+
'network meta',
19+
'Network_Meta_Command',
20+
array(
21+
'before_invoke' => function () {
22+
if ( ! is_multisite() ) {
23+
WP_CLI::error( 'This is not a multisite installation.' );
24+
}
25+
},
26+
)
27+
);
2428
WP_CLI::add_command( 'option', 'Option_Command' );
2529
WP_CLI::add_command( 'post', 'Post_Command' );
2630
WP_CLI::add_command( 'post meta', 'Post_Meta_Command' );
2731
WP_CLI::add_command( 'post term', 'Post_Term_Command' );
2832
WP_CLI::add_command( 'post-type', 'Post_Type_Command' );
2933
WP_CLI::add_command( 'site', 'Site_Command' );
30-
WP_CLI::add_command( 'site meta', 'Site_Meta_Command', array(
31-
'before_invoke' => function() {
32-
if ( !is_multisite() ) {
33-
WP_CLI::error( 'This is not a multisite installation.' );
34-
}
35-
if( ! function_exists('is_site_meta_supported') || ! is_site_meta_supported() ){
36-
WP_CLI::error( sprintf( 'The %s table is not installed. Please run the network database upgrade.', $GLOBALS['wpdb']->blogmeta ) );
37-
}
38-
}
39-
) );
40-
WP_CLI::add_command( 'site option', 'Site_Option_Command', array(
41-
'before_invoke' => function() {
42-
if ( !is_multisite() ) {
43-
WP_CLI::error( 'This is not a multisite installation.' );
44-
}
45-
}
46-
) );
34+
WP_CLI::add_command(
35+
'site meta',
36+
'Site_Meta_Command',
37+
array(
38+
'before_invoke' => function() {
39+
if ( ! is_multisite() ) {
40+
WP_CLI::error( 'This is not a multisite installation.' );
41+
}
42+
if ( ! function_exists( 'is_site_meta_supported' ) || ! is_site_meta_supported() ) {
43+
WP_CLI::error( sprintf( 'The %s table is not installed. Please run the network database upgrade.', $GLOBALS['wpdb']->blogmeta ) );
44+
}
45+
},
46+
)
47+
);
48+
WP_CLI::add_command(
49+
'site option',
50+
'Site_Option_Command',
51+
array(
52+
'before_invoke' => function() {
53+
if ( ! is_multisite() ) {
54+
WP_CLI::error( 'This is not a multisite installation.' );
55+
}
56+
},
57+
)
58+
);
4759
WP_CLI::add_command( 'taxonomy', 'Taxonomy_Command' );
4860
WP_CLI::add_command( 'term', 'Term_Command' );
49-
WP_CLI::add_command( 'term meta', 'Term_Meta_Command', array(
50-
'before_invoke' => function() {
51-
if ( \WP_CLI\Utils\wp_version_compare( '4.4', '<' ) ) {
52-
WP_CLI::error( "Requires WordPress 4.4 or greater." );
53-
}
54-
})
61+
WP_CLI::add_command(
62+
'term meta',
63+
'Term_Meta_Command',
64+
array(
65+
'before_invoke' => function() {
66+
if ( \WP_CLI\Utils\wp_version_compare( '4.4', '<' ) ) {
67+
WP_CLI::error( 'Requires WordPress 4.4 or greater.' );
68+
}
69+
},
70+
)
5571
);
5672
WP_CLI::add_command( 'user', 'User_Command' );
5773
WP_CLI::add_command( 'user meta', 'User_Meta_Command' );
58-
WP_CLI::add_command( 'user session', 'User_Session_Command', array(
59-
'before_invoke' => function() {
60-
if ( \WP_CLI\Utils\wp_version_compare( '4.0', '<' ) ) {
61-
WP_CLI::error( "Requires WordPress 4.0 or greater." );
62-
}
63-
})
74+
WP_CLI::add_command(
75+
'user session',
76+
'User_Session_Command',
77+
array(
78+
'before_invoke' => function() {
79+
if ( \WP_CLI\Utils\wp_version_compare( '4.0', '<' ) ) {
80+
WP_CLI::error( 'Requires WordPress 4.0 or greater.' );
81+
}
82+
},
83+
)
6484
);
6585

6686
WP_CLI::add_command( 'user term', 'User_Term_Command' );

tests/RecursiveDataStructureTraverserTest.php

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
class RecursiveDataStructureTraverserTest extends \PHPUnit_Framework_TestCase {
88

99
/** @test */
10-
function it_can_get_a_top_level_array_value() {
10+
public function it_can_get_a_top_level_array_value() {
1111
$array = array(
1212
'foo' => 'bar',
1313
);
@@ -18,7 +18,7 @@ function it_can_get_a_top_level_array_value() {
1818
}
1919

2020
/** @test */
21-
function it_can_get_a_top_level_object_value() {
21+
public function it_can_get_a_top_level_object_value() {
2222
$object = (object) array(
2323
'foo' => 'bar',
2424
);
@@ -29,11 +29,11 @@ function it_can_get_a_top_level_object_value() {
2929
}
3030

3131
/** @test */
32-
function it_can_get_a_nested_array_value() {
32+
public function it_can_get_a_nested_array_value() {
3333
$array = array(
3434
'foo' => array(
3535
'bar' => array(
36-
'baz' => 'value'
36+
'baz' => 'value',
3737
),
3838
),
3939
);
@@ -44,7 +44,7 @@ function it_can_get_a_nested_array_value() {
4444
}
4545

4646
/** @test */
47-
function it_can_get_a_nested_object_value() {
47+
public function it_can_get_a_nested_object_value() {
4848
$object = (object) array(
4949
'foo' => (object) array(
5050
'bar' => 'baz',
@@ -57,7 +57,7 @@ function it_can_get_a_nested_object_value() {
5757
}
5858

5959
/** @test */
60-
function it_can_set_a_nested_array_value() {
60+
public function it_can_set_a_nested_array_value() {
6161
$array = array(
6262
'foo' => array(
6363
'bar' => 'baz',
@@ -72,7 +72,7 @@ function it_can_set_a_nested_array_value() {
7272
}
7373

7474
/** @test */
75-
function it_can_set_a_nested_object_value() {
75+
public function it_can_set_a_nested_object_value() {
7676
$object = (object) array(
7777
'foo' => (object) array(
7878
'bar' => 'baz',
@@ -87,7 +87,7 @@ function it_can_set_a_nested_object_value() {
8787
}
8888

8989
/** @test */
90-
function it_can_update_an_integer_object_value() {
90+
public function it_can_update_an_integer_object_value() {
9191
$object = (object) array(
9292
'test_mode' => 0,
9393
);
@@ -100,7 +100,7 @@ function it_can_update_an_integer_object_value() {
100100
}
101101

102102
/** @test */
103-
function it_can_delete_a_nested_array_value() {
103+
public function it_can_delete_a_nested_array_value() {
104104
$array = array(
105105
'foo' => array(
106106
'bar' => 'baz',
@@ -115,7 +115,7 @@ function it_can_delete_a_nested_array_value() {
115115
}
116116

117117
/** @test */
118-
function it_can_delete_a_nested_object_value() {
118+
public function it_can_delete_a_nested_object_value() {
119119
$object = (object) array(
120120
'foo' => (object) array(
121121
'bar' => 'baz',
@@ -130,7 +130,7 @@ function it_can_delete_a_nested_object_value() {
130130
}
131131

132132
/** @test */
133-
function it_can_insert_a_key_into_a_nested_array() {
133+
public function it_can_insert_a_key_into_a_nested_array() {
134134
$array = array(
135135
'foo' => array(
136136
'bar' => 'baz',
@@ -145,8 +145,8 @@ function it_can_insert_a_key_into_a_nested_array() {
145145
}
146146

147147
/** @test */
148-
function it_throws_an_exception_when_attempting_to_create_a_key_on_an_invalid_type() {
149-
$data = 'a string';
148+
public function it_throws_an_exception_when_attempting_to_create_a_key_on_an_invalid_type() {
149+
$data = 'a string';
150150
$traverser = new RecursiveDataStructureTraverser( $data );
151151

152152
try {

0 commit comments

Comments
 (0)