@@ -271,7 +271,7 @@ discard block |
||
| 271 | 271 | * @param array<string, mixed> $labels |
| 272 | 272 | * @return array<string, mixed> |
| 273 | 273 | */ |
| 274 | - public function filter_labels( array $labels ): array { |
|
| 274 | + public function filter_labels(array $labels): array { |
|
| 275 | 275 | return $labels; |
| 276 | 276 | } |
| 277 | 277 | |
@@ -281,7 +281,7 @@ discard block |
||
| 281 | 281 | * @param array<string, mixed> $args |
| 282 | 282 | * @return array<string, mixed> |
| 283 | 283 | */ |
| 284 | - public function filter_args( array $args ): array { |
|
| 284 | + public function filter_args(array $args): array { |
|
| 285 | 285 | return $args; |
| 286 | 286 | } |
| 287 | 287 | |
@@ -291,7 +291,7 @@ discard block |
||
| 291 | 291 | * @param Meta_Data[] $collection |
| 292 | 292 | * @return Meta_Data[] |
| 293 | 293 | */ |
| 294 | - public function meta_data( array $collection ): array { |
|
| 294 | + public function meta_data(array $collection): array { |
|
| 295 | 295 | return $collection; |
| 296 | 296 | } |
| 297 | 297 | |
@@ -301,7 +301,7 @@ discard block |
||
| 301 | 301 | * @param Meta_Box[] $collection |
| 302 | 302 | * @return Meta_Box[] |
| 303 | 303 | */ |
| 304 | - public function meta_boxes( array $collection ): array { |
|
| 304 | + public function meta_boxes(array $collection): array { |
|
| 305 | 305 | return $collection; |
| 306 | 306 | } |
| 307 | 307 | } |
@@ -25,4 +25,4 @@ |
||
| 25 | 25 | |
| 26 | 26 | namespace PinkCrab\Registerables\Registration_Middleware; |
| 27 | 27 | |
| 28 | -interface Registerable{} |
|
| 28 | +interface Registerable {} |
|
@@ -35,5 +35,5 @@ |
||
| 35 | 35 | * @param \PinkCrab\Registerables\Registration_Middleware\Registerable $registerable |
| 36 | 36 | * @return void |
| 37 | 37 | */ |
| 38 | - public function register( Registerable $registerable ): void; |
|
| 38 | + public function register(Registerable $registerable): void; |
|
| 39 | 39 | } |
@@ -31,7 +31,7 @@ discard block |
||
| 31 | 31 | |
| 32 | 32 | class Post_Type_Validator extends Abstract_Validator { |
| 33 | 33 | |
| 34 | - protected const REQUIRED_FIELDS = array( 'key', 'singular', 'plural' ); |
|
| 34 | + protected const REQUIRED_FIELDS = array('key', 'singular', 'plural'); |
|
| 35 | 35 | |
| 36 | 36 | /** |
| 37 | 37 | * Validates the class passed. |
@@ -39,17 +39,17 @@ discard block |
||
| 39 | 39 | * @param \PinkCrab\Registerables\Registration_Middleware\Registerable $object |
| 40 | 40 | * @return bool |
| 41 | 41 | */ |
| 42 | - public function validate( Registerable $object ): bool { |
|
| 42 | + public function validate(Registerable $object): bool { |
|
| 43 | 43 | // If this is not a valid post type, just bail here. |
| 44 | - if ( ! is_a( $object, Post_Type::class ) ) { |
|
| 45 | - $this->add_error( sprintf( '%s is not a valid Post Type Model', get_class( $object ) ) ); |
|
| 44 | + if ( ! is_a($object, Post_Type::class)) { |
|
| 45 | + $this->add_error(sprintf('%s is not a valid Post Type Model', get_class($object))); |
|
| 46 | 46 | return false; |
| 47 | 47 | } |
| 48 | 48 | |
| 49 | 49 | /* @var Post_Type $object, already confirmed as a post type */ |
| 50 | 50 | |
| 51 | 51 | // Ensure all required fields are set. |
| 52 | - $this->has_required_fields( $object ); |
|
| 52 | + $this->has_required_fields($object); |
|
| 53 | 53 | |
| 54 | 54 | // Check if the passed object has any errors. |
| 55 | 55 | return ! $this->has_errors(); |
@@ -61,12 +61,12 @@ discard block |
||
| 61 | 61 | * @param Post_Type $post_type |
| 62 | 62 | * @return void |
| 63 | 63 | */ |
| 64 | - protected function has_required_fields( Post_Type $post_type ): void { |
|
| 65 | - foreach ( self::REQUIRED_FIELDS as $field ) { |
|
| 66 | - if ( ! is_string( $post_type->{$field} ) |
|
| 67 | - || \mb_strlen( $post_type->{$field} ) === 0 |
|
| 64 | + protected function has_required_fields(Post_Type $post_type): void { |
|
| 65 | + foreach (self::REQUIRED_FIELDS as $field) { |
|
| 66 | + if ( ! is_string($post_type->{$field} ) |
|
| 67 | + || \mb_strlen($post_type->{$field} ) === 0 |
|
| 68 | 68 | ) { |
| 69 | - $this->add_error( sprintf( '%s is not set on %s Post Type Model', $field, get_class( $post_type ) ) ); |
|
| 69 | + $this->add_error(sprintf('%s is not set on %s Post Type Model', $field, get_class($post_type))); |
|
| 70 | 70 | } |
| 71 | 71 | } |
| 72 | 72 | } |
@@ -31,7 +31,7 @@ discard block |
||
| 31 | 31 | |
| 32 | 32 | class Taxonomy_Validator extends Abstract_Validator { |
| 33 | 33 | |
| 34 | - protected const REQUIRED_FIELDS = array( 'slug', 'singular', 'plural' ); |
|
| 34 | + protected const REQUIRED_FIELDS = array('slug', 'singular', 'plural'); |
|
| 35 | 35 | |
| 36 | 36 | /** |
| 37 | 37 | * Validates the class passed. |
@@ -39,17 +39,17 @@ discard block |
||
| 39 | 39 | * @param \PinkCrab\Registerables\Registration_Middleware\Registerable $object |
| 40 | 40 | * @return bool |
| 41 | 41 | */ |
| 42 | - public function validate( Registerable $object ): bool { |
|
| 42 | + public function validate(Registerable $object): bool { |
|
| 43 | 43 | // If this is not a valid taxonomy, just bail here. |
| 44 | - if ( ! is_a( $object, Taxonomy::class ) ) { |
|
| 45 | - $this->add_error( sprintf( '%s is not a valid Taxonomy Model', get_class( $object ) ) ); |
|
| 44 | + if ( ! is_a($object, Taxonomy::class)) { |
|
| 45 | + $this->add_error(sprintf('%s is not a valid Taxonomy Model', get_class($object))); |
|
| 46 | 46 | return false; |
| 47 | 47 | } |
| 48 | 48 | |
| 49 | 49 | /* @var Taxonomy $object, already confirmed as a Taxonomy */ |
| 50 | 50 | |
| 51 | 51 | // Ensure all required fields are set. |
| 52 | - $this->has_required_fields( $object ); |
|
| 52 | + $this->has_required_fields($object); |
|
| 53 | 53 | |
| 54 | 54 | // Check if the passed object has any errors. |
| 55 | 55 | return ! $this->has_errors(); |
@@ -61,12 +61,12 @@ discard block |
||
| 61 | 61 | * @param Taxonomy $taxonomy |
| 62 | 62 | * @return void |
| 63 | 63 | */ |
| 64 | - protected function has_required_fields( Taxonomy $taxonomy ): void { |
|
| 65 | - foreach ( self::REQUIRED_FIELDS as $field ) { |
|
| 66 | - if ( ! is_string( $taxonomy->{$field} ) |
|
| 67 | - || \mb_strlen( $taxonomy->{$field} ) === 0 |
|
| 64 | + protected function has_required_fields(Taxonomy $taxonomy): void { |
|
| 65 | + foreach (self::REQUIRED_FIELDS as $field) { |
|
| 66 | + if ( ! is_string($taxonomy->{$field} ) |
|
| 67 | + || \mb_strlen($taxonomy->{$field} ) === 0 |
|
| 68 | 68 | ) { |
| 69 | - $this->add_error( sprintf( '%s is not set on %s Taxonomy Model', $field, get_class( $taxonomy ) ) ); |
|
| 69 | + $this->add_error(sprintf('%s is not set on %s Taxonomy Model', $field, get_class($taxonomy))); |
|
| 70 | 70 | } |
| 71 | 71 | } |
| 72 | 72 | } |
@@ -41,7 +41,7 @@ discard block |
||
| 41 | 41 | * @return bool |
| 42 | 42 | */ |
| 43 | 43 | public function has_errors(): bool { |
| 44 | - return count( $this->errors ) >= 1; |
|
| 44 | + return count($this->errors) >= 1; |
|
| 45 | 45 | } |
| 46 | 46 | |
| 47 | 47 | /** |
@@ -59,7 +59,7 @@ discard block |
||
| 59 | 59 | * @param string $error |
| 60 | 60 | * @return self |
| 61 | 61 | */ |
| 62 | - public function add_error( string $error ): self { |
|
| 62 | + public function add_error(string $error): self { |
|
| 63 | 63 | $this->errors[] = $error; |
| 64 | 64 | return $this; |
| 65 | 65 | } |
@@ -80,5 +80,5 @@ discard block |
||
| 80 | 80 | * @param \PinkCrab\Registerables\Registration_Middleware\Registerable $object |
| 81 | 81 | * @return bool |
| 82 | 82 | */ |
| 83 | - abstract public function validate( Registerable $object ): bool; |
|
| 83 | + abstract public function validate(Registerable $object): bool; |
|
| 84 | 84 | } |
@@ -72,7 +72,7 @@ discard block |
||
| 72 | 72 | * |
| 73 | 73 | * @var string[] |
| 74 | 74 | */ |
| 75 | - public $object_type = array( 'post' ); |
|
| 75 | + public $object_type = array('post'); |
|
| 76 | 76 | |
| 77 | 77 | /** |
| 78 | 78 | * Should this taxonomy have a hierarchy |
@@ -211,7 +211,7 @@ discard block |
||
| 211 | 211 | * @param array<string, mixed> $labels |
| 212 | 212 | * @return array<string, mixed> |
| 213 | 213 | */ |
| 214 | - public function filter_labels( array $labels ): array { |
|
| 214 | + public function filter_labels(array $labels): array { |
|
| 215 | 215 | return $labels; |
| 216 | 216 | } |
| 217 | 217 | |
@@ -221,7 +221,7 @@ discard block |
||
| 221 | 221 | * @param array<string, mixed> $args |
| 222 | 222 | * @return array<string, mixed> |
| 223 | 223 | */ |
| 224 | - public function filter_args( array $args ): array { |
|
| 224 | + public function filter_args(array $args): array { |
|
| 225 | 225 | return $args; |
| 226 | 226 | } |
| 227 | 227 | |
@@ -231,7 +231,7 @@ discard block |
||
| 231 | 231 | * @param Meta_Data[] $collection |
| 232 | 232 | * @return Meta_Data[] |
| 233 | 233 | */ |
| 234 | - public function meta_data( array $collection ): array { |
|
| 234 | + public function meta_data(array $collection): array { |
|
| 235 | 235 | return $collection; |
| 236 | 236 | } |
| 237 | 237 | } |
@@ -107,7 +107,7 @@ discard block |
||
| 107 | 107 | * |
| 108 | 108 | * @param string $key |
| 109 | 109 | */ |
| 110 | - final public function __construct( string $key ) { |
|
| 110 | + final public function __construct(string $key) { |
|
| 111 | 111 | $this->key = $key; |
| 112 | 112 | } |
| 113 | 113 | |
@@ -117,8 +117,8 @@ discard block |
||
| 117 | 117 | * @param string $key |
| 118 | 118 | * @return self |
| 119 | 119 | */ |
| 120 | - public static function normal( string $key ): self { |
|
| 121 | - $meta_box = new static( $key ); |
|
| 120 | + public static function normal(string $key): self { |
|
| 121 | + $meta_box = new static($key); |
|
| 122 | 122 | $meta_box->context = 'normal'; |
| 123 | 123 | return $meta_box; |
| 124 | 124 | } |
@@ -129,8 +129,8 @@ discard block |
||
| 129 | 129 | * @param string $key |
| 130 | 130 | * @return self |
| 131 | 131 | */ |
| 132 | - public static function side( string $key ): self { |
|
| 133 | - $meta_box = new static( $key ); |
|
| 132 | + public static function side(string $key): self { |
|
| 133 | + $meta_box = new static($key); |
|
| 134 | 134 | $meta_box->context = 'side'; |
| 135 | 135 | return $meta_box; |
| 136 | 136 | } |
@@ -141,7 +141,7 @@ discard block |
||
| 141 | 141 | * @param string $label |
| 142 | 142 | * @return self |
| 143 | 143 | */ |
| 144 | - public function label( string $label ): self { |
|
| 144 | + public function label(string $label): self { |
|
| 145 | 145 | $this->label = $label; |
| 146 | 146 | return $this; |
| 147 | 147 | } |
@@ -152,8 +152,8 @@ discard block |
||
| 152 | 152 | * @param string|array<mixed>|\WP_Screen $screen |
| 153 | 153 | * @return self |
| 154 | 154 | */ |
| 155 | - public function screen( $screen ): self { |
|
| 156 | - array_push( $this->screen, $screen ); |
|
| 155 | + public function screen($screen): self { |
|
| 156 | + array_push($this->screen, $screen); |
|
| 157 | 157 | return $this; |
| 158 | 158 | } |
| 159 | 159 | |
@@ -163,7 +163,7 @@ discard block |
||
| 163 | 163 | * @param array<string, mixed> $view_vars |
| 164 | 164 | * @return self |
| 165 | 165 | */ |
| 166 | - public function view_vars( array $view_vars ): self { |
|
| 166 | + public function view_vars(array $view_vars): self { |
|
| 167 | 167 | $this->view_vars = $view_vars; |
| 168 | 168 | return $this; |
| 169 | 169 | } |
@@ -175,7 +175,7 @@ discard block |
||
| 175 | 175 | * @param string $view_template |
| 176 | 176 | * @return self |
| 177 | 177 | */ |
| 178 | - public function view_template( string $view_template ): self { |
|
| 178 | + public function view_template(string $view_template): self { |
|
| 179 | 179 | $this->view_template = $view_template; |
| 180 | 180 | return $this; |
| 181 | 181 | } |
@@ -187,7 +187,7 @@ discard block |
||
| 187 | 187 | * @param callable $callable |
| 188 | 188 | * @return self |
| 189 | 189 | */ |
| 190 | - public function view( $callable ): self { |
|
| 190 | + public function view($callable): self { |
|
| 191 | 191 | $this->view = $callable; |
| 192 | 192 | return $this; |
| 193 | 193 | } |
@@ -201,8 +201,8 @@ discard block |
||
| 201 | 201 | * @param int $params |
| 202 | 202 | * @return self |
| 203 | 203 | */ |
| 204 | - public function add_action( string $hook, callable $callable, int $priority = 10, int $params = 1 ): self { |
|
| 205 | - $this->actions[ $hook ] = |
|
| 204 | + public function add_action(string $hook, callable $callable, int $priority = 10, int $params = 1): self { |
|
| 205 | + $this->actions[$hook] = |
|
| 206 | 206 | array( |
| 207 | 207 | 'callback' => $callable, |
| 208 | 208 | 'priority' => $priority, |
@@ -218,7 +218,7 @@ discard block |
||
| 218 | 218 | * @param callable(\WP_Post $post,array<string, mixed> $args):array<string, mixed> $view_data_filter |
| 219 | 219 | * @return self |
| 220 | 220 | */ |
| 221 | - public function view_data_filter( callable $view_data_filter ): self { |
|
| 221 | + public function view_data_filter(callable $view_data_filter): self { |
|
| 222 | 222 | $this->view_data_filter = $view_data_filter; |
| 223 | 223 | return $this; |
| 224 | 224 | } |
@@ -45,7 +45,7 @@ |
||
| 45 | 45 | * @return Meta_Data[] |
| 46 | 46 | * @codeCoverageIgnore |
| 47 | 47 | */ |
| 48 | - public function meta_data( array $meta_data ): array { |
|
| 48 | + public function meta_data(array $meta_data): array { |
|
| 49 | 49 | return $meta_data; |
| 50 | 50 | } |
| 51 | 51 | |