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 8bb4ca4

Browse files
authored
Merge pull request #21 from 10up/feature/typing
Feature/typing
2 parents 937e083 + c70f6cd commit 8bb4ca4

File tree

16 files changed

+319
-152
lines changed

16 files changed

+319
-152
lines changed

composer.json

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,9 @@
4343
"10up/phpcs-composer": "^3.0",
4444
"phpcompatibility/php-compatibility": "dev-develop as 9.99.99",
4545
"phpunit/php-code-coverage": "^9.2",
46-
"slevomat/coding-standard": "^8.15"
46+
"slevomat/coding-standard": "^8.15",
47+
"rector/rector": "^2.0",
48+
"tomasvotruba/type-coverage": "^2.0"
4749
},
4850
"scripts": {
4951
"test": "XDEBUG_MODE=coverage ./vendor/bin/phpunit",
@@ -52,6 +54,10 @@
5254
"static": [
5355
"Composer\\Config::disableProcessTimeout",
5456
"phpstan --memory-limit=1G"
57+
],
58+
"rector": [
59+
"./vendor/bin/rector",
60+
"composer run lint-fix"
5561
]
5662
},
5763
"config": {

composer.lock

Lines changed: 206 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

fixtures/classes/PostTypes/Demo.php

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ class Demo extends AbstractPostType {
2121
*
2222
* @return string
2323
*/
24-
public function get_name() {
24+
public function get_name(): string {
2525
return 'tenup-demo';
2626
}
2727

@@ -30,7 +30,7 @@ public function get_name() {
3030
*
3131
* @return string
3232
*/
33-
public function get_singular_label() {
33+
public function get_singular_label(): string {
3434
return esc_html__( 'Demo', 'tenup-plugin' );
3535
}
3636

@@ -39,7 +39,7 @@ public function get_singular_label() {
3939
*
4040
* @return string
4141
*/
42-
public function get_plural_label() {
42+
public function get_plural_label(): string {
4343
return esc_html__( 'Demos', 'tenup-plugin' );
4444
}
4545

@@ -52,7 +52,7 @@ public function get_plural_label() {
5252
*
5353
* @return string
5454
*/
55-
public function get_menu_icon() {
55+
public function get_menu_icon(): string {
5656
return 'dashicons-chart-pie';
5757
}
5858

@@ -61,7 +61,7 @@ public function get_menu_icon() {
6161
*
6262
* @return bool
6363
*/
64-
public function can_register() {
64+
public function can_register(): bool {
6565
return true;
6666
}
6767

@@ -71,7 +71,7 @@ public function can_register() {
7171
*
7272
* @return array<string>
7373
*/
74-
public function get_supported_taxonomies() {
74+
public function get_supported_taxonomies(): array {
7575
return [
7676
'tenup-tax-demo',
7777
];
@@ -82,7 +82,7 @@ public function get_supported_taxonomies() {
8282
*
8383
* @return void
8484
*/
85-
public function after_register() {
85+
public function after_register(): void {
8686
// Register any hooks/filters you need.
8787
}
8888
}

fixtures/classes/PostTypes/Page.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ class Page extends AbstractCorePostType {
2424
*
2525
* @return string
2626
*/
27-
public function get_name() {
27+
public function get_name(): string {
2828
return 'page';
2929
}
3030

@@ -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
}

fixtures/classes/PostTypes/Post.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ class Post extends AbstractCorePostType {
2424
*
2525
* @return string
2626
*/
27-
public function get_name() {
27+
public function get_name(): string {
2828
return 'post';
2929
}
3030

@@ -36,7 +36,7 @@ public function get_name() {
3636
*
3737
* @return array<string>
3838
*/
39-
public function get_supported_taxonomies() {
39+
public function get_supported_taxonomies(): array {
4040
return [];
4141
}
4242

@@ -45,7 +45,7 @@ public function get_supported_taxonomies() {
4545
*
4646
* @return void
4747
*/
48-
public function after_register() {
48+
public function after_register(): void {
4949
// Do nothing.
5050
}
5151
}

fixtures/classes/Standalone/Standalone.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ public function __construct() {
2727
*
2828
* @return void
2929
*/
30-
public function init() {
30+
public function init(): void {
3131
echo 'Hello from the Standalone class!';
3232
}
3333
}

0 commit comments

Comments
 (0)