@@ -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 | } |
@@ -38,6 +38,6 @@ |
||
| 38 | 38 | * @return Meta_Data[] |
| 39 | 39 | * @codeCoverageIgnore |
| 40 | 40 | */ |
| 41 | - abstract public function meta_data( array $meta_data ): array; |
|
| 41 | + abstract public function meta_data(array $meta_data): array; |
|
| 42 | 42 | |
| 43 | 43 | } |
@@ -72,7 +72,7 @@ discard block |
||
| 72 | 72 | * |
| 73 | 73 | * @var string[] |
| 74 | 74 | */ |
| 75 | - public array $object_type = array( 'post' ); |
|
| 75 | + public array $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 | } |
@@ -24,4 +24,4 @@ |
||
| 24 | 24 | |
| 25 | 25 | namespace PinkCrab\Registerables\Module\Middleware; |
| 26 | 26 | |
| 27 | -interface Registerable{} |
|
| 27 | +interface Registerable {} |
|
@@ -45,10 +45,10 @@ |
||
| 45 | 45 | ## Unused methods |
| 46 | 46 | |
| 47 | 47 | /** @inheritDoc */ |
| 48 | - public function pre_boot( App_Config $config, Hook_Loader $loader, DI_Container $di_container ): void {} // phpcs:ignore Generic.CodeAnalysis.UnusedFunctionParameter.FoundInImplementedInterfaceBeforeLastUsed |
|
| 48 | + public function pre_boot(App_Config $config, Hook_Loader $loader, DI_Container $di_container): void {} // phpcs:ignore Generic.CodeAnalysis.UnusedFunctionParameter.FoundInImplementedInterfaceBeforeLastUsed |
|
| 49 | 49 | /** @inheritDoc */ |
| 50 | - public function pre_register( App_Config $config, Hook_Loader $loader, DI_Container $di_container ): void {} // phpcs:ignore Generic.CodeAnalysis.UnusedFunctionParameter.FoundInImplementedInterfaceBeforeLastUsed |
|
| 50 | + public function pre_register(App_Config $config, Hook_Loader $loader, DI_Container $di_container): void {} // phpcs:ignore Generic.CodeAnalysis.UnusedFunctionParameter.FoundInImplementedInterfaceBeforeLastUsed |
|
| 51 | 51 | /** @inheritDoc */ |
| 52 | - public function post_register( App_Config $config, Hook_Loader $loader, DI_Container $di_container ): void {} // phpcs:ignore Generic.CodeAnalysis.UnusedFunctionParameter.FoundInImplementedInterfaceBeforeLastUsed |
|
| 52 | + public function post_register(App_Config $config, Hook_Loader $loader, DI_Container $di_container): void {} // phpcs:ignore Generic.CodeAnalysis.UnusedFunctionParameter.FoundInImplementedInterfaceBeforeLastUsed |
|
| 53 | 53 | |
| 54 | 54 | } |
@@ -35,5 +35,5 @@ |
||
| 35 | 35 | * @param \PinkCrab\Registerables\Module\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 | } |
@@ -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\Module\Middleware\Registerable $object_instance |
| 81 | 81 | * @return bool |
| 82 | 82 | */ |
| 83 | - abstract public function validate( Registerable $object_instance ): bool; |
|
| 83 | + abstract public function validate(Registerable $object_instance): bool; |
|
| 84 | 84 | } |
@@ -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\Module\Middleware\Registerable $object_instance |
| 40 | 40 | * @return bool |
| 41 | 41 | */ |
| 42 | - public function validate( Registerable $object_instance ): bool { |
|
| 42 | + public function validate(Registerable $object_instance): bool { |
|
| 43 | 43 | // If this is not a valid taxonomy, just bail here. |
| 44 | - if ( ! is_a( $object_instance, Taxonomy::class ) ) { |
|
| 45 | - $this->add_error( sprintf( '%s is not a valid Taxonomy Model', get_class( $object_instance ) ) ); |
|
| 44 | + if ( ! is_a($object_instance, Taxonomy::class)) { |
|
| 45 | + $this->add_error(sprintf('%s is not a valid Taxonomy Model', get_class($object_instance))); |
|
| 46 | 46 | return false; |
| 47 | 47 | } |
| 48 | 48 | |
| 49 | 49 | /* @var Taxonomy $object_instance, already confirmed as a Taxonomy */ |
| 50 | 50 | |
| 51 | 51 | // Ensure all required fields are set. |
| 52 | - $this->has_required_fields( $object_instance ); |
|
| 52 | + $this->has_required_fields($object_instance); |
|
| 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 | } |
@@ -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\Module\Middleware\Registerable $object_instance |
| 40 | 40 | * @return bool |
| 41 | 41 | */ |
| 42 | - public function validate( Registerable $object_instance ): bool { |
|
| 42 | + public function validate(Registerable $object_instance): bool { |
|
| 43 | 43 | // If this is not a valid post type, just bail here. |
| 44 | - if ( ! is_a( $object_instance, Post_Type::class ) ) { |
|
| 45 | - $this->add_error( sprintf( '%s is not a valid Post Type Model', get_class( $object_instance ) ) ); |
|
| 44 | + if ( ! is_a($object_instance, Post_Type::class)) { |
|
| 45 | + $this->add_error(sprintf('%s is not a valid Post Type Model', get_class($object_instance))); |
|
| 46 | 46 | return false; |
| 47 | 47 | } |
| 48 | 48 | |
| 49 | 49 | /* @var Post_Type $object_instance, already confirmed as a post type */ |
| 50 | 50 | |
| 51 | 51 | // Ensure all required fields are set. |
| 52 | - $this->has_required_fields( $object_instance ); |
|
| 52 | + $this->has_required_fields($object_instance); |
|
| 53 | 53 | |
| 54 | 54 | // Check if the passed object_instance 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 | } |