Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update Taxonomy Generator Templates to Match PHPCS Rules #103

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
15 changes: 10 additions & 5 deletions src/Generators/templates/taxonomies/config.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,26 +5,31 @@
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 ];
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The max version for tribe libs at the moment is PHP 7.2 so this should not include property types (only commented)


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' ),
'slug' => __( '%4$s', 'tribe' ),
];
}

public function default_terms() {
public function default_terms(): array {
return [];
}
}
4 changes: 3 additions & 1 deletion src/Generators/templates/taxonomies/subscriber.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,7 @@
use Tribe\Libs\Taxonomy\Taxonomy_Subscriber;

class Subscriber extends Taxonomy_Subscriber {
protected $config_class = Config::class;

protected string $config_class = Config::class;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same here


}
2 changes: 2 additions & 0 deletions src/Generators/templates/taxonomies/taxonomy.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,7 @@
use Tribe\Libs\Taxonomy\Term_Object;

class %1$s extends Term_Object {

public const NAME = '%2$s';

}