Skip to content

Commit 2803f16

Browse files
committed
More PHPCS Updates
1 parent b454dd6 commit 2803f16

File tree

9 files changed

+99
-97
lines changed

9 files changed

+99
-97
lines changed

includes/helpers.php

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,9 @@ function vgtbt(): Core {
2424
*
2525
* @since 1.0.0
2626
*
27-
* @param array $block
28-
* @param string $custom_class
29-
* @param array $attrs
27+
* @param array $block The block array.
28+
* @param string $custom_class A custom class.
29+
* @param array $attrs Array of attributes.
3030
*/
3131
function block_attrs( array $block, string $custom_class = '', array $attrs = [] ): void {
3232
$id = ! empty( $attrs['id'] ) ? $attrs['id'] : get_block_id( $block );
@@ -101,8 +101,8 @@ function block_attrs( array $block, string $custom_class = '', array $attrs = []
101101
*
102102
* @since 1.0.0
103103
*
104-
* @param array $block
105-
* @param bool $ignore_anchor
104+
* @param array $block The block array.
105+
* @param bool $ignore_anchor IF anchor should be ignored.
106106
*
107107
* @return string
108108
*/
@@ -129,8 +129,8 @@ function get_block_id( array $block, bool $ignore_anchor = false ): string {
129129
*
130130
* @since 1.0.0
131131
*
132-
* @param array $block
133-
* @param string $custom_class
132+
* @param array $block The block array.
133+
* @param string $custom_class Any custom classes.
134134
*
135135
* @return string
136136
*/
@@ -173,8 +173,8 @@ function get_block_class( array $block, string $custom_class = '' ): string {
173173
*
174174
* @since 1.0.0
175175
*
176-
* @param string $block_name
177-
* @param array $props
176+
* @param string $block_name The block name.
177+
* @param array $props Block properties.
178178
*/
179179
function vgtbt_render_block( string $block_name, array $props = [] ): void {
180180
if ( ! str_starts_with( $block_name, 'acf/' ) ) {
@@ -207,7 +207,7 @@ function vgtbt_render_block( string $block_name, array $props = [] ): void {
207207
* @since 1.0.0
208208
*
209209
* @param string $name The name of block to retrieve.
210-
* @param array $blocks Array of blocks to search through.
210+
* @param array $blocks Array of blocks to search through.
211211
*
212212
* @return array|false
213213
*/
@@ -234,7 +234,7 @@ function get_block_from_blocks( string $name, array $blocks ): array|false {
234234
/**
235235
* Get fields for a block
236236
*
237-
* @param string $block_name
237+
* @param string $block_name The block name.
238238
*
239239
* @return array
240240
*/
@@ -276,13 +276,13 @@ function get_block_fields( string $block_name ): array {
276276
/**
277277
* Get a property from a field.
278278
*
279-
* @param string $selector
280-
* @param string $property
281-
* @param string|null $group_id
279+
* @param string $selector The field selector.
280+
* @param string $property The field property.
281+
* @param ?string $group_id The Group ID.
282282
*
283283
* @return string
284284
*/
285-
function get_field_property( string $selector, string $property, string $group_id = null ): string {
285+
function get_field_property( string $selector, string $property, ?string $group_id = null ): string {
286286
if ( null !== $group_id ) {
287287
$fields = acf_get_fields( $group_id );
288288
foreach ( $fields as $field_array ) {
@@ -344,8 +344,8 @@ function inner_blocks( array $props = [] ): void {
344344
*
345345
* @since 1.0.0
346346
*
347-
* @param string $notice
348-
* @param string $class
347+
* @param string $notice The message.
348+
* @param string $class The class name.
349349
*
350350
* @return void
351351
*/
@@ -400,7 +400,7 @@ function is_acf_saving_field(): bool {
400400
/**
401401
* Get core block classes
402402
*
403-
* @param array $block
403+
* @param array $block The block array.
404404
*
405405
* @return array
406406
*/
@@ -431,7 +431,7 @@ function get_core_classes( array $block ): array {
431431
/**
432432
* Get core block styles
433433
*
434-
* @param array $block
434+
* @param array $block The block array.
435435
*
436436
* @return string
437437
*/

includes/parts-kit.php

Lines changed: 21 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ function ( string $output, string $block_name ): string {
3434
/**
3535
* Parse InnerBlocks Template
3636
*
37-
* @param string $output
37+
* @param string $output The output.
3838
*
3939
* @return string
4040
*/
@@ -58,22 +58,24 @@ function vgtbt_parse_inner_blocks( string $output ): string {
5858
'innerBlocks' => $block_array[2] ?? [],
5959
];
6060

61-
$block = vgtbt_add_sample_data( $block );
61+
$block = vgtbt_add_sample_data( $block );
62+
63+
// phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedHooknameFound
6264
$content .= apply_filters( 'the_content', trim( render_block( $block ) ) );
6365
$content = vgtbt_parse_inner_blocks( $content );
6466
$content = vgtbt_fill_empty_tags( $content );
6567
}
6668

6769
$content = str_replace( '$', '\$', $content );
6870

69-
// Replace the InnerBlocks tag with the parsed content
71+
// Replace the InnerBlocks tag with the parsed content.
7072
return preg_replace( '/<InnerBlocks[^>]*\/>/i', $content, $output );
7173
}
7274

7375
/**
7476
* Get Sample Block properties
7577
*
76-
* @param array $block
78+
* @param array $block The block array.
7779
*
7880
* @return array
7981
*/
@@ -95,7 +97,7 @@ function vgtbt_get_sample_props( array $block ): array {
9597
/**
9698
* Return Sample Parts Kit Data
9799
*
98-
* @param array $field
100+
* @param array $field The field array.
99101
*
100102
* @return string|array
101103
*/
@@ -130,15 +132,15 @@ function vgtbt_get_sample_data( array $field ): string|array {
130132
'width' => 600,
131133
'height' => 400,
132134
'sizes' => [
133-
'thumbnail' => 'https://placehold.co/150x150/EEE/31343C',
134-
'thumbnail-width' => 150,
135-
'thumbnail-height' => 150,
136-
'medium' => 'https://placehold.co/226x300/EEE/31343C',
137-
'medium-width' => 226,
138-
'medium-height' => 300,
139-
'large' => 'https://placehold.co/771x1024/EEE/31343C',
140-
'large-width' => 771,
141-
'large-height' => 1024,
135+
'thumbnail' => 'https://placehold.co/150x150/EEE/31343C',
136+
'thumbnail-width' => 150,
137+
'thumbnail-height' => 150,
138+
'medium' => 'https://placehold.co/226x300/EEE/31343C',
139+
'medium-width' => 226,
140+
'medium-height' => 300,
141+
'large' => 'https://placehold.co/771x1024/EEE/31343C',
142+
'large-width' => 771,
143+
'large-height' => 1024,
142144
],
143145
];
144146
}
@@ -153,16 +155,16 @@ function vgtbt_get_sample_data( array $field ): string|array {
153155
/**
154156
* Add Sample Data to Block
155157
*
156-
* @param array $block
158+
* @param array $block The block array.
157159
*
158160
* @return array
159161
*/
160162
function vgtbt_add_sample_data( array $block ): array {
161163
$supported = [
162164
'core/image' => [
163-
'url' => vgtbt_get_sample_data( [ 'type' => 'image' ] )[ 'url' ],
164-
'width' => vgtbt_get_sample_data( [ 'type' => 'image' ] )[ 'width' ],
165-
'height' => vgtbt_get_sample_data( [ 'type' => 'image' ] )[ 'height' ],
165+
'url' => vgtbt_get_sample_data( [ 'type' => 'image' ] )['url'],
166+
'width' => vgtbt_get_sample_data( [ 'type' => 'image' ] )['width'],
167+
'height' => vgtbt_get_sample_data( [ 'type' => 'image' ] )['height'],
166168
],
167169
'core/heading' => [
168170
'content' => vgtbt_get_sample_data( [ 'type' => 'text' ] ),
@@ -195,7 +197,7 @@ function vgtbt_add_sample_data( array $block ): array {
195197
/**
196198
* Add sample content to empty paragraph, heading, summary, etc.
197199
*
198-
* @param string $content
200+
* @param string $content The content.
199201
*
200202
* @return string
201203
*/

includes/timber.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,5 @@ function ( array $functions ): array {
2525
return $functions;
2626
}
2727
);
28-
2928
}
3029
);

src/classes/BlockIcons.php

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@ class BlockIcons {
2020
const ICONS_CHECKSUM = 'vgtbt_icons_checksum';
2121

2222
/**
23+
* If the icon filter is disabled.
24+
*
2325
* @var bool
2426
*/
2527
private bool $disable_icon_filter = false;
@@ -78,7 +80,7 @@ private function add_render_hooks(): void {
7880
/**
7981
* Get all available icons.
8082
*
81-
* @param bool $from_file
83+
* @param bool $from_file File path to get icons.
8284
*
8385
* @return array
8486
*/
@@ -190,7 +192,7 @@ public function get_icons( bool $from_file = true ): array {
190192
/**
191193
* Get an icon
192194
*
193-
* @param string $slug
195+
* @param string $slug The icon slug.
194196
*
195197
* @return array
196198
*/
@@ -209,8 +211,8 @@ public function get_icon( string $slug ): array {
209211
/**
210212
* Render icons on frontend.
211213
*
212-
* @param string $block_content
213-
* @param array $block
214+
* @param string $block_content The block content.
215+
* @param array $block The block array.
214216
*
215217
* @return string
216218
*/
@@ -242,10 +244,8 @@ public function render_frontend_icons( string $block_content, array $block ): st
242244
if ( $p->next_tag( $query ) ) {
243245
$p->add_class( $icon_class );
244246
}
245-
} else {
246-
if ( $p->next_tag() ) {
247-
$p->add_class( $icon_class );
248-
}
247+
} elseif ( $p->next_tag() ) {
248+
$p->add_class( $icon_class );
249249
}
250250

251251
$block_content = $p->get_updated_html();
@@ -329,8 +329,8 @@ function (): void {
329329
* @return string
330330
*/
331331
private function editor_css(): string {
332-
$icons = $this->get_icons();
333-
$css = '';
332+
$icons = $this->get_icons();
333+
$css = '';
334334
$selectors = apply_filters(
335335
'vgtbt_button_icons_editor_css_selectors',
336336
[
@@ -375,7 +375,7 @@ private function editor_css(): string {
375375
$css .= '}' . PHP_EOL;
376376
}
377377

378-
// Manually adjust a few of the icons
378+
// Manually adjust a few of the icons.
379379
$css .= '.button-icon-picker__button.button-icon-picker__icon-chevron-left-small span svg,.button-icon-picker__button.button-icon-picker__icon-chevron-right-small span svg,
380380
.button-icon-picker__button.button-icon-picker__icon-external-arrow span svg {max-height: 60%}';
381381
$css .= '.button-icon-picker__button.button-icon-picker__icon-previous span svg,.button-icon-picker__button.button-icon-picker__icon-next span svg {max-height: 80%}';
@@ -396,7 +396,7 @@ function () {
396396
$checksum = md5( json_encode( $icons ) );
397397
$path = $this->get_icons_file_path( true );
398398

399-
if ( file_exists( $path ) && $checksum === get_transient( self::ICONS_CHECKSUM ) ) {
399+
if ( file_exists( $path ) && get_transient( self::ICONS_CHECKSUM ) === $checksum ) {
400400
return;
401401
}
402402

@@ -431,7 +431,7 @@ function () {
431431
/**
432432
* Get path to the icons JSON file.
433433
*
434-
* @param bool $write_file
434+
* @param bool $write_file The file path.
435435
*
436436
* @return string
437437
*/

0 commit comments

Comments
 (0)