Skip to content

Commit 8abe835

Browse files
committed
Add interfaces for PostType and Taxonomy to allow using legacy classes for term meta UI
1 parent a718a49 commit 8abe835

File tree

5 files changed

+40
-4
lines changed

5 files changed

+40
-4
lines changed

src/Contracts/PostType.php

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
<?php
2+
/**
3+
* PostType class.
4+
*
5+
* @since 0.3.2
6+
*/
7+
8+
namespace Required\Common\Contracts;
9+
10+
/**
11+
* Class used to implement post types.
12+
*
13+
* @since 0.3.2
14+
*/
15+
interface PostType {
16+
}

src/Contracts/Taxonomy.php

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
<?php
2+
/**
3+
* Taxonomy class.
4+
*
5+
* @since 0.3.2
6+
*/
7+
8+
namespace Required\Common\Contracts;
9+
10+
/**
11+
* Class used to implement taxonomies.
12+
*
13+
* @since 0.3.2
14+
*/
15+
interface Taxonomy {
16+
17+
}

src/Legacy/PostType.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,14 +9,15 @@
99

1010
namespace Required\Common\Legacy;
1111

12+
use Required\Common\Contracts\PostType as PostTypeInterface;
1213
use Required\Common\Contracts\Registrable;
1314

1415
/**
1516
* Class used to implement custom post types.
1617
*
1718
* @since 0.1.0
1819
*/
19-
abstract class PostType implements Registrable {
20+
abstract class PostType implements Registrable, PostTypeInterface {
2021

2122
public const NAME = 'post';
2223

src/Legacy/Taxonomy.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,14 @@
1010
namespace Required\Common\Legacy;
1111

1212
use Required\Common\Contracts\Registrable;
13+
use Required\Common\Contracts\Taxonomy as TaxonomyInterface;
1314

1415
/**
1516
* Class used to implement custom taxonomies.
1617
*
1718
* @since 0.1.0
1819
*/
19-
abstract class Taxonomy implements Registrable {
20+
abstract class Taxonomy implements Registrable, TaxonomyInterface {
2021

2122
public const NAME = 'category';
2223

src/TermMetaAdminUI.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
namespace Required\Common;
99

1010
use Required\Common\Contracts\Registrable;
11+
use Required\Common\Contracts\Taxonomy;
1112
use WP_Term;
1213

1314
/**
@@ -36,8 +37,8 @@ abstract class TermMetaAdminUI implements Registrable {
3637
*
3738
* @since 0.1.0
3839
*
39-
* @param \Required\Common\Taxonomy $taxonomy The taxonomy.
40-
* @param \Required\Common\TermMeta $term_meta The term meta.
40+
* @param \Required\Common\Contracts\Taxonomy $taxonomy The taxonomy.
41+
* @param \Required\Common\TermMeta $term_meta The term meta.
4142
*/
4243
public function __construct( Taxonomy $taxonomy, TermMeta $term_meta ) {
4344
$this->taxonomy = $taxonomy;

0 commit comments

Comments
 (0)