Skip to content

Commit

Permalink
Use shorthand arrays
Browse files Browse the repository at this point in the history
  • Loading branch information
darylldoyle committed Apr 2, 2024
1 parent f9ae10a commit d388f53
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ public function get_editor_supports() {
* @return array
*/
public function get_options() {
$options = [
return [
'labels' => $this->get_labels(),
'public' => true,
'has_archive' => true,
Expand All @@ -126,8 +126,6 @@ public function get_options() {
'menu_position' => $this->get_menu_position(),
'hierarchical' => $this->is_hierarchical(),
];

return $options;
}

/**
Expand All @@ -140,7 +138,7 @@ public function get_labels() {
$singular_label = $this->get_singular_label();

// phpcs:disable -- ignoring template strings without translators placeholder since this is dynamic
$labels = array(
$labels = [
'name' => $plural_label,
// Already translated via get_plural_label().
'singular_name' => $singular_label,
Expand Down Expand Up @@ -169,7 +167,7 @@ public function get_labels() {
'item_updated' => sprintf( __( '%s updated.', 'tenup-plugin' ), $singular_label ),
'menu_name' => $plural_label,
'name_admin_bar' => $singular_label,
);
];
// phpcs:enable

return $labels;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -98,15 +98,15 @@ public function register() {
* @return array
*/
public function get_options() {
return array(
return [
'labels' => $this->get_labels(),
'hierarchical' => $this->is_hierarchical(),
'show_ui' => true,
'show_admin_column' => true,
'query_var' => true,
'show_in_rest' => true,
'public' => true,
);
];
}

/**
Expand All @@ -119,7 +119,7 @@ public function get_labels() {
$singular_label = $this->get_singular_label();

// phpcs:disable
$labels = array(
$labels = [
'name' => $plural_label, // Already translated via get_plural_label().
'singular_name' => $singular_label, // Already translated via get_singular_label().
'search_items' => sprintf( __( 'Search %s', 'tenup-plugin' ), $plural_label ),
Expand All @@ -135,7 +135,7 @@ public function get_labels() {
'not_found' => sprintf( __( 'No %s found.', 'tenup-plugin' ), strtolower( $plural_label ) ),
'not_found_in_trash' => sprintf( __( 'No %s found in Trash.', 'tenup-plugin' ), strtolower( $plural_label ) ),
'view_item' => sprintf( __( 'View %s', 'tenup-plugin' ), $singular_label ),
);
];
// phpcs:enable

return $labels;
Expand Down

0 comments on commit d388f53

Please sign in to comment.