Skip to content

Commit 384eda9

Browse files
committed
Fix PHP code style violations in feature files
1 parent f5a29a2 commit 384eda9

8 files changed

Lines changed: 67 additions & 64 deletions

features/comment-recount.feature

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ Feature: Recount comments on a post
1515
"""
1616
<?php
1717
global $wpdb;
18-
$wpdb->update( $wpdb->posts, array( "comment_count" => 1 ), array( "ID" => 1 ) );
18+
$wpdb->update( $wpdb->posts, array( 'comment_count' => 1 ), array( 'ID' => 1 ) );
1919
clean_post_cache( 1 );
2020
"""
2121
When I run `wp eval-file recount-comments.php`

features/option-pluck-patch.feature

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -276,9 +276,9 @@ Feature: Option commands have pluck and patch.
276276
And a setup.php file:
277277
"""
278278
<?php
279-
$option = new stdClass;
279+
$option = new stdClass();
280280
$option->test_mode = 0;
281-
$ret = update_option( 'wp_cli_test', $option );
281+
$ret = update_option( 'wp_cli_test', $option );
282282
"""
283283
And I run `wp eval-file setup.php`
284284

features/post-block.feature

Lines changed: 16 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -565,17 +565,22 @@ Feature: Manage blocks in post content
565565
And a custom-sync-filter.php file:
566566
"""
567567
<?php
568-
WP_CLI::add_wp_hook( 'wp_cli_post_block_update_html', function( $block, $new_attrs, $block_name ) {
569-
if ( 'core/paragraph' === $block_name && isset( $new_attrs['customClass'] ) ) {
570-
$block['innerHTML'] = preg_replace(
571-
'/<p([^>]*)>/',
572-
'<p class="' . esc_attr( $new_attrs['customClass'] ) . '"$1>',
573-
$block['innerHTML']
574-
);
575-
$block['innerContent'] = [ $block['innerHTML'] ];
576-
}
577-
return $block;
578-
}, 10, 3 );
568+
WP_CLI::add_wp_hook(
569+
'wp_cli_post_block_update_html',
570+
function ( $block, $new_attrs, $block_name ) {
571+
if ( 'core/paragraph' === $block_name && isset( $new_attrs['customClass'] ) ) {
572+
$block['innerHTML'] = preg_replace(
573+
'/<p([^>]*)>/',
574+
'<p class="' . esc_attr( $new_attrs['customClass'] ) . '"$1>',
575+
$block['innerHTML']
576+
);
577+
$block['innerContent'] = [ $block['innerHTML'] ];
578+
}
579+
return $block;
580+
},
581+
10,
582+
3
583+
);
579584
"""
580585
When I run `wp post create --post_title="Block Post" --post_content="<!-- wp:paragraph --><p>Hello World</p><!-- /wp:paragraph -->" --porcelain`
581586
Then save STDOUT as {POST_ID}

features/post-meta.feature

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -182,7 +182,7 @@ Feature: Manage post custom fields
182182
And a setup.php file:
183183
"""
184184
<?php
185-
update_post_meta( 1, 'foo', NULL );
185+
update_post_meta( 1, 'foo', null );
186186
"""
187187
And I run `wp eval-file setup.php`
188188

features/taxonomy.feature

Lines changed: 32 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -54,22 +54,22 @@ Feature: Manage WordPress taxonomies
5454
"""
5555
<?php
5656
// Plugin Name: Test Taxonomy Strict/No-Strict Mode
57-
58-
add_action( 'init', function() {
59-
$args = array(
60-
'hierarchical' => true,
61-
'show_ui' => true,
62-
'show_admin_column' => true,
63-
'update_count_callback' => '_update_post_term_count',
64-
'query_var' => true,
65-
'labels' => array(
66-
'name' => _x( 'Genres', 'taxonomy general name', 'textdomain' ),
67-
),
68-
69-
);
70-
71-
register_taxonomy( 'genres', array( 'post','page' ), $args );
72-
} );
57+
add_action(
58+
'init',
59+
function () {
60+
$args = array(
61+
'hierarchical' => true,
62+
'show_ui' => true,
63+
'show_admin_column' => true,
64+
'update_count_callback' => '_update_post_term_count',
65+
'query_var' => true,
66+
'labels' => array(
67+
'name' => _x( 'Genres', 'taxonomy general name', 'textdomain' ),
68+
),
69+
);
70+
register_taxonomy( 'genres', array( 'post', 'page' ), $args );
71+
}
72+
);
7373
"""
7474

