WARNING: THIS SITE IS A MIRROR OF GITHUB.COM / IT CANNOT LOGIN OR REGISTER ACCOUNTS / THE CONTENTS ARE PROVIDED AS-IS / THIS SITE ASSUMES NO RESPONSIBILITY FOR ANY DISPLAYED CONTENT OR LINKS / IF YOU FOUND SOMETHING MAY NOT GOOD FOR EVERYONE, CONTACT ADMIN AT ilovescratch@foxmail.com
Skip to content

Commit aac408a

Browse files
author
James Morrison
committed
Add explicit return type declarations to PHP methods for WP Framework compatibility.
1 parent dc34295 commit aac408a

File tree

10 files changed

+45
-45
lines changed

10 files changed

+45
-45
lines changed

mu-plugins/10up-plugin/src/Assets.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ class Assets implements ModuleInterface {
2626
*
2727
* @return bool
2828
*/
29-
public function can_register() {
29+
public function can_register(): bool {
3030
return true;
3131
}
3232

@@ -35,7 +35,7 @@ public function can_register() {
3535
*
3636
* @return void
3737
*/
38-
public function register() {
38+
public function register(): void {
3939
$this->setup_asset_vars(
4040
dist_path: TENUP_PLUGIN_PATH . 'dist/',
4141
fallback_version: TENUP_PLUGIN_VERSION
@@ -50,7 +50,7 @@ public function register() {
5050
*
5151
* @return void
5252
*/
53-
public function admin_scripts() {
53+
public function admin_scripts(): void {
5454
wp_enqueue_script(
5555
'tenup_plugin_admin',
5656
TENUP_PLUGIN_URL . 'dist/js/admin.js',
@@ -65,7 +65,7 @@ public function admin_scripts() {
6565
*
6666
* @return void
6767
*/
68-
public function admin_styles() {
68+
public function admin_styles(): void {
6969
wp_enqueue_style(
7070
'tenup_plugin_admin',
7171
TENUP_PLUGIN_URL . 'dist/css/admin.css',

mu-plugins/10up-plugin/src/PostTypes/Demo.php

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ class Demo extends AbstractPostType {
1919
*
2020
* @return string
2121
*/
22-
public function get_name() {
22+
public function get_name(): string {
2323
return 'tenup-demo';
2424
}
2525

@@ -28,7 +28,7 @@ public function get_name() {
2828
*
2929
* @return string
3030
*/
31-
public function get_singular_label() {
31+
public function get_singular_label(): string {
3232
return esc_html__( 'Demo', 'tenup-plugin' );
3333
}
3434

@@ -37,7 +37,7 @@ public function get_singular_label() {
3737
*
3838
* @return string
3939
*/
40-
public function get_plural_label() {
40+
public function get_plural_label(): string {
4141
return esc_html__( 'Demos', 'tenup-plugin' );
4242
}
4343

@@ -50,7 +50,7 @@ public function get_plural_label() {
5050
*
5151
* @return string
5252
*/
53-
public function get_menu_icon() {
53+
public function get_menu_icon(): string {
5454
return 'dashicons-chart-pie';
5555
}
5656

@@ -59,7 +59,7 @@ public function get_menu_icon() {
5959
*
6060
* @return bool
6161
*/
62-
public function can_register() {
62+
public function can_register(): bool {
6363
return false;
6464
}
6565

@@ -69,7 +69,7 @@ public function can_register() {
6969
*
7070
* @return array<string>
7171
*/
72-
public function get_supported_taxonomies() {
72+
public function get_supported_taxonomies(): array {
7373
return [
7474
'tenup-tax-demo',
7575
];
@@ -80,7 +80,7 @@ public function get_supported_taxonomies() {
8080
*
8181
* @return void
8282
*/
83-
public function after_register() {
83+
public function after_register(): void {
8484
// Register any hooks/filters you need.
8585
}
8686
}

mu-plugins/10up-plugin/src/PostTypes/Page.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ class Page extends AbstractCorePostType {
2222
*
2323
* @return string
2424
*/
25-
public function get_name() {
25+
public function get_name(): string {
2626
return 'page';
2727
}
2828

@@ -32,7 +32,7 @@ public function get_name() {
3232
*
3333
* @return array<string>
3434
*/
35-
public function get_supported_taxonomies() {
35+
public function get_supported_taxonomies(): array {
3636
return [];
3737
}
3838

@@ -41,7 +41,7 @@ public function get_supported_taxonomies() {
4141
*
4242
* @return void
4343
*/
44-
public function after_register() {
44+
public function after_register(): void {
4545
// Do nothing.
4646
}
4747
}

mu-plugins/10up-plugin/src/PostTypes/Post.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ class Post extends AbstractCorePostType {
2222
*
2323
* @return string
2424
*/
25-
public function get_name() {
25+
public function get_name(): string {
2626
return 'post';
2727
}
2828

@@ -34,7 +34,7 @@ public function get_name() {
3434
*
3535
* @return array<string>
3636
*/
37-
public function get_supported_taxonomies() {
37+
public function get_supported_taxonomies(): array {
3838
return [];
3939
}
4040

@@ -43,7 +43,7 @@ public function get_supported_taxonomies() {
4343
*
4444
* @return void
4545
*/
46-
public function after_register() {
46+
public function after_register(): void {
4747
// Do nothing.
4848
}
4949
}

mu-plugins/10up-plugin/src/Taxonomies/Demo.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ class Demo extends AbstractTaxonomy {
1919
*
2020
* @return string
2121
*/
22-
public function get_name() {
22+
public function get_name(): string {
2323
return 'tenup-tax-demo';
2424
}
2525

@@ -28,7 +28,7 @@ public function get_name() {
2828
*
2929
* @return string
3030
*/
31-
public function get_singular_label() {
31+
public function get_singular_label(): string {
3232
return esc_html__( 'Demo Term', 'tenup-plugin' );
3333
}
3434

@@ -37,7 +37,7 @@ public function get_singular_label() {
3737
*
3838
* @return string
3939
*/
40-
public function get_plural_label() {
40+
public function get_plural_label(): string {
4141
return esc_html__( 'Demo Terms', 'tenup-plugin' );
4242
}
4343

@@ -46,7 +46,7 @@ public function get_plural_label() {
4646
*
4747
* @return bool
4848
*/
49-
public function can_register() {
49+
public function can_register(): bool {
5050
return false;
5151
}
5252
}

themes/10up-block-theme/src/Assets.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ class Assets implements ModuleInterface {
2626
*
2727
* @return bool
2828
*/
29-
public function can_register() {
29+
public function can_register(): bool {
3030
return true;
3131
}
3232

@@ -35,7 +35,7 @@ public function can_register() {
3535
*
3636
* @return void
3737
*/
38-
public function register() {
38+
public function register(): void {
3939
$this->setup_asset_vars(
4040
dist_path: TENUP_BLOCK_THEME_DIST_PATH,
4141
fallback_version: TENUP_BLOCK_THEME_VERSION
@@ -51,7 +51,7 @@ public function register() {
5151
*
5252
* @return void
5353
*/
54-
public function enqueue_frontend_assets() {
54+
public function enqueue_frontend_assets(): void {
5555
wp_enqueue_style(
5656
'tenup-theme-styles',
5757
TENUP_BLOCK_THEME_TEMPLATE_URL . '/dist/css/frontend.css',
@@ -77,7 +77,7 @@ public function enqueue_frontend_assets() {
7777
*
7878
* @return void
7979
*/
80-
public function enqueue_block_editor_assets() {
80+
public function enqueue_block_editor_assets(): void {
8181
wp_enqueue_style(
8282
'tenup-theme-editor-frame-style-overrides',
8383
TENUP_BLOCK_THEME_TEMPLATE_URL . '/dist/css/editor-frame-style-overrides.css',
@@ -99,7 +99,7 @@ public function enqueue_block_editor_assets() {
9999
*
100100
* @return void
101101
*/
102-
public function enqueue_block_editor_iframe_assets() {
102+
public function enqueue_block_editor_iframe_assets(): void {
103103

104104
// The `enqueue_block_assets` action is triggered both on the front-end and in the editor iframe.
105105
// We only want to enqueue these styles inside the editor iframe.
@@ -120,7 +120,7 @@ public function enqueue_block_editor_iframe_assets() {
120120
*
121121
* @return void
122122
*/
123-
public function register_all_icons() {
123+
public function register_all_icons(): void {
124124
if ( ! function_exists( '\UIKitCore\Helpers\register_icons' ) ) {
125125
return;
126126
}

themes/10up-block-theme/src/Blocks.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ class Blocks implements ModuleInterface {
2626
*
2727
* @return bool
2828
*/
29-
public function can_register() {
29+
public function can_register(): bool {
3030
return true;
3131
}
3232

@@ -35,7 +35,7 @@ public function can_register() {
3535
*
3636
* @return void
3737
*/
38-
public function register() {
38+
public function register(): void {
3939
$this->setup_asset_vars(
4040
dist_path: TENUP_BLOCK_THEME_DIST_PATH,
4141
fallback_version: TENUP_BLOCK_THEME_VERSION
@@ -53,7 +53,7 @@ public function register() {
5353
*
5454
* @return void
5555
*/
56-
public function register_theme_blocks() {
56+
public function register_theme_blocks(): void {
5757
// Register all the blocks in the theme.
5858
if ( file_exists( TENUP_BLOCK_THEME_BLOCK_DIST_DIR ) ) {
5959
$block_json_files = glob( TENUP_BLOCK_THEME_BLOCK_DIST_DIR . '*/block.json' );
@@ -91,7 +91,7 @@ function ( array|bool $allowed_blocks ) use ( $block_names ): array|bool {
9191
*
9292
* @return void
9393
*/
94-
public function enqueue_theme_block_styles() {
94+
public function enqueue_theme_block_styles(): void {
9595
$stylesheets = glob( TENUP_BLOCK_THEME_DIST_PATH . '/blocks/autoenqueue/**/*.css' );
9696

9797
if ( empty( $stylesheets ) ) {

themes/10up-block-theme/src/TemplateTags.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ class TemplateTags implements ModuleInterface {
2424
*
2525
* @return bool
2626
*/
27-
public function can_register() {
27+
public function can_register(): bool {
2828
return true;
2929
}
3030

@@ -33,7 +33,7 @@ public function can_register() {
3333
*
3434
* @return void
3535
*/
36-
public function register() {
36+
public function register(): void {
3737
add_action( 'wp_head', [ $this, 'add_viewport_meta_tag' ], 10, 0 );
3838
}
3939

@@ -42,7 +42,7 @@ public function register() {
4242
*
4343
* @return void
4444
*/
45-
public function add_viewport_meta_tag() {
45+
public function add_viewport_meta_tag(): void {
4646
?>
4747
<meta name="viewport" content="width=device-width, initial-scale=1.0, viewport-fit=cover">
4848
<?php

themes/10up-theme/src/Assets.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ class Assets implements ModuleInterface {
2626
*
2727
* @return bool
2828
*/
29-
public function can_register() {
29+
public function can_register(): bool {
3030
return true;
3131
}
3232

@@ -35,7 +35,7 @@ public function can_register() {
3535
*
3636
* @return void
3737
*/
38-
public function register() {
38+
public function register(): void {
3939
$this->setup_asset_vars(
4040
dist_path: TENUP_THEME_DIST_PATH,
4141
fallback_version: TENUP_THEME_VERSION
@@ -51,7 +51,7 @@ public function register() {
5151
*
5252
* @return void
5353
*/
54-
public function scripts() {
54+
public function scripts(): void {
5555
/**
5656
* Enqueuing frontend.js is required to get css hot reloading working in the frontend
5757
* If you're not shipping any front-end js wrap this enqueue in a SCRIPT_DEBUG check.
@@ -70,7 +70,7 @@ public function scripts() {
7070
*
7171
* @return void
7272
*/
73-
public function enqueue_block_editor_scripts() {
73+
public function enqueue_block_editor_scripts(): void {
7474
wp_enqueue_script(
7575
'block-editor-script',
7676
TENUP_THEME_DIST_URL . 'js/block-editor-script.js',
@@ -85,7 +85,7 @@ public function enqueue_block_editor_scripts() {
8585
*
8686
* @return void
8787
*/
88-
public function styles() {
88+
public function styles(): void {
8989
wp_enqueue_style(
9090
'styles',
9191
TENUP_THEME_TEMPLATE_URL . '/dist/css/frontend.css',

0 commit comments

Comments
 (0)