Skip to content

Commit 866356f

Browse files
szepeviktorocean90
andauthored
Fix types, add missing constants (#4)
* Fix types, add missing constants * Add constant visibility Co-authored-by: Dominik Schilling <dominikschilling+git@gmail.com>
1 parent 6428559 commit 866356f

File tree

9 files changed

+26
-6
lines changed

9 files changed

+26
-6
lines changed

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
vendor
2-
composer.lock
2+
composer.lock

composer.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,5 +28,8 @@
2828
"psr-4": {
2929
"Required\\Common\\": "src"
3030
}
31+
},
32+
"require-dev": {
33+
"szepeviktor/phpstan-wordpress": "^0.6.5"
3134
}
3235
}

phpstan.neon.dist

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
includes:
2+
- vendor/szepeviktor/phpstan-wordpress/extension.neon
3+
parameters:
4+
level: max
5+
inferPrivatePropertyTypeFromConstructor: true
6+
paths:
7+
- src/

src/Admin/AjaxAction.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77

88
namespace Required\Common\Admin;
99

10-
use Required\Common\Registrable;
10+
use Required\Common\Contracts\Registrable;
1111

1212
/**
1313
* Class used to register Ajax actions.
@@ -16,6 +16,8 @@
1616
*/
1717
abstract class AjaxAction implements Registrable {
1818

19+
public const ACTION = 'ajax-action';
20+
1921
/**
2022
* Whether the Ajax action can be called unauthenticated.
2123
*

src/Admin/Page.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ class Page implements Registrable {
2525
*
2626
* @var int
2727
*/
28-
const ADMIN = 1;
28+
public const ADMIN = 1;
2929

3030
/**
3131
* Type of admin page.
@@ -36,7 +36,7 @@ class Page implements Registrable {
3636
*
3737
* @var int
3838
*/
39-
const ADMIN_NETWORK = 2;
39+
public const ADMIN_NETWORK = 2;
4040

4141
/**
4242
* Type of admin page.
@@ -47,7 +47,7 @@ class Page implements Registrable {
4747
*
4848
* @var int
4949
*/
50-
const ADMIN_USER = 3;
50+
public const ADMIN_USER = 3;
5151

5252
/**
5353
* Type of admin screen.

src/Admin/PostAction.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77

88
namespace Required\Common\Admin;
99

10-
use Required\Common\Registrable;
10+
use Required\Common\Contracts\Registrable;
1111

1212
/**
1313
* Class used to register post/get actions.
@@ -16,6 +16,8 @@
1616
*/
1717
abstract class PostAction implements Registrable {
1818

19+
public const ACTION = 'post-action';
20+
1921
/**
2022
* The callback of the action.
2123
*

src/PostType.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@
1616
*/
1717
abstract class PostType implements Registrable {
1818

19+
public const NAME = 'post';
20+
1921
/**
2022
* Creates a post type object.
2123
*

src/Shortcode.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@
1616
*/
1717
abstract class Shortcode implements Registrable {
1818

19+
public const TAG = 'shortcode';
20+
1921
/**
2022
* Shortcode view object.
2123
*

src/Taxonomy.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@
1616
*/
1717
abstract class Taxonomy implements Registrable {
1818

19+
public const NAME = 'category';
20+
1921
/**
2022
* Object types the taxonomy is associated with.
2123
*

0 commit comments

Comments
 (0)