7575
When I run `wp taxonomy list --object_type=post --strict`
@@ -94,22 +94,22 @@ Feature: Manage WordPress taxonomies
9494
"""
9595
<?php
9696
// Plugin Name: Test Taxonomy Strict/No-Strict Mode
97-
98-
add_action( 'init', function() {
99-
$args = array(
100-
'hierarchical' => true,
101-
'show_ui' => true,
102-
'show_admin_column' => true,
103-
'update_count_callback' => '_update_post_term_count',
104-
'query_var' => true,
105-
'labels' => array(
106-
'name' => _x( 'Genres', 'taxonomy general name', 'textdomain' ),
107-
),
108-
109-
);
110-
111-
register_taxonomy( 'genres', array( 'post','page' ), $args );
112-
} );
97+
add_action(
98+
'init',
99+
function () {
100+
$args = array(
101+
'hierarchical' => true,
102+
'show_ui' => true,
103+
'show_admin_column' => true,
104+
'update_count_callback' => '_update_post_term_count',
105+
'query_var' => true,
106+
'labels' => array(
107+
'name' => _x( 'Genres', 'taxonomy general name', 'textdomain' ),
108+
),
109+
);
110+
register_taxonomy( 'genres', array( 'post', 'page' ), $args );
111+
}
112+
);
113113
"""
114114

115115
When I run `wp taxonomy list --object_type=post --strict`

features/term-migrate.feature

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -95,11 +95,13 @@ Feature: Migrate term custom fields
9595
"""
9696
<?php
9797
// Plugin Name: Test Migrate
98-
99-
add_action( 'init', function() {
100-
register_post_type( 'news', [ 'public' => true ] );
101-
register_taxonomy( 'topic', 'news', [ 'public' => true ] );
102-
} );
98+
add_action(
99+
'init',
100+
function () {
101+
register_post_type( 'news', [ 'public' => true ] );
102+
register_taxonomy( 'topic', 'news', [ 'public' => true ] );
103+
}
104+
);
103105
"""
104106

105107
When I run `wp term create category grape`

features/term-recount.feature

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,8 +44,8 @@ Feature: Recount terms on a taxonomy
4444
"""
4545
<?php
4646
global $wpdb;
47-
$wpdb->update( $wpdb->term_taxonomy, array( "count" => 3 ), array( "term_id" => {TERM_ID} ) );
48-
clean_term_cache( {TERM_ID}, "category" );
47+
$wpdb->update( $wpdb->term_taxonomy, array( 'count' => 3 ), array( 'term_id' => {TERM_ID} ) );
48+
clean_term_cache( {TERM_ID}, 'category' );
4949
"""
5050
When I run `wp eval-file recount-terms.php`
5151
And I run `wp term get category {TERM_ID} --field=count`

features/user-term.feature

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,10 @@ Feature: Manage user term
66
"""
77
<?php
88
// Plugin Name: Test Add Tax
9-
10-
function add_cli_tax(){
11-
register_taxonomy( 'user_type', 'user' );
9+
function add_cli_tax() {
10+
register_taxonomy( 'user_type', 'user' );
1211
}
13-
14-
add_action('init','add_cli_tax');
12+
add_action( 'init', 'add_cli_tax' );
1513
"""
1614
And I run `wp plugin activate test-add-tax`
1715

@@ -75,12 +73,10 @@ Feature: Manage user term
7573
"""
7674
<?php
7775
// Plugin Name: Test Add Tax
78-
79-
function add_cli_tax(){
80-
register_taxonomy( 'user_type', 'user' );
76+
function add_cli_tax() {
77+
register_taxonomy( 'user_type', 'user' );
8178
}
82-
83-
add_action('init','add_cli_tax');
79+
add_action( 'init', 'add_cli_tax' );
8480
"""
8581
And I run `wp plugin activate test-add-tax`
8682

0 commit comments

Comments
 (0)