Skip to content

Commit d501808

Browse files
committed
style(phpcs): pin tab width to 4 for stable array alignment
Add tab_width config alongside tab-width arg so GitHub Actions matches local column math for MultipleStatementAlignment. Restore Share network array icon/params spacing for phpcbf output under tab-width 4.
1 parent fe9aa05 commit d501808

2 files changed

Lines changed: 19 additions & 25 deletions

File tree

‎inc/Helpers/Formatting/Share.php‎

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -54,8 +54,8 @@ function get_share_link( string $name, string $link_to_share, array $share_attri
5454
'href' => 'http://www.facebook.com/sharer.php',
5555
'class' => 'share__link',
5656
],
57-
'icon' => 'social/facebook',
58-
'params' => [
57+
'icon' => 'social/facebook',
58+
'params' => [
5959
'u' => $link_to_share,
6060
],
6161
],
@@ -65,8 +65,8 @@ function get_share_link( string $name, string $link_to_share, array $share_attri
6565
'href' => 'https://twitter.com/intent/tweet',
6666
'class' => 'share__link',
6767
],
68-
'icon' => 'social/x',
69-
'params' => [
68+
'icon' => 'social/x',
69+
'params' => [
7070
'url' => $link_to_share,
7171
],
7272
],
@@ -76,8 +76,8 @@ function get_share_link( string $name, string $link_to_share, array $share_attri
7676
'href' => 'https://www.linkedin.com/shareArticle',
7777
'class' => 'share__link',
7878
],
79-
'icon' => 'social/linkedin',
80-
'params' => [
79+
'icon' => 'social/linkedin',
80+
'params' => [
8181
'url' => $link_to_share,
8282
],
8383
],
@@ -87,8 +87,8 @@ function get_share_link( string $name, string $link_to_share, array $share_attri
8787
'href' => 'https://www.instagram.com/',
8888
'class' => 'share__link',
8989
],
90-
'icon' => 'social/instagram',
91-
'params' => [
90+
'icon' => 'social/instagram',
91+
'params' => [
9292
'url' => $link_to_share,
9393
],
9494
],
@@ -98,8 +98,8 @@ function get_share_link( string $name, string $link_to_share, array $share_attri
9898
'href' => 'https://bsky.app/intent/compose',
9999
'class' => 'share__link',
100100
],
101-
'icon' => 'social/bluesky',
102-
'params' => [
101+
'icon' => 'social/bluesky',
102+
'params' => [
103103
'text' => $link_to_share,
104104
],
105105
],
@@ -109,8 +109,8 @@ function get_share_link( string $name, string $link_to_share, array $share_attri
109109
'href' => 'mailto:',
110110
'class' => 'share__link',
111111
],
112-
'icon' => 'social/email',
113-
'params' => [
112+
'icon' => 'social/email',
113+
'params' => [
114114
'body' => $link_to_share,
115115
],
116116
],
@@ -148,9 +148,9 @@ function get_share_link( string $name, string $link_to_share, array $share_attri
148148
$icon_html,
149149
$network['attributes']['title']
150150
),
151-
'mode' => 'button',
152-
'before' => '<li>',
153-
'after' => '</li>',
151+
'mode' => 'button',
152+
'before' => '<li>',
153+
'after' => '</li>',
154154
]
155155
);
156156

‎phpcs.xml.dist‎

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77

88
<!-- Scan only PHP files -->
99
<arg name="extensions" value="php"/>
10+
<arg name="tab-width" value="4"/>
1011

1112
<!-- Scan all files in directory -->
1213
<file>.</file>
@@ -36,16 +37,6 @@
3637

3738
<rule ref="Generic.Arrays.DisallowLongArraySyntax"/>
3839

39-
<!--
40-
Do not align short keys to the full width of a long key when that key's value
41-
is multi-line; keeps icon/params blocks consistent across environments.
42-
-->
43-
<rule ref="WordPress.Arrays.MultipleStatementAlignment">
44-
<properties>
45-
<property name="alignMultilineItems" value="never"/>
46-
</properties>
47-
</rule>
48-
4940
<!-- Show sniff name in report. -->
5041
<arg value="sp"/>
5142

@@ -78,4 +69,7 @@
7869

7970
<rule ref="PHPCompatibilityWP"/>
8071
<config name="testVersion" value="8.3-"/>
72+
73+
<!-- Match WordPress / local editor: same value as arg tab-width (see PHPCS Config). -->
74+
<config name="tab_width" value="4"/>
8175
</ruleset>

0 commit comments

Comments
 (0)