From 43866c9903c35918543422d452d7a46aae847e76 Mon Sep 17 00:00:00 2001 From: Tanner Record Date: Wed, 5 Jan 2022 09:39:15 -0500 Subject: [PATCH 1/4] Update taxonomy templates to match phpcs rules --- src/Generators/templates/taxonomies/config.php | 15 ++++++++++----- .../templates/taxonomies/subscriber.php | 2 ++ src/Generators/templates/taxonomies/taxonomy.php | 2 ++ 3 files changed, 14 insertions(+), 5 deletions(-) diff --git a/src/Generators/templates/taxonomies/config.php b/src/Generators/templates/taxonomies/config.php index e53e8151..8563aecc 100644 --- a/src/Generators/templates/taxonomies/config.php +++ b/src/Generators/templates/taxonomies/config.php @@ -5,18 +5,23 @@ use Tribe\Libs\Taxonomy\Taxonomy_Config; class Config extends Taxonomy_Config { - protected $taxonomy = '%4$s'; - protected $post_types = [ %5$s ]; + + protected string $taxonomy = '%4$s'; + + /** + * @var string[] + */ + protected array $post_types = [ %5$s ]; protected $version = 0; - public function get_args() { + public function get_args(): array { return [ 'hierarchical' => false, ]; } - public function get_labels() { + public function get_labels(): array { return [ 'singular' => __( '%2$s', 'tribe' ), 'plural' => __( '%3$s', 'tribe' ), @@ -24,7 +29,7 @@ public function get_labels() { ]; } - public function default_terms() { + public function default_terms(): array { return []; } } diff --git a/src/Generators/templates/taxonomies/subscriber.php b/src/Generators/templates/taxonomies/subscriber.php index ae6c5148..d8bcbc3c 100644 --- a/src/Generators/templates/taxonomies/subscriber.php +++ b/src/Generators/templates/taxonomies/subscriber.php @@ -6,5 +6,7 @@ use Tribe\Libs\Taxonomy\Taxonomy_Subscriber; class Subscriber extends Taxonomy_Subscriber { + protected $config_class = Config::class; + } diff --git a/src/Generators/templates/taxonomies/taxonomy.php b/src/Generators/templates/taxonomies/taxonomy.php index a18fc508..2d59c7d8 100644 --- a/src/Generators/templates/taxonomies/taxonomy.php +++ b/src/Generators/templates/taxonomies/taxonomy.php @@ -5,5 +5,7 @@ use Tribe\Libs\Taxonomy\Term_Object; class %1$s extends Term_Object { + public const NAME = '%2$s'; + } From d17d1377fb4e0118853dc12bd68b2c645ce6bc28 Mon Sep 17 00:00:00 2001 From: Tanner Record Date: Wed, 5 Jan 2022 09:43:01 -0500 Subject: [PATCH 2/4] Update changelog --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 1cff1f4c..e6fead3e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,7 +3,7 @@ All notable changes to this project will be documented in this file. ## Unreleased - +- Fixed incorrect phpcs formatting for taxonomy generator templates. ## 3.4.8 - 2021-11-29 - Added `.gitattributes` file to make package smaller - Added the Pipeline feature From 3e64ee5eda56954530e3c01e3fa7a66ce1062d78 Mon Sep 17 00:00:00 2001 From: Tanner Record Date: Wed, 5 Jan 2022 09:58:45 -0500 Subject: [PATCH 3/4] Add required type hint --- src/Generators/templates/taxonomies/subscriber.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Generators/templates/taxonomies/subscriber.php b/src/Generators/templates/taxonomies/subscriber.php index d8bcbc3c..c9e1586d 100644 --- a/src/Generators/templates/taxonomies/subscriber.php +++ b/src/Generators/templates/taxonomies/subscriber.php @@ -7,6 +7,6 @@ class Subscriber extends Taxonomy_Subscriber { - protected $config_class = Config::class; + protected string $config_class = Config::class; } From a48c2041b83b5612aac98e3fb72885990f152ec0 Mon Sep 17 00:00:00 2001 From: Tanner Record Date: Thu, 10 Feb 2022 14:58:44 -0500 Subject: [PATCH 4/4] Remove unnecessary import --- src/Generators/templates/component/source.js | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/Generators/templates/component/source.js b/src/Generators/templates/component/source.js index 457c3b06..263c8235 100644 --- a/src/Generators/templates/component/source.js +++ b/src/Generators/templates/component/source.js @@ -8,8 +8,6 @@ * @description TODO: add a description to this file */ -import * as tools from 'utils/tools'; - /** * @function init * @description Kick off this module's functions