Skip to content

Commit bd34412

Browse files
committed
CS fixes
1 parent 82a4da3 commit bd34412

9 files changed

+84
-63
lines changed

templates/block-php.mustache

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -31,14 +31,14 @@ function {{machine_name}}_block_init() {
3131
plugins_url( $index_js, __FILE__ ),
3232
{{/plugin}}
3333
{{#theme}}
34-
get_stylesheet_directory_uri() . "/blocks/$index_js",
34+
get_stylesheet_directory_uri() . "/blocks/{$index_js}",
3535
{{/theme}}
36-
array(
36+
[
3737
'wp-blocks',
3838
'wp-i18n',
3939
'wp-element',
40-
),
41-
filemtime( "$dir/$index_js" )
40+
],
41+
filemtime( "{$dir}/{$index_js}" )
4242
);
4343

4444
$editor_css = '{{slug}}/editor.css';
@@ -48,10 +48,10 @@ function {{machine_name}}_block_init() {
4848
plugins_url( $editor_css, __FILE__ ),
4949
{{/plugin}}
5050
{{#theme}}
51-
get_stylesheet_directory_uri() . "/blocks/$editor_css",
51+
get_stylesheet_directory_uri() . "/blocks/{$editor_css}",
5252
{{/theme}}
53-
array(),
54-
filemtime( "$dir/$editor_css" )
53+
[],
54+
filemtime( "{$dir}/{$editor_css}" )
5555
);
5656

5757
$style_css = '{{slug}}/style.css';
@@ -61,16 +61,17 @@ function {{machine_name}}_block_init() {
6161
plugins_url( $style_css, __FILE__ ),
6262
{{/plugin}}
6363
{{#theme}}
64-
get_stylesheet_directory_uri() . "/blocks/$style_css",
64+
get_stylesheet_directory_uri() . "/blocks/{$style_css}",
6565
{{/theme}}
66-
array(),
67-
filemtime( "$dir/$style_css" )
66+
[],
67+
filemtime( "{$dir}/{$style_css}" )
6868
);
6969

70-
register_block_type( '{{namespace}}/{{slug}}', array(
70+
register_block_type( '{{namespace}}/{{slug}}', [
7171
'editor_script' => '{{slug}}-block-editor',
7272
'editor_style' => '{{slug}}-block-editor',
7373
'style' => '{{slug}}-block',
74-
) );
74+
] );
7575
}
76+
7677
add_action( 'init', '{{machine_name}}_block_init' );

templates/child_theme_functions.mustache

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?php
22
/**
3-
* {{theme_name}} Theme functions and definitions
3+
* {{theme_name}} Theme functions and definitions.
44
*
55
* @link https://developer.wordpress.org/themes/basics/theme-functions/
66
*
@@ -16,7 +16,6 @@ function {{parent_theme_function_safe}}_parent_theme_enqueue_styles() {
1616
wp_enqueue_style( '{{parent_theme}}-style', get_template_directory_uri() . '/style.css' );
1717
wp_enqueue_style( '{{slug}}-style',
1818
get_stylesheet_directory_uri() . '/style.css',
19-
array( '{{parent_theme}}-style' )
19+
[ '{{parent_theme}}-style' ]
2020
);
21-
2221
}
Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?php
22
/**
3-
* PHPUnit bootstrap file
3+
* PHPUnit bootstrap file.
44
*
55
* @package {{plugin_package}}
66
*/
@@ -11,21 +11,22 @@ if ( ! $_tests_dir ) {
1111
$_tests_dir = rtrim( sys_get_temp_dir(), '/\\' ) . '/wordpress-tests-lib';
1212
}
1313

14-
if ( ! file_exists( $_tests_dir . '/includes/functions.php' ) ) {
15-
echo "Could not find $_tests_dir/includes/functions.php, have you run bin/install-wp-tests.sh ?" . PHP_EOL; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
14+
if ( ! file_exists( "{$_tests_dir}/includes/functions.php" ) ) {
15+
echo "Could not find {$_tests_dir}/includes/functions.php, have you run bin/install-wp-tests.sh ?" . PHP_EOL; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
1616
exit( 1 );
1717
}
1818

1919
// Give access to tests_add_filter() function.
20-
require_once $_tests_dir . '/includes/functions.php';
20+
require_once "{$_tests_dir}/includes/functions.php";
2121

2222
/**
2323
* Manually load the plugin being tested.
2424
*/
2525
function _manually_load_plugin() {
2626
require dirname( dirname( __FILE__ ) ) . '/{{plugin_slug}}.php';
2727
}
28+
2829
tests_add_filter( 'muplugins_loaded', '_manually_load_plugin' );
2930

3031
// Start up the WP testing environment.
31-
require $_tests_dir . '/includes/bootstrap.php';
32+
require "{$_tests_dir}/includes/bootstrap.php";

templates/plugin-circle.mustache

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@ workflows:
66
- php70-build
77
- php71-build
88
- php72-build
9+
- php73-build
10+
- php74-build
911

1012
version: 2
1113

@@ -90,3 +92,15 @@ jobs:
9092
docker:
9193
- image: circleci/php:7.2
9294
- image: *mysql_image
95+
96+
php73-build:
97+
<<: *php_job
98+
docker:
99+
- image: circleci/php:7.3
100+
- image: *mysql_image
101+
102+
php74-build:
103+
<<: *php_job
104+
docker:
105+
- image: circleci/php:7.4
106+
- image: *mysql_image

templates/post_type.mustache

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
register_post_type(
22
'{{slug}}',
3-
array(
4-
'labels' => array(
3+
[
4+
'labels' => [
55
'name' => __( '{{label_plural_ucfirst}}', '{{textdomain}}' ),
66
'singular_name' => __( '{{label_ucfirst}}', '{{textdomain}}' ),
77
'all_items' => __( 'All {{label_plural_ucfirst}}', '{{textdomain}}' ),
@@ -27,12 +27,12 @@
2727
'not_found_in_trash' => __( 'No {{label_plural}} found in trash', '{{textdomain}}' ),
2828
'parent_item_colon' => __( 'Parent {{label_ucfirst}}:', '{{textdomain}}' ),
2929
'menu_name' => __( '{{label_plural_ucfirst}}', '{{textdomain}}' ),
30-
),
30+
],
3131
'public' => true,
3232
'hierarchical' => false,
3333
'show_ui' => true,
3434
'show_in_nav_menus' => true,
35-
'supports' => array( 'title', 'editor' ),
35+
'supports' => [ 'title', 'editor' ],
3636
'has_archive' => true,
3737
'rewrite' => true,
3838
'query_var' => true,
@@ -41,5 +41,5 @@
4141
'show_in_rest' => true,
4242
'rest_base' => '{{slug}}',
4343
'rest_controller_class' => 'WP_REST_Posts_Controller',
44-
)
44+
]
4545
);

templates/post_type_extended.mustache

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
function {{machine_name}}_init() {
77
{{output}}
88
}
9+
910
add_action( 'init', '{{machine_name}}_init' );
1011

1112
/**
@@ -19,7 +20,7 @@ function {{machine_name}}_updated_messages( $messages ) {
1920
2021
$permalink = get_permalink( $post );
2122
22-
$messages['{{slug}}'] = array(
23+
$messages['{{slug}}'] = [
2324
0 => '', // Unused. Messages start at index 1.
2425
/* translators: %s: post permalink */
2526
1 => sprintf( __( '{{label_ucfirst}} updated. <a target="_blank" href="%s">View {{label}}</a>', '{{textdomain}}' ), esc_url( $permalink ) ),
@@ -37,10 +38,11 @@ function {{machine_name}}_updated_messages( $messages ) {
3738
9 => sprintf( __( '{{label_ucfirst}} scheduled for: <strong>%1$s</strong>. <a target="_blank" href="%2$s">Preview {{label}}</a>', '{{textdomain}}' ), date_i18n( __( 'M j, Y @ G:i', '{{textdomain}}' ), strtotime( $post->post_date ) ), esc_url( $permalink ) ),
3839
/* translators: %s: post permalink */
3940
10 => sprintf( __( '{{label_ucfirst}} draft updated. <a target="_blank" href="%s">Preview {{label}}</a>', '{{textdomain}}' ), esc_url( add_query_arg( 'preview', 'true', $permalink ) ) ),
40-
);
41+
];
4142
4243
return $messages;
4344
}
45+
4446
add_filter( 'post_updated_messages', '{{machine_name}}_updated_messages' );
4547

4648
/**
@@ -54,7 +56,7 @@ add_filter( 'post_updated_messages', '{{machine_name}}_updated_messages' );
5456
function {{machine_name}}_bulk_updated_messages( $bulk_messages, $bulk_counts ) {
5557
global $post;
5658
57-
$bulk_messages['{{slug}}'] = array(
59+
$bulk_messages['{{slug}}'] = [
5860
/* translators: %s: Number of {{label_plural}}. */
5961
'updated' => _n( '%s {{label}} updated.', '%s {{label_plural}} updated.', $bulk_counts['updated'], '{{textdomain}}' ),
6062
'locked' => ( 1 === $bulk_counts['locked'] ) ? __( '1 {{label}} not updated, somebody is editing it.', '{{textdomain}}' ) :
@@ -66,8 +68,9 @@ function {{machine_name}}_bulk_updated_messages( $bulk_messages, $bulk_counts )
6668
'trashed' => _n( '%s {{label}} moved to the Trash.', '%s {{label_plural}} moved to the Trash.', $bulk_counts['trashed'], '{{textdomain}}' ),
6769
/* translators: %s: Number of {{label_plural}}. */
6870
'untrashed' => _n( '%s {{label}} restored from the Trash.', '%s {{label_plural}} restored from the Trash.', $bulk_counts['untrashed'], '{{textdomain}}' ),
69-
);
71+
];
7072

7173
return $bulk_messages;
7274
}
75+
7376
add_filter( 'bulk_post_updated_messages', '{{machine_name}}_bulk_updated_messages', 10, 2 );

templates/taxonomy.mustache

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,18 @@
1-
register_taxonomy( '{{slug}}', array( {{post_types}} ), array(
2-
'hierarchical' => false,
3-
'public' => true,
4-
'show_in_nav_menus' => true,
5-
'show_ui' => true,
6-
'show_admin_column' => false,
7-
'query_var' => true,
8-
'rewrite' => true,
9-
'capabilities' => array(
10-
'manage_terms' => 'edit_posts',
11-
'edit_terms' => 'edit_posts',
12-
'delete_terms' => 'edit_posts',
13-
'assign_terms' => 'edit_posts',
14-
),
15-
'labels' => array(
1+
register_taxonomy( '{{slug}}', [ {{post_types}} ], [
2+
'hierarchical' => false,
3+
'public' => true,
4+
'show_in_nav_menus' => true,
5+
'show_ui' => true,
6+
'show_admin_column' => false,
7+
'query_var' => true,
8+
'rewrite' => true,
9+
'capabilities' => [
10+
'manage_terms' => 'edit_posts',
11+
'edit_terms' => 'edit_posts',
12+
'delete_terms' => 'edit_posts',
13+
'assign_terms' => 'edit_posts',
14+
],
15+
'labels' => [
1616
'name' => __( '{{label_plural_ucfirst}}', '{{textdomain}}' ),
1717
'singular_name' => _x( '{{label_ucfirst}}', 'taxonomy general name', '{{textdomain}}' ),
1818
'search_items' => __( 'Search {{label_plural_ucfirst}}', '{{textdomain}}' ),
@@ -35,8 +35,8 @@
3535
'items_list' => __( '{{label_plural_ucfirst}} list', '{{textdomain}}' ),
3636
'most_used' => _x( 'Most Used', '{{slug}}', '{{textdomain}}' ),
3737
'back_to_items' => __( '&larr; Back to {{label_plural_ucfirst}}', '{{textdomain}}' ),
38-
),
39-
'show_in_rest' => true,
40-
'rest_base' => '{{slug}}',
38+
],
39+
'show_in_rest' => true,
40+
'rest_base' => '{{slug}}',
4141
'rest_controller_class' => 'WP_REST_Terms_Controller',
42-
) );
42+
] );

templates/taxonomy_extended.mustache

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
function {{machine_name}}_init() {
88
{{output}}
99
}
10+
1011
add_action( 'init', '{{machine_name}}_init' );
1112

1213
/**
@@ -17,16 +18,17 @@ add_action( 'init', '{{machine_name}}_init' );
1718
*/
1819
function {{machine_name}}_updated_messages( $messages ) {
1920
20-
$messages['{{slug}}'] = array(
21+
$messages['{{slug}}'] = [
2122
0 => '', // Unused. Messages start at index 1.
2223
1 => __( '{{label_ucfirst}} added.', '{{textdomain}}' ),
2324
2 => __( '{{label_ucfirst}} deleted.', '{{textdomain}}' ),
2425
3 => __( '{{label_ucfirst}} updated.', '{{textdomain}}' ),
2526
4 => __( '{{label_ucfirst}} not added.', '{{textdomain}}' ),
2627
5 => __( '{{label_ucfirst}} not updated.', '{{textdomain}}' ),
2728
6 => __( '{{label_plural_ucfirst}} deleted.', '{{textdomain}}' ),
28-
);
29+
];
2930
3031
return $messages;
3132
}
33+
3234
add_filter( 'term_updated_messages', '{{machine_name}}_updated_messages' );

templates/theme-bootstrap.mustache

Lines changed: 14 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?php
22
/**
3-
* PHPUnit bootstrap file
3+
* PHPUnit bootstrap file.
44
*
55
* @package {{theme_package}}
66
*/
@@ -12,37 +12,38 @@ if ( ! $_tests_dir ) {
1212
}
1313

1414
if ( ! file_exists( $_tests_dir . '/includes/functions.php' ) ) {
15-
echo "Could not find $_tests_dir/includes/functions.php, have you run bin/install-wp-tests.sh ?" . PHP_EOL;
15+
echo "Could not find {$_tests_dir}/includes/functions.php, have you run bin/install-wp-tests.sh ?" . PHP_EOL;
1616
exit( 1 );
1717
}
1818

1919
// Give access to tests_add_filter() function.
20-
require_once $_tests_dir . '/includes/functions.php';
20+
require_once "{$_tests_dir}/includes/functions.php";
2121

2222
/**
23-
* Registers theme
23+
* Registers theme.
2424
*/
2525
function _register_theme() {
2626
27-
$theme_dir = dirname( __DIR__ );
27+
$theme_dir = dirname( __DIR__ );
2828
$current_theme = basename( $theme_dir );
29-
$theme_root = dirname( $theme_dir );
29+
$theme_root = dirname( $theme_dir );
3030
31-
add_filter( 'theme_root', function() use ( $theme_root ) {
31+
add_filter( 'theme_root', function () use ( $theme_root ) {
3232
return $theme_root;
3333
} );
3434

3535
register_theme_directory( $theme_root );
3636

37-
add_filter( 'pre_option_template', function() use ( $current_theme ) {
37+
add_filter( 'pre_option_template', function () use ( $current_theme ) {
3838
return $current_theme;
39-
});
40-
add_filter( 'pre_option_stylesheet', function() use ( $current_theme ) {
39+
} );
40+
41+
add_filter( 'pre_option_stylesheet', function () use ( $current_theme ) {
4142
return $current_theme;
42-
});
43+
} );
4344
}
44-
tests_add_filter( 'muplugins_loaded', '_register_theme' );
4545

46+
tests_add_filter( 'muplugins_loaded', '_register_theme' );
4647

4748
// Start up the WP testing environment.
48-
require $_tests_dir . '/includes/bootstrap.php';
49+
require "{$_tests_dir}/includes/bootstrap.php";

0 commit comments

Comments
 (0)