Skip to content

Commit 37a015a

Browse files
committed
Stop the array equals alignment
1 parent e2cf9b2 commit 37a015a

File tree

4 files changed

+98
-94
lines changed

4 files changed

+98
-94
lines changed

html-api-debugger/html-api-debugger.php

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -50,8 +50,8 @@ function () {
5050
SLUG . '/v1',
5151
'/htmlapi',
5252
array(
53-
'methods' => 'POST',
54-
'callback' => function ( WP_REST_Request $request ) {
53+
'methods' => 'POST',
54+
'callback' => function ( WP_REST_Request $request ) {
5555
// phpcs:ignore Universal.Operators.DisallowShortTernary.Found
5656
$html = $request->get_json_params()['html'] ?: '';
5757
$options = array(
@@ -86,7 +86,7 @@ function ( $hook_suffix ) {
8686
plugins_url( 'print-html-tree.js', __FILE__ ),
8787
array(
8888
array(
89-
'id' => '@html-api-debugger/replace-invisible-chars',
89+
'id' => '@html-api-debugger/replace-invisible-chars',
9090
'import' => 'dynamic',
9191
),
9292
),
@@ -100,7 +100,7 @@ function ( $hook_suffix ) {
100100
'@wordpress/interactivity',
101101
'@html-api-debugger/print-html-tree',
102102
array(
103-
'id' => '@html-api-debugger/replace-invisible-chars',
103+
'id' => '@html-api-debugger/replace-invisible-chars',
104104
'import' => 'dynamic',
105105
),
106106
),
@@ -148,9 +148,9 @@ function () {
148148
function prepare_html_result_object( string $html, array $options = null ): array {
149149
$response = array(
150150
'supports' => HTML_API_Integration\get_supports(),
151-
'html' => $html,
152-
'error' => null,
153-
'result' => null,
151+
'html' => $html,
152+
'error' => null,
153+
'result' => null,
154154
);
155155

156156
try {

html-api-debugger/html-api-integration.php

Lines changed: 69 additions & 69 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,10 @@ function get_supports(): array {
1616
$html_processor_state_rc = new ReflectionClass( WP_HTML_Processor_State::class );
1717

1818
return array(
19-
'is_virtual' => $html_processor_rc->hasMethod( 'is_virtual' ),
19+
'is_virtual' => $html_processor_rc->hasMethod( 'is_virtual' ),
2020
'full_parser' => method_exists( WP_HTML_Processor::class, 'create_full_parser' ),
2121
'quirks_mode' => $html_processor_state_rc->hasProperty( 'document_mode' ),
22-
'doctype' => method_exists( WP_HTML_Processor::class, 'get_doctype_info' ),
22+
'doctype' => method_exists( WP_HTML_Processor::class, 'get_doctype_info' ),
2323
);
2424
}
2525

@@ -98,32 +98,32 @@ function get_tree( string $html, array $options ): array {
9898
}
9999

100100
$tree = array(
101-
'nodeType' => NODE_TYPE_DOCUMENT,
102-
'nodeName' => '#document',
101+
'nodeType' => NODE_TYPE_DOCUMENT,
102+
'nodeName' => '#document',
103103
'childNodes' => array(),
104104
);
105105

106106
$cursor = array( 0 );
107107
if ( ! $use_full_parser ) {
108108
$tree['childNodes'][] = array(
109-
'nodeType' => NODE_TYPE_DOCUMENT_TYPE,
110-
'nodeName' => $doctype_value,
109+
'nodeType' => NODE_TYPE_DOCUMENT_TYPE,
110+
'nodeName' => $doctype_value,
111111
'nodeValue' => '',
112112
);
113113
$tree['childNodes'][] = array(
114-
'nodeType' => NODE_TYPE_ELEMENT,
115-
'nodeName' => 'HTML',
114+
'nodeType' => NODE_TYPE_ELEMENT,
115+
'nodeName' => 'HTML',
116116
'attributes' => array(),
117117
'childNodes' => array(
118118
array(
119-
'nodeType' => NODE_TYPE_ELEMENT,
120-
'nodeName' => 'HEAD',
119+
'nodeType' => NODE_TYPE_ELEMENT,
120+
'nodeName' => 'HEAD',
121121
'attributes' => array(),
122122
'childNodes' => array(),
123123
),
124124
array(
125-
'nodeType' => NODE_TYPE_ELEMENT,
126-
'nodeName' => 'BODY',
125+
'nodeType' => NODE_TYPE_ELEMENT,
126+
'nodeName' => 'BODY',
127127
'attributes' => array(),
128128
'childNodes' => array(),
129129
),
@@ -168,10 +168,10 @@ function get_tree( string $html, array $options ): array {
168168
$current['childNodes'][] = array(
169169
'nodeType' => NODE_TYPE_DOCUMENT_TYPE,
170170
'nodeName' => $doctype_name,
171-
'_span' => $processor_bookmarks->getValue( $processor )[ $processor_state->getValue( $processor )->current_token->bookmark_name ],
172-
'_mode' => $processor_state->getValue( $processor )->insertion_mode,
173-
'_bc' => $processor->get_breadcrumbs(),
174-
'_depth' => $get_current_depth(),
171+
'_span' => $processor_bookmarks->getValue( $processor )[ $processor_state->getValue( $processor )->current_token->bookmark_name ],
172+
'_mode' => $processor_state->getValue( $processor )->insertion_mode,
173+
'_bc' => $processor->get_breadcrumbs(),
174+
'_depth' => $get_current_depth(),
175175
);
176176
}
177177
break;
@@ -193,40 +193,40 @@ function get_tree( string $html, array $options ): array {
193193
$val = '';
194194
}
195195
$attributes[] = array(
196-
'nodeType' => NODE_TYPE_ATTRIBUTE,
196+
'nodeType' => NODE_TYPE_ATTRIBUTE,
197197
'specified' => true,
198-
'nodeName' => $get_attribute_name( $attribute_name ),
198+
'nodeName' => $get_attribute_name( $attribute_name ),
199199
'nodeValue' => $val,
200200
);
201201
}
202202
}
203203

204204
$self = array(
205-
'nodeType' => NODE_TYPE_ELEMENT,
206-
'nodeName' => $tag_name,
205+
'nodeType' => NODE_TYPE_ELEMENT,
206+
'nodeName' => $tag_name,
207207
'attributes' => $attributes,
208208
'childNodes' => array(),
209-
'_closer' => (bool) $processor->is_tag_closer(),
210-
'_span' => $processor_bookmarks->getValue( $processor )[ $processor_state->getValue( $processor )->current_token->bookmark_name ],
211-
'_mode' => $processor_state->getValue( $processor )->insertion_mode,
212-
'_bc' => $processor->get_breadcrumbs(),
213-
'_virtual' => $is_virtual(),
214-
'_depth' => $get_current_depth(),
209+
'_closer' => (bool) $processor->is_tag_closer(),
210+
'_span' => $processor_bookmarks->getValue( $processor )[ $processor_state->getValue( $processor )->current_token->bookmark_name ],
211+
'_mode' => $processor_state->getValue( $processor )->insertion_mode,
212+
'_bc' => $processor->get_breadcrumbs(),
213+
'_virtual' => $is_virtual(),
214+
'_depth' => $get_current_depth(),
215215
'_namespace' => method_exists( WP_HTML_Processor::class, 'get_namespace' ) ? $processor->get_namespace() : 'html',
216216
);
217217

218218
// Self-contained tags contain their inner contents as modifiable text.
219219
$modifiable_text = $processor->get_modifiable_text();
220220
if ( '' !== $modifiable_text ) {
221221
$self['childNodes'][] = array(
222-
'nodeType' => NODE_TYPE_TEXT,
223-
'nodeName' => '#text',
222+
'nodeType' => NODE_TYPE_TEXT,
223+
'nodeName' => '#text',
224224
'nodeValue' => $modifiable_text,
225-
'_span' => null,
226-
'_mode' => $processor_state->getValue( $processor )->insertion_mode,
227-
'_bc' => array_merge( $processor->get_breadcrumbs(), array( '#text' ) ),
228-
'_virtual' => $is_virtual(),
229-
'_depth' => $get_current_depth() + 1,
225+
'_span' => null,
226+
'_mode' => $processor_state->getValue( $processor )->insertion_mode,
227+
'_bc' => array_merge( $processor->get_breadcrumbs(), array( '#text' ) ),
228+
'_virtual' => $is_virtual(),
229+
'_depth' => $get_current_depth() + 1,
230230
);
231231
}
232232

@@ -244,70 +244,70 @@ function get_tree( string $html, array $options ): array {
244244

245245
case '#text':
246246
$self = array(
247-
'nodeType' => NODE_TYPE_TEXT,
248-
'nodeName' => $processor->get_token_name(),
247+
'nodeType' => NODE_TYPE_TEXT,
248+
'nodeName' => $processor->get_token_name(),
249249
'nodeValue' => $processor->get_modifiable_text(),
250-
'_span' => $processor_bookmarks->getValue( $processor )[ $processor_state->getValue( $processor )->current_token->bookmark_name ],
251-
'_mode' => $processor_state->getValue( $processor )->insertion_mode,
252-
'_bc' => $processor->get_breadcrumbs(),
253-
'_virtual' => $is_virtual(),
254-
'_depth' => $get_current_depth(),
250+
'_span' => $processor_bookmarks->getValue( $processor )[ $processor_state->getValue( $processor )->current_token->bookmark_name ],
251+
'_mode' => $processor_state->getValue( $processor )->insertion_mode,
252+
'_bc' => $processor->get_breadcrumbs(),
253+
'_virtual' => $is_virtual(),
254+
'_depth' => $get_current_depth(),
255255
);
256256

257257
$current['childNodes'][] = $self;
258258
break;
259259

260260
case '#cdata-section':
261261
$self = array(
262-
'nodeType' => NODE_TYPE_CDATA_SECTION,
263-
'nodeName' => $processor->get_token_name(),
262+
'nodeType' => NODE_TYPE_CDATA_SECTION,
263+
'nodeName' => $processor->get_token_name(),
264264
'nodeValue' => $processor->get_modifiable_text(),
265-
'_span' => $processor_bookmarks->getValue( $processor )[ $processor_state->getValue( $processor )->current_token->bookmark_name ],
266-
'_mode' => $processor_state->getValue( $processor )->insertion_mode,
267-
'_bc' => $processor->get_breadcrumbs(),
268-
'_virtual' => $is_virtual(),
269-
'_depth' => $get_current_depth(),
265+
'_span' => $processor_bookmarks->getValue( $processor )[ $processor_state->getValue( $processor )->current_token->bookmark_name ],
266+
'_mode' => $processor_state->getValue( $processor )->insertion_mode,
267+
'_bc' => $processor->get_breadcrumbs(),
268+
'_virtual' => $is_virtual(),
269+
'_depth' => $get_current_depth(),
270270
);
271271

272272
$current['childNodes'][] = $self;
273273
break;
274274

275275
case '#presumptuous-tag':
276276
$self = array(
277-
'nodeType' => NODE_TYPE_COMMENT,
278-
'nodeName' => $processor->get_token_name(),
277+
'nodeType' => NODE_TYPE_COMMENT,
278+
'nodeName' => $processor->get_token_name(),
279279
'nodeValue' => $processor->get_modifiable_text(),
280-
'_span' => $processor_bookmarks->getValue( $processor )[ $processor_state->getValue( $processor )->current_token->bookmark_name ],
281-
'_mode' => $processor_state->getValue( $processor )->insertion_mode,
282-
'_bc' => $processor->get_breadcrumbs(),
283-
'_virtual' => $is_virtual(),
284-
'_depth' => $get_current_depth(),
280+
'_span' => $processor_bookmarks->getValue( $processor )[ $processor_state->getValue( $processor )->current_token->bookmark_name ],
281+
'_mode' => $processor_state->getValue( $processor )->insertion_mode,
282+
'_bc' => $processor->get_breadcrumbs(),
283+
'_virtual' => $is_virtual(),
284+
'_depth' => $get_current_depth(),
285285
);
286286
$current['childNodes'][] = $self;
287287
break;
288288

289289
case '#funky-comment':
290290
$self = array(
291-
'nodeType' => NODE_TYPE_COMMENT,
292-
'nodeName' => $processor->get_token_name(),
291+
'nodeType' => NODE_TYPE_COMMENT,
292+
'nodeName' => $processor->get_token_name(),
293293
'nodeValue' => $processor->get_modifiable_text(),
294-
'_span' => $processor_bookmarks->getValue( $processor )[ $processor_state->getValue( $processor )->current_token->bookmark_name ],
295-
'_mode' => $processor_state->getValue( $processor )->insertion_mode,
296-
'_bc' => $processor->get_breadcrumbs(),
297-
'_virtual' => $is_virtual(),
298-
'_depth' => $get_current_depth(),
294+
'_span' => $processor_bookmarks->getValue( $processor )[ $processor_state->getValue( $processor )->current_token->bookmark_name ],
295+
'_mode' => $processor_state->getValue( $processor )->insertion_mode,
296+
'_bc' => $processor->get_breadcrumbs(),
297+
'_virtual' => $is_virtual(),
298+
'_depth' => $get_current_depth(),
299299
);
300300
$current['childNodes'][] = $self;
301301
break;
302302

303303
case '#comment':
304304
$self = array(
305305
'nodeType' => NODE_TYPE_COMMENT,
306-
'_span' => $processor_bookmarks->getValue( $processor )[ $processor_state->getValue( $processor )->current_token->bookmark_name ],
307-
'_mode' => $processor_state->getValue( $processor )->insertion_mode,
308-
'_bc' => $processor->get_breadcrumbs(),
306+
'_span' => $processor_bookmarks->getValue( $processor )[ $processor_state->getValue( $processor )->current_token->bookmark_name ],
307+
'_mode' => $processor_state->getValue( $processor )->insertion_mode,
308+
'_bc' => $processor->get_breadcrumbs(),
309309
'_virtual' => $is_virtual(),
310-
'_depth' => $get_current_depth(),
310+
'_depth' => $get_current_depth(),
311311
);
312312
switch ( $processor->get_comment_type() ) {
313313
case WP_HTML_Processor::COMMENT_AS_ABRUPTLY_CLOSED_COMMENT:
@@ -321,7 +321,7 @@ function get_tree( string $html, array $options ): array {
321321
$self['childNodes'] = array(
322322
array(
323323
'nodeType' => NODE_TYPE_PROCESSING_INSTRUCTION,
324-
'nodeName' => $processor->get_tag(),
324+
'nodeName' => $processor->get_tag(),
325325
'nodeValue' => $processor->get_modifiable_text(),
326326
),
327327
);
@@ -367,9 +367,9 @@ function get_tree( string $html, array $options ): array {
367367
}
368368

369369
return array(
370-
'tree' => $tree,
371-
'compatMode' => $compat_mode,
372-
'doctypeName' => $doctype_name,
370+
'tree' => $tree,
371+
'compatMode' => $compat_mode,
372+
'doctypeName' => $doctype_name,
373373
'doctypePublicId' => $doctype_public_identifier,
374374
'doctypeSystemId' => $doctype_system_identifier,
375375
);

html-api-debugger/interactivity.php

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -37,37 +37,37 @@ function generate_page( string $html, array $options ): string {
3737
\HTML_API_Debugger\SLUG,
3838
array(
3939
'restEndpoint' => rest_url( 'html-api-debugger/v1/htmlapi' ),
40-
'nonce' => wp_create_nonce( 'wp_rest' ),
40+
'nonce' => wp_create_nonce( 'wp_rest' ),
4141
)
4242
);
4343
wp_interactivity_state(
4444
\HTML_API_Debugger\SLUG,
4545
array(
46-
'DOM' => array(
47-
'renderingMode' => '',
48-
'doctypeName' => '',
46+
'DOM' => array(
47+
'renderingMode' => '',
48+
'doctypeName' => '',
4949
'doctypeSystemId' => '',
5050
'doctypePublicId' => '',
5151
),
52-
'html' => $html,
53-
'htmlapiResponse' => $htmlapi_response,
54-
'span' => false,
55-
'hoverSpan' => $htmlapi_response['html'],
52+
'html' => $html,
53+
'htmlapiResponse' => $htmlapi_response,
54+
'span' => false,
55+
'hoverSpan' => $htmlapi_response['html'],
5656

57-
'showClosers' => false,
58-
'showInvisible' => false,
59-
'showVirtual' => false,
60-
'quirksMode' => false,
61-
'fullParser' => false,
57+
'showClosers' => false,
58+
'showInvisible' => false,
59+
'showVirtual' => false,
60+
'quirksMode' => false,
61+
'fullParser' => false,
6262

63-
'hoverInfo' => 'breadcrumbs',
64-
'hoverBreadcrumbs' => true,
65-
'hoverInsertion' => false,
63+
'hoverInfo' => 'breadcrumbs',
64+
'hoverBreadcrumbs' => true,
65+
'hoverInsertion' => false,
6666
'checkingForPRPlaygroundLink' => false,
6767

68-
'htmlApiDoctypeName' => $htmlapi_response['result']['doctypeName'] ?? '[unknown]',
68+
'htmlApiDoctypeName' => $htmlapi_response['result']['doctypeName'] ?? '[unknown]',
6969
'htmlApiDoctypePublicId' => $htmlapi_response['result']['doctypePublicId'] ?? '[unknown]',
70-
'htmlApiDoctypeSytemId' => $htmlapi_response['result']['doctypeSystemId'] ?? '[unknown]',
70+
'htmlApiDoctypeSytemId' => $htmlapi_response['result']['doctypeSystemId'] ?? '[unknown]',
7171
)
7272
);
7373
ob_start();

phpcs.xml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -138,6 +138,10 @@
138138
<severity>0</severity>
139139
</rule>
140140

141+
<rule ref="WordPress.Arrays.MultipleStatementAlignment.DoubleArrowNotAligned">
142+
<severity>0</severity>
143+
</rule>
144+
141145
<!--
142146
#############################################################################
143147
SELECTIVE EXCLUSIONS

0 commit comments

Comments
 (0)