Passed
Push — master ( 578742...5ec981 )
by Glynn
03:32 queued 52s
created
src/Post_Type.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -271,7 +271,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 }
Please login to merge, or discard this patch.
src/Registration_Middleware/Registerable.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -25,4 +25,4 @@
 block discarded – undo
25 25
 
26 26
 namespace PinkCrab\Registerables\Registration_Middleware;
27 27
 
28
-interface Registerable{}
28
+interface Registerable {}
Please login to merge, or discard this patch.
src/Registration_Middleware/Registerable_Middleware.php 1 patch
Spacing   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -46,7 +46,7 @@  discard block
 block discarded – undo
46 46
 	 * @param \PinkCrab\Loader\Hook_Loader $loader
47 47
 	 * @return void
48 48
 	 */
49
-	public function set_hook_loader( Hook_Loader $loader ) {
49
+	public function set_hook_loader(Hook_Loader $loader) {
50 50
 		$this->loader = $loader;
51 51
 	}
52 52
 
@@ -56,7 +56,7 @@  discard block
 block discarded – undo
56 56
 	 * @param \PinkCrab\Perique\Interfaces\DI_Container $container
57 57
 	 * @return void
58 58
 	 */
59
-	public function set_di_container( DI_Container $container ): void {
59
+	public function set_di_container(DI_Container $container): void {
60 60
 		$this->container = $container;
61 61
 	}
62 62
 
@@ -66,27 +66,27 @@  discard block
 block discarded – undo
66 66
 	 * @param object|Registerable $class
67 67
 	 * @return object
68 68
 	 */
69
-	public function process( $class ) {
69
+	public function process($class) {
70 70
 
71
-		if ( ! is_a( $class, Registerable::class ) ) {
71
+		if ( ! is_a($class, Registerable::class)) {
72 72
 			return $class;
73 73
 		}
74 74
 
75 75
 		// Register registerable.
76 76
 		$this->loader->action(
77 77
 			'init',
78
-			static function() use ( $class ) {
78
+			static function() use ($class) {
79 79
 				Registrar_Factory::new()
80
-					->create_from_registerable( $class )
81
-					->register( $class );
80
+					->create_from_registerable($class)
81
+					->register($class);
82 82
 			}
83 83
 		);
84 84
 
85 85
 		// Disable gutenberg if post type decides.
86
-		if ( is_a( $class, Post_Type::class ) ) {
86
+		if (is_a($class, Post_Type::class)) {
87 87
 			$this->loader->filter(
88 88
 				'use_block_editor_for_post_type',
89
-				static function( bool $state, string $post_type ) use ( $class ): bool {
89
+				static function(bool $state, string $post_type) use ($class): bool {
90 90
 					return $post_type === $class->key
91 91
 						? (bool) $class->gutenberg
92 92
 						: $state;
@@ -96,16 +96,16 @@  discard block
 block discarded – undo
96 96
 			);
97 97
 
98 98
 			// Register meta boxes.
99
-			$meta_boxes = $class->meta_boxes( array() );
99
+			$meta_boxes = $class->meta_boxes(array());
100 100
 
101
-			if ( ! empty( $meta_boxes ) ) {
101
+			if ( ! empty($meta_boxes)) {
102 102
 				// Create the registrat
103 103
 				$meta_box_registrar = Registrar_Factory::new()
104
-					->meta_box_registrar( $this->container, $this->loader );
104
+					->meta_box_registrar($this->container, $this->loader);
105 105
 
106 106
 				// Register each meta box.
107
-				foreach ( $meta_boxes as $meta_box ) {
108
-					$meta_box_registrar->register( $meta_box );
107
+				foreach ($meta_boxes as $meta_box) {
108
+					$meta_box_registrar->register($meta_box);
109 109
 				}
110 110
 			}
111 111
 		}
Please login to merge, or discard this patch.
src/Meta_Box.php 1 patch
Spacing   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -99,7 +99,7 @@  discard block
 block discarded – undo
99 99
 	 *
100 100
 	 * @param string $key
101 101
 	 */
102
-	final public function __construct( string $key ) {
102
+	final public function __construct(string $key) {
103 103
 		$this->key = $key;
104 104
 	}
105 105
 
@@ -109,8 +109,8 @@  discard block
 block discarded – undo
109 109
 	 * @param string $key
110 110
 	 * @return self
111 111
 	 */
112
-	public static function normal( string $key ): self {
113
-		$meta_box          = new static( $key );
112
+	public static function normal(string $key): self {
113
+		$meta_box          = new static($key);
114 114
 		$meta_box->context = 'normal';
115 115
 		return $meta_box;
116 116
 	}
@@ -121,8 +121,8 @@  discard block
 block discarded – undo
121 121
 	 * @param string $key
122 122
 	 * @return self
123 123
 	 */
124
-	public static function side( string $key ): self {
125
-		$meta_box          = new static( $key );
124
+	public static function side(string $key): self {
125
+		$meta_box          = new static($key);
126 126
 		$meta_box->context = 'side';
127 127
 		return $meta_box;
128 128
 	}
@@ -133,7 +133,7 @@  discard block
 block discarded – undo
133 133
 	 * @param string $label
134 134
 	 * @return self
135 135
 	 */
136
-	public function label( string $label ): self {
136
+	public function label(string $label): self {
137 137
 		$this->label = $label;
138 138
 		return $this;
139 139
 	}
@@ -144,8 +144,8 @@  discard block
 block discarded – undo
144 144
 	 * @param string|array<mixed>|\WP_Screen $screen
145 145
 	 * @return self
146 146
 	 */
147
-	public function screen( $screen ): self {
148
-		array_push( $this->screen, $screen );
147
+	public function screen($screen): self {
148
+		array_push($this->screen, $screen);
149 149
 		return $this;
150 150
 	}
151 151
 
@@ -155,7 +155,7 @@  discard block
 block discarded – undo
155 155
 	 * @param array<string, mixed> $view_vars
156 156
 	 * @return self
157 157
 	 */
158
-	public function view_vars( array $view_vars ): self {
158
+	public function view_vars(array $view_vars): self {
159 159
 		$this->view_vars = $view_vars;
160 160
 		return $this;
161 161
 	}
@@ -167,7 +167,7 @@  discard block
 block discarded – undo
167 167
 	 * @param string $view_template
168 168
 	 * @return self
169 169
 	 */
170
-	public function view_template( string $view_template ): self {
170
+	public function view_template(string $view_template): self {
171 171
 		$this->view_template = $view_template;
172 172
 		return $this;
173 173
 	}
@@ -179,7 +179,7 @@  discard block
 block discarded – undo
179 179
 	 * @param callable $callable
180 180
 	 * @return self
181 181
 	 */
182
-	public function view( $callable ): self {
182
+	public function view($callable): self {
183 183
 		$this->view = $callable;
184 184
 		return $this;
185 185
 	}
@@ -193,8 +193,8 @@  discard block
 block discarded – undo
193 193
 	 * @param int $params
194 194
 	 * @return self
195 195
 	 */
196
-	public function add_action( string $hook, callable $callable, int $priority = 10, int $params = 1 ): self {
197
-		$this->actions[ $hook ] =
196
+	public function add_action(string $hook, callable $callable, int $priority = 10, int $params = 1): self {
197
+		$this->actions[$hook] =
198 198
 			array(
199 199
 				'callback' => $callable,
200 200
 				'priority' => $priority,
Please login to merge, or discard this patch.
src/Registrar/Post_Type_Registrar.php 1 patch
Spacing   +70 added lines, -70 removed lines patch added patch discarded remove patch
@@ -40,7 +40,7 @@  discard block
 block discarded – undo
40 40
 	 */
41 41
 	protected $validator;
42 42
 
43
-	public function __construct( Post_Type_Validator $validator ) {
43
+	public function __construct(Post_Type_Validator $validator) {
44 44
 		$this->validator = $validator;
45 45
 	}
46 46
 
@@ -50,25 +50,25 @@  discard block
 block discarded – undo
50 50
 	 * @param \PinkCrab\Registerables\Registration_Middleware\Registerable $registerable
51 51
 	 * @return void
52 52
 	 */
53
-	public function register( Registerable $registerable ): void {
53
+	public function register(Registerable $registerable): void {
54 54
 		/** @var Post_Type $registerable, Validation call below catches no Post_Type Registerables */
55 55
 
56
-		if ( ! $this->validator->validate( $registerable ) ) {
57
-			throw new Exception( 'Invalid post type model' );
56
+		if ( ! $this->validator->validate($registerable)) {
57
+			throw new Exception('Invalid post type model');
58 58
 		}
59 59
 
60 60
 		// Attempt to register the post type.
61 61
 		try {
62
-			$result = register_post_type( $registerable->key, $this->compile_args( $registerable ) );
63
-			if ( is_a( $result, \WP_Error::class ) ) {
64
-				throw new Exception( join( $result->get_error_messages() ) );
62
+			$result = register_post_type($registerable->key, $this->compile_args($registerable));
63
+			if (is_a($result, \WP_Error::class)) {
64
+				throw new Exception(join($result->get_error_messages()));
65 65
 			}
66
-		} catch ( \Throwable $th ) {
67
-			throw new Exception( "Failed to register {$registerable->key} post type ({$th->getMessage()})" );
66
+		} catch (\Throwable $th) {
67
+			throw new Exception("Failed to register {$registerable->key} post type ({$th->getMessage()})");
68 68
 		}
69 69
 
70 70
 		// Register all meta data for post type.
71
-		$this->register_meta_data( $registerable );
71
+		$this->register_meta_data($registerable);
72 72
 	}
73 73
 
74 74
 	/**
@@ -77,24 +77,24 @@  discard block
 block discarded – undo
77 77
 	 * @param \PinkCrab\Registerables\Post_Type $post_type
78 78
 	 * @return void
79 79
 	 */
80
-	protected function register_meta_data( Post_Type $post_type ): void {
80
+	protected function register_meta_data(Post_Type $post_type): void {
81 81
 
82 82
 		// Get all meta fields for post_type.
83
-		$meta_fields = $post_type->meta_data( array() );
83
+		$meta_fields = $post_type->meta_data(array());
84 84
 		// Attempt to register all Meta for post_type.
85 85
 		try {
86
-			foreach ( $meta_fields as $meta_field ) {
86
+			foreach ($meta_fields as $meta_field) {
87 87
 				// Set object data for this post_type.
88
-				$meta_field->object_subtype( $post_type->key );
89
-				$meta_field->meta_type( 'post' );
88
+				$meta_field->object_subtype($post_type->key);
89
+				$meta_field->meta_type('post');
90 90
 
91
-				$result = register_meta( $meta_field->get_meta_type(), $meta_field->get_meta_key(), $meta_field->parse_args() );
92
-				if ( ! $result ) {
93
-					throw new Exception( "Failed to register {$meta_field->get_meta_key()} (meta) for {$post_type->singular} post type" );
91
+				$result = register_meta($meta_field->get_meta_type(), $meta_field->get_meta_key(), $meta_field->parse_args());
92
+				if ( ! $result) {
93
+					throw new Exception("Failed to register {$meta_field->get_meta_key()} (meta) for {$post_type->singular} post type");
94 94
 				}
95 95
 			}
96
-		} catch ( \Throwable $th ) {
97
-			throw new Exception( $th->getMessage() );
96
+		} catch (\Throwable $th) {
97
+			throw new Exception($th->getMessage());
98 98
 		}
99 99
 	}
100 100
 
@@ -104,64 +104,64 @@  discard block
 block discarded – undo
104 104
 	 * @param \PinkCrab\Registerables\Post_Type $post_type
105 105
 	 * @return array<string, string|int|array<string, string>>
106 106
 	 */
107
-	protected function compile_args( Post_Type $post_type ): array {
107
+	protected function compile_args(Post_Type $post_type): array {
108 108
 		// Create the labels.
109 109
 		$labels = array(
110 110
 			'name'                     => $post_type->plural,
111 111
 			'singular_name'            => $post_type->singular,
112
-			'add_new'                  => _x( 'Add New', 'Add new post label of custom post type', 'pinkcrab' ),
112
+			'add_new'                  => _x('Add New', 'Add new post label of custom post type', 'pinkcrab'),
113 113
 			/* translators: %s: Post type singular name */
114
-			'add_new_item'             => wp_sprintf( _x( 'Add New %s', 'Label for adding a new singular item. Default is ‘Add New {post type singular name}’.', 'pinkcrab' ), $post_type->singular ),
114
+			'add_new_item'             => wp_sprintf(_x('Add New %s', 'Label for adding a new singular item. Default is ‘Add New {post type singular name}’.', 'pinkcrab'), $post_type->singular),
115 115
 			/* translators: %s: Post type singular name */
116
-			'edit_item'                => wp_sprintf( _x( 'Edit %s', 'Label for editing a singular item. Default is ‘Edit {post type singular name}’.', 'pinkcrab' ), $post_type->singular ),
116
+			'edit_item'                => wp_sprintf(_x('Edit %s', 'Label for editing a singular item. Default is ‘Edit {post type singular name}’.', 'pinkcrab'), $post_type->singular),
117 117
 			/* translators: %s: Post type singular name */
118
-			'new_item'                 => wp_sprintf( _x( 'New %s', 'Label for the new item page title. Default is ‘New {post type singular name}’.', 'pinkcrab' ), $post_type->singular ),
118
+			'new_item'                 => wp_sprintf(_x('New %s', 'Label for the new item page title. Default is ‘New {post type singular name}’.', 'pinkcrab'), $post_type->singular),
119 119
 			/* translators: %s: Post type singular name */
120
-			'view_item'                => wp_sprintf( _x( 'View %s', 'Label for viewing a singular item. Default is ‘View {post type singular name}’.', 'pinkcrab' ), $post_type->singular ),
120
+			'view_item'                => wp_sprintf(_x('View %s', 'Label for viewing a singular item. Default is ‘View {post type singular name}’.', 'pinkcrab'), $post_type->singular),
121 121
 			/* translators: %s: Post type plural name */
122
-			'view_items'               => wp_sprintf( _x( 'View %s', 'Label for viewing post type archives. Default is ‘View {post type plural name}’.', 'pinkcrab' ), $post_type->plural ),
122
+			'view_items'               => wp_sprintf(_x('View %s', 'Label for viewing post type archives. Default is ‘View {post type plural name}’.', 'pinkcrab'), $post_type->plural),
123 123
 			/* translators: %s: Post type singular name */
124
-			'search_items'             => wp_sprintf( _x( 'Search %s', 'Label for searching plural items. Default is ‘Search {post type plural name}’.', 'pinkcrab' ), $post_type->singular ),
124
+			'search_items'             => wp_sprintf(_x('Search %s', 'Label for searching plural items. Default is ‘Search {post type plural name}’.', 'pinkcrab'), $post_type->singular),
125 125
 			/* translators: %s: Post type plural name */
126
-			'not_found'                => wp_sprintf( _x( 'No %s found', 'Label used when no items are found. Default is ‘No {post type plural name} found’.', 'pinkcrab' ), $post_type->plural ),
126
+			'not_found'                => wp_sprintf(_x('No %s found', 'Label used when no items are found. Default is ‘No {post type plural name} found’.', 'pinkcrab'), $post_type->plural),
127 127
 			/* translators: %s: Post type plural name */
128
-			'not_found_in_trash'       => wp_sprintf( _x( 'No %s found in Trash', 'Label used when no items are in the Trash. Default is ‘No {post type plural name} found in Trash’.', 'pinkcrab' ), $post_type->plural ),
128
+			'not_found_in_trash'       => wp_sprintf(_x('No %s found in Trash', 'Label used when no items are in the Trash. Default is ‘No {post type plural name} found in Trash’.', 'pinkcrab'), $post_type->plural),
129 129
 			/* translators: %s: Post type singular name */
130
-			'parent_item_colon'        => wp_sprintf( _x( 'Parent %s:', 'Label used to prefix parents of hierarchical items. Not used on non-hierarchical post types. Default is ‘Parent {post type plural name}:’.', 'pinkcrab' ), $post_type->singular ),
130
+			'parent_item_colon'        => wp_sprintf(_x('Parent %s:', 'Label used to prefix parents of hierarchical items. Not used on non-hierarchical post types. Default is ‘Parent {post type plural name}:’.', 'pinkcrab'), $post_type->singular),
131 131
 			/* translators: %s: Post type singular name */
132
-			'all_items'                => wp_sprintf( _x( 'All %s', 'Label to signify all items in a submenu link. Default is ‘All {post type plural name}’.', 'pinkcrab' ), $post_type->plural ),
132
+			'all_items'                => wp_sprintf(_x('All %s', 'Label to signify all items in a submenu link. Default is ‘All {post type plural name}’.', 'pinkcrab'), $post_type->plural),
133 133
 			/* translators: %s: Post type plural name */
134
-			'archives'                 => wp_sprintf( _x( '%s Archives', ' Label for archives in nav menus. Default is ‘Post Archives’.', 'pinkcrab' ), \ucfirst( $post_type->plural ) ),
134
+			'archives'                 => wp_sprintf(_x('%s Archives', ' Label for archives in nav menus. Default is ‘Post Archives’.', 'pinkcrab'), \ucfirst($post_type->plural)),
135 135
 			/* translators: %s: Post type plural name */
136
-			'attributes'               => wp_sprintf( _x( '%s Attributes', 'Label for the attributes meta box. Default is ‘{post type plural name} Attributes’.', 'pinkcrab' ), \ucfirst( $post_type->plural ) ),
136
+			'attributes'               => wp_sprintf(_x('%s Attributes', 'Label for the attributes meta box. Default is ‘{post type plural name} Attributes’.', 'pinkcrab'), \ucfirst($post_type->plural)),
137 137
 			/* translators: %s: Post type singular name */
138
-			'insert_into_item'         => wp_sprintf( _x( 'Insert into %s', 'Label for the media frame button. Default is ‘Insert into {post type plural name}’.', 'pinkcrab' ), $post_type->singular ),
138
+			'insert_into_item'         => wp_sprintf(_x('Insert into %s', 'Label for the media frame button. Default is ‘Insert into {post type plural name}’.', 'pinkcrab'), $post_type->singular),
139 139
 			/* translators: %s: Post type singular name */
140
-			'uploaded_to_this_item'    => wp_sprintf( _x( 'Uploaded to this %s', 'Label for the media frame filter. Default is ‘Uploaded to this {post type plural name}’.', 'pinkcrab' ), $post_type->singular ),
141
-			'featured_image'           => _x( 'Featured image', 'Label for the featured image meta box title. Default is ‘Featured image’.', 'pinkcrab' ),
142
-			'set_featured_image'       => _x( 'Set featured image', 'Label for setting the featured image. Default is ‘Set featured image’.', 'pinkcrab' ),
143
-			'remove_featured_image'    => _x( 'Remove featured image', 'Label for removing the featured image. Default is ‘Remove featured image’.', 'pinkcrab' ),
144
-			'use_featured_image'       => _x( 'Use as featured image', 'Label in the media frame for using a featured image. Default is ‘Use as featured image’.', 'pinkcrab' ),
140
+			'uploaded_to_this_item'    => wp_sprintf(_x('Uploaded to this %s', 'Label for the media frame filter. Default is ‘Uploaded to this {post type plural name}’.', 'pinkcrab'), $post_type->singular),
141
+			'featured_image'           => _x('Featured image', 'Label for the featured image meta box title. Default is ‘Featured image’.', 'pinkcrab'),
142
+			'set_featured_image'       => _x('Set featured image', 'Label for setting the featured image. Default is ‘Set featured image’.', 'pinkcrab'),
143
+			'remove_featured_image'    => _x('Remove featured image', 'Label for removing the featured image. Default is ‘Remove featured image’.', 'pinkcrab'),
144
+			'use_featured_image'       => _x('Use as featured image', 'Label in the media frame for using a featured image. Default is ‘Use as featured image’.', 'pinkcrab'),
145 145
 			'menu_name'                => $post_type->plural,
146 146
 			/* translators: %s: Post type plural name */
147
-			'filter_items_list'        => wp_sprintf( _x( 'Filter %s list', 'Label for the table views hidden heading. Default is ‘Filter {post type plural name} list’.', 'pinkcrab' ), $post_type->plural ),
148
-			'filter_by_date'           => _x( 'Filter by date', 'Label for the date filter in list tables. Default is ‘Filter by date’.', 'pinkcrab' ),
147
+			'filter_items_list'        => wp_sprintf(_x('Filter %s list', 'Label for the table views hidden heading. Default is ‘Filter {post type plural name} list’.', 'pinkcrab'), $post_type->plural),
148
+			'filter_by_date'           => _x('Filter by date', 'Label for the date filter in list tables. Default is ‘Filter by date’.', 'pinkcrab'),
149 149
 			/* translators: %s: Post type plural name */
150
-			'items_list'               => wp_sprintf( _x( '%s list', 'Label for the table hidden heading. Default is ‘{post type plural name} list’.', 'pinkcrab' ), \ucfirst( $post_type->plural ) ),
150
+			'items_list'               => wp_sprintf(_x('%s list', 'Label for the table hidden heading. Default is ‘{post type plural name} list’.', 'pinkcrab'), \ucfirst($post_type->plural)),
151 151
 			/* translators: %s: Post type singular name */
152
-			'item_published'           => wp_sprintf( _x( '%s published', 'Label used when an item is published. Default is ‘{post type singular name} published’.', 'pinkcrab' ), \ucfirst( $post_type->singular ) ),
152
+			'item_published'           => wp_sprintf(_x('%s published', 'Label used when an item is published. Default is ‘{post type singular name} published’.', 'pinkcrab'), \ucfirst($post_type->singular)),
153 153
 			/* translators: %s: Post type singular name */
154
-			'item_published_privately' => wp_sprintf( _x( '%s published privately', 'Label used when an item is published with private visibility. Default is ‘{post type singular name} published privately.’.', 'pinkcrab' ), \ucfirst( $post_type->singular ) ),
154
+			'item_published_privately' => wp_sprintf(_x('%s published privately', 'Label used when an item is published with private visibility. Default is ‘{post type singular name} published privately.’.', 'pinkcrab'), \ucfirst($post_type->singular)),
155 155
 			/* translators: %s: Post type singular name */
156
-			'item_reverted_to_draft'   => wp_sprintf( _x( '%s reverted to draft', 'Label used when an item is switched to a draft. Default is ‘{post type singular name} reverted to draft’.', 'pinkcrab' ), \ucfirst( $post_type->singular ) ),
156
+			'item_reverted_to_draft'   => wp_sprintf(_x('%s reverted to draft', 'Label used when an item is switched to a draft. Default is ‘{post type singular name} reverted to draft’.', 'pinkcrab'), \ucfirst($post_type->singular)),
157 157
 			/* translators: %s: Post type singular name */
158
-			'item_scheduled'           => wp_sprintf( _x( '%s scheduled', 'Label used when an item is scheduled for publishing. Default is ‘{post type singular name} scheduled.’ ', 'pinkcrab' ), \ucfirst( $post_type->singular ) ),
158
+			'item_scheduled'           => wp_sprintf(_x('%s scheduled', 'Label used when an item is scheduled for publishing. Default is ‘{post type singular name} scheduled.’ ', 'pinkcrab'), \ucfirst($post_type->singular)),
159 159
 			/* translators: %s: Post type singular name */
160
-			'item_updated'             => wp_sprintf( _x( '%s updated', 'Label used when an item is updated. Default is ‘{post type singular name} updated.’.', 'pinkcrab' ), \ucfirst( $post_type->singular ) ),
160
+			'item_updated'             => wp_sprintf(_x('%s updated', 'Label used when an item is updated. Default is ‘{post type singular name} updated.’.', 'pinkcrab'), \ucfirst($post_type->singular)),
161 161
 			/* translators: %s: Post type singular name */
162
-			'item_link'                => wp_sprintf( _x( '%s Link', 'Title for a navigation link block variation. Default is ‘{post type singular name} Link’.', 'pinkcrab' ), \ucfirst( $post_type->singular ) ),
162
+			'item_link'                => wp_sprintf(_x('%s Link', 'Title for a navigation link block variation. Default is ‘{post type singular name} Link’.', 'pinkcrab'), \ucfirst($post_type->singular)),
163 163
 			/* translators: %s: Post type singular name */
164
-			'item_link_description'    => wp_sprintf( _x( 'A link to a %s', 'Description for a navigation link block variation. Default is ‘A link to a {post type singular name}’.', 'pinkcrab' ), $post_type->singular ),
164
+			'item_link_description'    => wp_sprintf(_x('A link to a %s', 'Description for a navigation link block variation. Default is ‘A link to a {post type singular name}’.', 'pinkcrab'), $post_type->singular),
165 165
 		);
166 166
 
167 167
 		/**
@@ -172,10 +172,10 @@  discard block
 block discarded – undo
172 172
 		 * @param Post_Type $cpt
173 173
 		 * @return array<string, string>
174 174
 		 */
175
-		$labels = apply_filters( Registerable_Hooks::POST_TYPE_LABELS, $post_type->filter_labels( $labels ), $post_type );
175
+		$labels = apply_filters(Registerable_Hooks::POST_TYPE_LABELS, $post_type->filter_labels($labels), $post_type);
176 176
 
177 177
 		// Set the rewrite rules if not defined.
178
-		if ( is_null( $post_type->rewrite ) ) {
178
+		if (is_null($post_type->rewrite)) {
179 179
 			$post_type->rewrite = array(
180 180
 				'slug'       => $post_type->key,
181 181
 				'with_front' => true,
@@ -188,30 +188,30 @@  discard block
 block discarded – undo
188 188
 		$args = array(
189 189
 			'labels'                => $labels,
190 190
 			'description'           => $post_type->description ?: $post_type->plural,
191
-			'hierarchical'          => is_bool( $post_type->hierarchical ) ? $post_type->hierarchical : false,
191
+			'hierarchical'          => is_bool($post_type->hierarchical) ? $post_type->hierarchical : false,
192 192
 			'supports'              => $post_type->supports,
193
-			'public'                => is_bool( $post_type->public ) ? $post_type->public : true,
194
-			'show_ui'               => is_bool( $post_type->show_ui ) ? $post_type->show_ui : true,
195
-			'show_in_menu'          => is_bool( $post_type->show_in_menu ) ? $post_type->show_in_menu : true,
196
-			'show_in_admin_bar'     => is_bool( $post_type->show_in_admin_bar ) ? $post_type->show_in_admin_bar : true,
193
+			'public'                => is_bool($post_type->public) ? $post_type->public : true,
194
+			'show_ui'               => is_bool($post_type->show_ui) ? $post_type->show_ui : true,
195
+			'show_in_menu'          => is_bool($post_type->show_in_menu) ? $post_type->show_in_menu : true,
196
+			'show_in_admin_bar'     => is_bool($post_type->show_in_admin_bar) ? $post_type->show_in_admin_bar : true,
197 197
 			'menu_position'         => $post_type->menu_position ?: 60,
198 198
 			'menu_icon'             => $post_type->dashicon ?: 'dashicons-pets',
199
-			'show_in_nav_menus'     => is_bool( $post_type->show_in_nav_menus ) ? $post_type->show_in_nav_menus : true,
200
-			'publicly_queryable'    => is_bool( $post_type->publicly_queryable ) ? $post_type->publicly_queryable : true,
201
-			'exclude_from_search'   => is_bool( $post_type->exclude_from_search ) ? $post_type->exclude_from_search : true,
202
-			'has_archive'           => is_bool( $post_type->has_archive ) ? $post_type->has_archive : true,
203
-			'query_var'             => is_bool( $post_type->query_var ) ? $post_type->query_var : false,
204
-			'can_export'            => is_bool( $post_type->can_export ) ? $post_type->can_export : true,
205
-			'rewrite'               => is_bool( $post_type->rewrite ) ? $post_type->rewrite : false,
199
+			'show_in_nav_menus'     => is_bool($post_type->show_in_nav_menus) ? $post_type->show_in_nav_menus : true,
200
+			'publicly_queryable'    => is_bool($post_type->publicly_queryable) ? $post_type->publicly_queryable : true,
201
+			'exclude_from_search'   => is_bool($post_type->exclude_from_search) ? $post_type->exclude_from_search : true,
202
+			'has_archive'           => is_bool($post_type->has_archive) ? $post_type->has_archive : true,
203
+			'query_var'             => is_bool($post_type->query_var) ? $post_type->query_var : false,
204
+			'can_export'            => is_bool($post_type->can_export) ? $post_type->can_export : true,
205
+			'rewrite'               => is_bool($post_type->rewrite) ? $post_type->rewrite : false,
206 206
 			'capability_type'       => $post_type->capability_type ?: 'page',
207 207
 			'capabilities'          => $post_type->capabilities ?: array(),
208 208
 			'taxonomies'            => $post_type->taxonomies ?: array(),
209
-			'show_in_rest'          => is_bool( $post_type->show_in_rest ) ? $post_type->show_in_rest : true,
209
+			'show_in_rest'          => is_bool($post_type->show_in_rest) ? $post_type->show_in_rest : true,
210 210
 			'rest_base'             => $post_type->rest_base ?? $post_type->key,
211
-			'rest_controller_class' => \class_exists( $post_type->rest_controller_class ) ? $post_type->rest_controller_class : \WP_REST_Posts_Controller::class,
212
-			'delete_with_user'      => \is_bool( $post_type->delete_with_user ) ? $post_type->delete_with_user : null,
213
-			'template'              => \is_array( $post_type->templates ) ? $post_type->templates : array(),
214
-			'template_lock'         => \is_string( $post_type->template_lock ) ? $post_type->template_lock : false,
211
+			'rest_controller_class' => \class_exists($post_type->rest_controller_class) ? $post_type->rest_controller_class : \WP_REST_Posts_Controller::class,
212
+			'delete_with_user'      => \is_bool($post_type->delete_with_user) ? $post_type->delete_with_user : null,
213
+			'template'              => \is_array($post_type->templates) ? $post_type->templates : array(),
214
+			'template_lock'         => \is_string($post_type->template_lock) ? $post_type->template_lock : false,
215 215
 		);
216 216
 
217 217
 		/**
@@ -221,6 +221,6 @@  discard block
 block discarded – undo
221 221
 		 * @param Post_Type $cpt
222 222
 		 * @return array<string, string|bool|int|null|array<string, string>
223 223
 		 */
224
-		return apply_filters( Registerable_Hooks::POST_TYPE_ARGS, $post_type->filter_args( $args ), $post_type );
224
+		return apply_filters(Registerable_Hooks::POST_TYPE_ARGS, $post_type->filter_args($args), $post_type);
225 225
 	}
226 226
 }
Please login to merge, or discard this patch.
src/Registrar/Registrar.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -35,5 +35,5 @@
 block discarded – undo
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
 }
Please login to merge, or discard this patch.
src/Registrar/Registrar_Factory.php 1 patch
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -55,16 +55,16 @@  discard block
 block discarded – undo
55 55
 	 * @return Registrar
56 56
 	 * @throws Exception If not valid registerable type passed.
57 57
 	 */
58
-	public function create_from_registerable( Registerable $registerable ): Registrar {
59
-		switch ( true ) {
60
-			case is_a( $registerable, Post_Type::class ):
61
-				return new Post_Type_Registrar( new Post_Type_Validator() );
58
+	public function create_from_registerable(Registerable $registerable): Registrar {
59
+		switch (true) {
60
+			case is_a($registerable, Post_Type::class):
61
+				return new Post_Type_Registrar(new Post_Type_Validator());
62 62
 
63
-			case is_a( $registerable, Taxonomy::class ):
64
-				return new Taxonomy_Registrar( new Taxonomy_Validator() );
63
+			case is_a($registerable, Taxonomy::class):
64
+				return new Taxonomy_Registrar(new Taxonomy_Validator());
65 65
 
66 66
 			default:
67
-				throw new Exception( 'Invalid registerable type (no dispatcher exists)' );
67
+				throw new Exception('Invalid registerable type (no dispatcher exists)');
68 68
 		}
69 69
 	}
70 70
 
@@ -75,8 +75,8 @@  discard block
 block discarded – undo
75 75
 	 * @param \PinkCrab\Loader\Hook_Loader $loader
76 76
 	 * @return Meta_Box_Registrar
77 77
 	 */
78
-	public function meta_box_registrar( DI_Container $container, Hook_Loader $loader ): Meta_Box_Registrar {
79
-		return new Meta_Box_Registrar( new Meta_Box_Validator(), $container, $loader );
78
+	public function meta_box_registrar(DI_Container $container, Hook_Loader $loader): Meta_Box_Registrar {
79
+		return new Meta_Box_Registrar(new Meta_Box_Validator(), $container, $loader);
80 80
 	}
81 81
 
82 82
 }
Please login to merge, or discard this patch.
src/Registrar/Taxonomy_Registrar.php 1 patch
Spacing   +45 added lines, -45 removed lines patch added patch discarded remove patch
@@ -40,7 +40,7 @@  discard block
 block discarded – undo
40 40
 	 */
41 41
 	protected $validator;
42 42
 
43
-	public function __construct( Taxonomy_Validator $validator ) {
43
+	public function __construct(Taxonomy_Validator $validator) {
44 44
 		$this->validator = $validator;
45 45
 	}
46 46
 
@@ -50,11 +50,11 @@  discard block
 block discarded – undo
50 50
 	 * @param \PinkCrab\Registerables\Registration_Middleware\Registerable $registerable
51 51
 	 * @return void
52 52
 	 */
53
-	public function register( Registerable $registerable ): void {
53
+	public function register(Registerable $registerable): void {
54 54
 		/** @var Taxonomy $registerable, Validation call below catches no Post_Type Registerables */
55 55
 
56
-		if ( ! $this->validator->validate( $registerable ) ) {
57
-			throw new Exception( 'Invalid taxonomy model' );
56
+		if ( ! $this->validator->validate($registerable)) {
57
+			throw new Exception('Invalid taxonomy model');
58 58
 		}
59 59
 
60 60
 		// Attempt to register the post type.
@@ -62,18 +62,18 @@  discard block
 block discarded – undo
62 62
 			$result = \register_taxonomy(
63 63
 				$registerable->slug,
64 64
 				$registerable->object_type,
65
-				$this->compile_args( $registerable )
65
+				$this->compile_args($registerable)
66 66
 			);
67 67
 
68
-			if ( is_a( $result, \WP_Error::class ) ) {
69
-				throw new Exception( join( $result->get_error_messages() ) );
68
+			if (is_a($result, \WP_Error::class)) {
69
+				throw new Exception(join($result->get_error_messages()));
70 70
 			}
71
-		} catch ( \Throwable $th ) {
72
-			throw new Exception( "Failed to register {$registerable->slug} taxonomy ({$th->getMessage()})" );
71
+		} catch (\Throwable $th) {
72
+			throw new Exception("Failed to register {$registerable->slug} taxonomy ({$th->getMessage()})");
73 73
 		}
74 74
 
75 75
 		// Register any associated meta data.
76
-		$this->register_meta_data( $registerable );
76
+		$this->register_meta_data($registerable);
77 77
 
78 78
 	}
79 79
 
@@ -83,25 +83,25 @@  discard block
 block discarded – undo
83 83
 	 * @param \PinkCrab\Registerables\Taxonomy $taxonomy
84 84
 	 * @return void
85 85
 	 */
86
-	protected function register_meta_data( Taxonomy $taxonomy ): void {
86
+	protected function register_meta_data(Taxonomy $taxonomy): void {
87 87
 
88 88
 		// Get all meta fields for taxonomy.
89
-		$meta_fields = $taxonomy->meta_data( array() );
89
+		$meta_fields = $taxonomy->meta_data(array());
90 90
 
91 91
 		// Attempt to register all Meta for taxonomy.
92 92
 		try {
93
-			foreach ( $meta_fields as $meta_field ) {
93
+			foreach ($meta_fields as $meta_field) {
94 94
 				// Set object data for this taxonomy.
95
-				$meta_field->object_subtype( $taxonomy->slug );
96
-				$meta_field->meta_type( 'term' );
95
+				$meta_field->object_subtype($taxonomy->slug);
96
+				$meta_field->meta_type('term');
97 97
 
98
-				$result = register_meta( $meta_field->get_meta_type(), $meta_field->get_meta_key(), $meta_field->parse_args() );
99
-				if ( ! $result ) {
100
-					throw new Exception( "Failed to register {$meta_field->get_meta_key()} (meta) for {$taxonomy->singular} taxonomy" );
98
+				$result = register_meta($meta_field->get_meta_type(), $meta_field->get_meta_key(), $meta_field->parse_args());
99
+				if ( ! $result) {
100
+					throw new Exception("Failed to register {$meta_field->get_meta_key()} (meta) for {$taxonomy->singular} taxonomy");
101 101
 				}
102 102
 			}
103
-		} catch ( \Throwable $th ) {
104
-			throw new Exception( $th->getMessage() );
103
+		} catch (\Throwable $th) {
104
+			throw new Exception($th->getMessage());
105 105
 		}
106 106
 	}
107 107
 
@@ -111,59 +111,59 @@  discard block
 block discarded – undo
111 111
 	 * @param \PinkCrab\Registerables\Taxonomy $taxonomy
112 112
 	 * @return array<string, string|int|array<string, string>>
113 113
 	 */
114
-	protected function compile_args( Taxonomy $taxonomy ): array {
114
+	protected function compile_args(Taxonomy $taxonomy): array {
115 115
 		// Create the labels.
116 116
 		$base_labels = array(
117 117
 			'name'                  => $taxonomy->plural,
118 118
 			'singular_name'         => $taxonomy->singular,
119
-			'menu_name'             => \ucfirst( \esc_attr( $taxonomy->plural ?? '' ) ),
119
+			'menu_name'             => \ucfirst(\esc_attr($taxonomy->plural ?? '')),
120 120
 			/* translators: %s: Taxonomy plural name */
121
-			'search_items'          => wp_sprintf( _x( 'Search %s', 'Label for searching plural items. Default is ‘Search {taxonomy plural name}’.', 'pinkcrab' ), \esc_attr( $taxonomy->plural ?? '' ) ),
121
+			'search_items'          => wp_sprintf(_x('Search %s', 'Label for searching plural items. Default is ‘Search {taxonomy plural name}’.', 'pinkcrab'), \esc_attr($taxonomy->plural ?? '')),
122 122
 			/* translators: %s: Taxonomy plural name */
123
-			'popular_items'         => wp_sprintf( _x( 'Popular %s', '**', 'pinkcrab' ), \esc_attr( $taxonomy->plural ?? '' ) ),
123
+			'popular_items'         => wp_sprintf(_x('Popular %s', '**', 'pinkcrab'), \esc_attr($taxonomy->plural ?? '')),
124 124
 			/* translators: %s: Taxonomy singular name */
125
-			'edit_item'             => wp_sprintf( _x( 'Edit %s', 'Label for editing a singular item. Default is ‘Edit {taxonomy singular name}’.', 'pinkcrab' ), \esc_attr( $taxonomy->singular ?? '' ) ),
125
+			'edit_item'             => wp_sprintf(_x('Edit %s', 'Label for editing a singular item. Default is ‘Edit {taxonomy singular name}’.', 'pinkcrab'), \esc_attr($taxonomy->singular ?? '')),
126 126
 			/* translators: %s: Taxonomy singular name */
127
-			'view_item'             => wp_sprintf( _x( 'View %s', 'Label for viewing a singular item. Default is ‘View {taxonomy singular name}’.', 'pinkcrab' ), \esc_attr( $taxonomy->singular ?? '' ) ),
127
+			'view_item'             => wp_sprintf(_x('View %s', 'Label for viewing a singular item. Default is ‘View {taxonomy singular name}’.', 'pinkcrab'), \esc_attr($taxonomy->singular ?? '')),
128 128
 			/* translators: %s: Taxonomy singular name */
129
-			'update_item'           => wp_sprintf( _x( 'Update %s', 'Label for editing a singular item. Default is ‘Edit {taxonomy singular name}’.', 'pinkcrab' ), \esc_attr( $taxonomy->singular ?? '' ) ),
129
+			'update_item'           => wp_sprintf(_x('Update %s', 'Label for editing a singular item. Default is ‘Edit {taxonomy singular name}’.', 'pinkcrab'), \esc_attr($taxonomy->singular ?? '')),
130 130
 			/* translators: %s: Taxonomy singular name */
131
-			'add_new_item'          => wp_sprintf( _x( 'Add New %s', 'Label for adding a new singular item. Default is ‘Add New {taxonomy singular name}’.', 'pinkcrab' ), \esc_attr( $taxonomy->singular ?? '' ) ),
131
+			'add_new_item'          => wp_sprintf(_x('Add New %s', 'Label for adding a new singular item. Default is ‘Add New {taxonomy singular name}’.', 'pinkcrab'), \esc_attr($taxonomy->singular ?? '')),
132 132
 			/* translators: %s: Taxonomy singular name */
133
-			'new_item_name'         => wp_sprintf( _x( 'New %s', 'Label for the new item page title. Default is ‘New {taxonomy singular name}’.', 'pinkcrab' ), \esc_attr( $taxonomy->singular ?? '' ) ),
133
+			'new_item_name'         => wp_sprintf(_x('New %s', 'Label for the new item page title. Default is ‘New {taxonomy singular name}’.', 'pinkcrab'), \esc_attr($taxonomy->singular ?? '')),
134 134
 			/* translators: %s: Taxonomy plural name */
135
-			'not_found'             => wp_sprintf( _x( 'No %s found', 'Label used when no items are found. Default is ‘No {taxonomy plural name} found’.', 'pinkcrab' ), \esc_attr( $taxonomy->plural ?? '' ) ),
135
+			'not_found'             => wp_sprintf(_x('No %s found', 'Label used when no items are found. Default is ‘No {taxonomy plural name} found’.', 'pinkcrab'), \esc_attr($taxonomy->plural ?? '')),
136 136
 			/* translators: %s: Taxonomy plural name */
137
-			'items_list'            => wp_sprintf( _x( '%s list', 'Label for the table hidden heading. Default is ‘{taxonomy plural name} list’.', 'pinkcrab' ), \ucfirst( \esc_attr( $taxonomy->plural ?? '' ) ) ),
137
+			'items_list'            => wp_sprintf(_x('%s list', 'Label for the table hidden heading. Default is ‘{taxonomy plural name} list’.', 'pinkcrab'), \ucfirst(\esc_attr($taxonomy->plural ?? ''))),
138 138
 			/* translators: %s: Taxonomy plural name */
139
-			'items_list_navigation' => wp_sprintf( _x( '%s list navigation', 'Label for the pagination hidden heading. Default is ‘{taxonomy plural name} list’.', 'pinkcrab' ), \ucfirst( \esc_attr( $taxonomy->plural ?? '' ) ) ),
139
+			'items_list_navigation' => wp_sprintf(_x('%s list navigation', 'Label for the pagination hidden heading. Default is ‘{taxonomy plural name} list’.', 'pinkcrab'), \ucfirst(\esc_attr($taxonomy->plural ?? ''))),
140 140
 			/* translators: %s: Taxonomy plural name */
141
-			'all_items'             => wp_sprintf( _x( 'All %s', 'Label for the pagination hidden heading. Default is ‘{taxonomy plural name} list’.', 'pinkcrab' ), \ucfirst( \esc_attr( $taxonomy->plural ?? '' ) ) ),
142
-			'most_used'             => _x( 'Most Used', 'Title for the Most Used tab. Default \'Most Used\'.', 'pinkcrab' ),
141
+			'all_items'             => wp_sprintf(_x('All %s', 'Label for the pagination hidden heading. Default is ‘{taxonomy plural name} list’.', 'pinkcrab'), \ucfirst(\esc_attr($taxonomy->plural ?? ''))),
142
+			'most_used'             => _x('Most Used', 'Title for the Most Used tab. Default \'Most Used\'.', 'pinkcrab'),
143 143
 			/* translators: %s: Taxonomy plural name */
144
-			'back_to_items'         => wp_sprintf( _x( '← Back to %s', 'Label for the pagination hidden heading. Default is ‘{taxonomy plural name} list’.', 'pinkcrab' ), \ucfirst( \esc_attr( $taxonomy->plural ?? '' ) ) ),
144
+			'back_to_items'         => wp_sprintf(_x('← Back to %s', 'Label for the pagination hidden heading. Default is ‘{taxonomy plural name} list’.', 'pinkcrab'), \ucfirst(\esc_attr($taxonomy->plural ?? ''))),
145 145
 			/* translators: %s: Taxonomy singular name */
146
-			'item_link'             => wp_sprintf( _x( '%s Link', 'Title for a navigation link block variation. Default is ‘{taxonomy singular name} Link’.', 'pinkcrab' ), \ucfirst( \esc_attr( $taxonomy->singular ?? '' ) ) ),
146
+			'item_link'             => wp_sprintf(_x('%s Link', 'Title for a navigation link block variation. Default is ‘{taxonomy singular name} Link’.', 'pinkcrab'), \ucfirst(\esc_attr($taxonomy->singular ?? ''))),
147 147
 			/* translators: %s: Taxonomy singular name */
148
-			'item_link_description' => wp_sprintf( _x( 'A link to a %s', 'Description for a navigation link block variation. Default is ‘A link to a {taxonomy singular name}’.', 'pinkcrab' ), \esc_attr( $taxonomy->singular ?? '' ) ),
148
+			'item_link_description' => wp_sprintf(_x('A link to a %s', 'Description for a navigation link block variation. Default is ‘A link to a {taxonomy singular name}’.', 'pinkcrab'), \esc_attr($taxonomy->singular ?? '')),
149 149
 		);
150 150
 
151 151
 		$tag_labels = array(
152 152
 			/* translators: %s: Taxonomy plural name */
153
-			'separate_items_with_commas' => wp_sprintf( _x( 'Separate %s with commas', 'This label is only used for non-hierarchical taxonomies. Default \'Separate {taxonomy plural name} with commas\', used in the meta box.’.', 'pinkcrab' ), \esc_attr( $taxonomy->plural ?? '' ) ),
153
+			'separate_items_with_commas' => wp_sprintf(_x('Separate %s with commas', 'This label is only used for non-hierarchical taxonomies. Default \'Separate {taxonomy plural name} with commas\', used in the meta box.’.', 'pinkcrab'), \esc_attr($taxonomy->plural ?? '')),
154 154
 			/* translators: %s: Taxonomy plural name */
155
-			'add_or_remove_items'        => wp_sprintf( _x( 'Add or remove %s', 'This label is only used for non-hierarchical taxonomies. Default \'Add or remove {taxonomy plural name}\', used in the meta box when JavaScript is disabled.', 'pinkcrab' ), \esc_attr( $taxonomy->plural ?? '' ) ),
155
+			'add_or_remove_items'        => wp_sprintf(_x('Add or remove %s', 'This label is only used for non-hierarchical taxonomies. Default \'Add or remove {taxonomy plural name}\', used in the meta box when JavaScript is disabled.', 'pinkcrab'), \esc_attr($taxonomy->plural ?? '')),
156 156
 			/* translators: %s: Taxonomy plural name */
157
-			'choose_from_most_used'      => wp_sprintf( _x( 'Add or remove %s', 'This label is only used on non-hierarchical taxonomies. Default\'Choose from the most used {taxonomy plural name}\', used in the meta box.', 'pinkcrab' ), \esc_attr( $taxonomy->plural ?? '' ) ),
157
+			'choose_from_most_used'      => wp_sprintf(_x('Add or remove %s', 'This label is only used on non-hierarchical taxonomies. Default\'Choose from the most used {taxonomy plural name}\', used in the meta box.', 'pinkcrab'), \esc_attr($taxonomy->plural ?? '')),
158 158
 		);
159 159
 
160 160
 		$hierarchical_labels = array(
161 161
 			/* translators: %s: Taxonomy singular name */
162
-			'parent_item_colon' => wp_sprintf( _x( 'Parent %s:', 'Label used to prefix parents of hierarchical items. Not used on non-hierarchical post types. Default is ‘Parent {taxonomy plural name}:’.', 'pinkcrab' ), \esc_attr( $taxonomy->singular ?? '' ) ),
162
+			'parent_item_colon' => wp_sprintf(_x('Parent %s:', 'Label used to prefix parents of hierarchical items. Not used on non-hierarchical post types. Default is ‘Parent {taxonomy plural name}:’.', 'pinkcrab'), \esc_attr($taxonomy->singular ?? '')),
163 163
 			/* translators: %s: Taxonomy singular name */
164
-			'parent_item'       => wp_sprintf( _x( 'Parent %s', '**', 'pinkcrab' ), \esc_attr( $taxonomy->singular ?? '' ) ),
164
+			'parent_item'       => wp_sprintf(_x('Parent %s', '**', 'pinkcrab'), \esc_attr($taxonomy->singular ?? '')),
165 165
 			/* translators: %s: Taxonomy singular name */
166
-			'filter_by_item'    => wp_sprintf( _x( 'Filter by %s', 'This label is only used for hierarchical taxonomies. Default \'Filter by {taxonomy singular name}\', used in the posts list table.', 'pinkcrab' ), \esc_attr( $taxonomy->singular ?? '' ) ),
166
+			'filter_by_item'    => wp_sprintf(_x('Filter by %s', 'This label is only used for hierarchical taxonomies. Default \'Filter by {taxonomy singular name}\', used in the posts list table.', 'pinkcrab'), \esc_attr($taxonomy->singular ?? '')),
167 167
 		);
168 168
 
169 169
 		$labels = array_merge(
@@ -179,7 +179,7 @@  discard block
 block discarded – undo
179 179
 		 * @param Taxonomy $taxonomy
180 180
 		 * @return array<string, string>
181 181
 		 */
182
-		$labels = apply_filters( Registerable_Hooks::TAXONOMY_LABELS, $taxonomy->filter_labels( $labels ), $taxonomy );
182
+		$labels = apply_filters(Registerable_Hooks::TAXONOMY_LABELS, $taxonomy->filter_labels($labels), $taxonomy);
183 183
 
184 184
 		// Compose args.
185 185
 		$args = array(
@@ -219,6 +219,6 @@  discard block
 block discarded – undo
219 219
 		 * @param Taxonomy $taxonomy
220 220
 		 * @return array<string, string|bool|int|null|array<string, string>
221 221
 		 */
222
-		return apply_filters( Registerable_Hooks::TAXONOMY_ARGS, $taxonomy->filter_args( $args ), $taxonomy );
222
+		return apply_filters(Registerable_Hooks::TAXONOMY_ARGS, $taxonomy->filter_args($args), $taxonomy);
223 223
 	}
224 224
 }
Please login to merge, or discard this patch.
src/Validator/Meta_Box_Validator.php 1 patch
Spacing   +17 added lines, -17 removed lines patch added patch discarded remove patch
@@ -32,7 +32,7 @@  discard block
 block discarded – undo
32 32
 
33 33
 class Meta_Box_Validator extends Abstract_Validator {
34 34
 
35
-	protected const REQUIRED_FIELDS = array( 'key', 'label' );
35
+	protected const REQUIRED_FIELDS = array('key', 'label');
36 36
 
37 37
 	/**
38 38
 	 * Validates the class passed.
@@ -40,7 +40,7 @@  discard block
 block discarded – undo
40 40
 	 * @param \PinkCrab\Registerables\Registration_Middleware\Registerable $object
41 41
 	 * @return bool
42 42
 	 */
43
-	public function validate( Registerable $object ): bool { // phpcs:ignore Generic.CodeAnalysis.UnusedFunctionParameter.FoundInExtendedClass
43
+	public function validate(Registerable $object): bool { // phpcs:ignore Generic.CodeAnalysis.UnusedFunctionParameter.FoundInExtendedClass
44 44
 		return false; //no op
45 45
 	}
46 46
 
@@ -50,20 +50,20 @@  discard block
 block discarded – undo
50 50
 	 * @param mixed $meta_box
51 51
 	 * @return bool
52 52
 	 */
53
-	public function verify_meta_box( $meta_box ): bool {
53
+	public function verify_meta_box($meta_box): bool {
54 54
 		// If this is not a valid post type, just bail here.
55
-		if ( ! is_object( $meta_box ) || ! is_a( $meta_box, Meta_Box::class ) ) {
56
-			$this->add_error( sprintf( '%s is not a valid Meta Box Model', is_object( $meta_box ) ? get_class( $meta_box ) : \gettype( $meta_box ) ) );
55
+		if ( ! is_object($meta_box) || ! is_a($meta_box, Meta_Box::class)) {
56
+			$this->add_error(sprintf('%s is not a valid Meta Box Model', is_object($meta_box) ? get_class($meta_box) : \gettype($meta_box)));
57 57
 			return false;
58 58
 		}
59 59
 
60 60
 		/* @var Meta_Box $object, already confirmed as a post type */
61 61
 
62 62
 		// Ensure all required fields are set.
63
-		$this->has_required_fields( $meta_box );
63
+		$this->has_required_fields($meta_box);
64 64
 
65 65
 		// Ensure can render view.
66
-		$this->has_valid_view( $meta_box );
66
+		$this->has_valid_view($meta_box);
67 67
 
68 68
 		// Check if the passed object has any errors.
69 69
 		return ! $this->has_errors();
@@ -75,12 +75,12 @@  discard block
 block discarded – undo
75 75
 	 * @param Meta_Box $meta_box
76 76
 	 * @return void
77 77
 	 */
78
-	protected function has_required_fields( Meta_Box $meta_box ): void {
79
-		foreach ( self::REQUIRED_FIELDS as $field ) {
80
-			if ( ! is_string( $meta_box->{$field} )
81
-			|| \mb_strlen( $meta_box->{$field} ) === 0
78
+	protected function has_required_fields(Meta_Box $meta_box): void {
79
+		foreach (self::REQUIRED_FIELDS as $field) {
80
+			if ( ! is_string($meta_box->{$field} )
81
+			|| \mb_strlen($meta_box->{$field} ) === 0
82 82
 			) {
83
-				$this->add_error( sprintf( '%s is not set on %s Meta Box Model', $field, get_class( $meta_box ) ) );
83
+				$this->add_error(sprintf('%s is not set on %s Meta Box Model', $field, get_class($meta_box)));
84 84
 			}
85 85
 		}
86 86
 	}
@@ -92,13 +92,13 @@  discard block
 block discarded – undo
92 92
 	 * @param \PinkCrab\Registerables\Meta_Box $meta_box
93 93
 	 * @return void
94 94
 	 */
95
-	protected function has_valid_view( Meta_Box $meta_box ): void {
96
-		if ( ! \is_callable( $meta_box->view )
97
-		&& ( ! is_string( $meta_box->view_template )
98
-			|| ( is_string( $meta_box->view_template ) && \mb_strlen( $meta_box->view_template ) === 0 )
95
+	protected function has_valid_view(Meta_Box $meta_box): void {
96
+		if ( ! \is_callable($meta_box->view)
97
+		&& ( ! is_string($meta_box->view_template)
98
+			|| (is_string($meta_box->view_template) && \mb_strlen($meta_box->view_template) === 0)
99 99
 		)
100 100
 		) {
101
-			$this->add_error( sprintf( '%s doesn\'t have a valid view defined.', get_class( $meta_box ) ) );
101
+			$this->add_error(sprintf('%s doesn\'t have a valid view defined.', get_class($meta_box)));
102 102
 		}
103 103
 	}
104 104
 }
Please login to merge, or discard this patch.