Skip to content

Commit c093fb5

Browse files
authored
Enhancement: Enable trailing_comma_in_multiline fixer (php#647)
* Enhancement: Enable and configure trailing_comma_in_multiline fixer * Fix: Run 'make coding-standards'
1 parent 4ac417b commit c093fb5

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

44 files changed

+278
-272
lines changed

Diff for: .php-cs-fixer.php

+6
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,12 @@
5151
],
5252
'strict_param' => true,
5353
'switch_case_space' => true,
54+
'trailing_comma_in_multiline' => [
55+
'elements' => [
56+
'arguments',
57+
'arrays',
58+
],
59+
],
5460
'trim_array_spaces' => true,
5561
'unary_operator_spaces' => true,
5662
'visibility_required' => true,

Diff for: credits.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
$credits = str_replace(
1717
["</center>", "& "],
1818
["</div>", "&amp; "],
19-
$credits
19+
$credits,
2020
);
2121

2222
// If there is something left, print it out

Diff for: download-docs.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@
123123
$link_to,
124124
(int) ($size / 1024),
125125
date("j M Y", $changed),
126-
$extension
126+
$extension,
127127
];
128128
$found_formats[$formatname] = 1;
129129
}

Diff for: downloads.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -32,11 +32,11 @@
3232
"rel" => "alternate",
3333
"type" => "application/atom+xml",
3434
"href" => $MYSITE . "releases/feed.php",
35-
"title" => "PHP Release feed"
35+
"title" => "PHP Release feed",
3636
],
3737
],
3838
"current" => "downloads",
39-
]
39+
],
4040
);
4141
?>
4242
<?php $i = 0; foreach ($RELEASES as $MAJOR => $major_releases): /* major releases loop start */

Diff for: elephpant.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -36,5 +36,5 @@
3636
<?php
3737
// Print the common footer.
3838
site_footer([
39-
'elephpants' => true
39+
'elephpants' => true,
4040
]);

Diff for: error.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -711,7 +711,7 @@
711711
$fallback = (myphpnet_urlsearch() === MYPHPNET_URL_MANUAL ? "404manual" : "404quickref");
712712
mirror_redirect(
713713
'/search.php?show=' . $fallback . '&lang=' . urlencode($LANG) .
714-
'&pattern=' . substr($_SERVER['REQUEST_URI'], 1)
714+
'&pattern=' . substr($_SERVER['REQUEST_URI'], 1),
715715
);
716716
/*
717717
* vim: set et ts=4 sw=4 ft=php: :

Diff for: git-php.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@
8686
"note" => $_POST['realpurpose'],
8787
"yesno" => $_POST['yesno'],
8888
"group" => $_POST['group'],
89-
]
89+
],
9090
);
9191
// Error while posting
9292
if ($error) {

Diff for: images/elephpants.php

+3-3
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@
3939
} else {
4040
header('HTTP/1.1 400', true, 400);
4141
echo json_encode([
42-
'error' => "Specify how many elephpants to serve via 'count'."
42+
'error' => "Specify how many elephpants to serve via 'count'.",
4343
]);
4444
exit;
4545
}
@@ -53,7 +53,7 @@
5353
if (!$photos || !is_array($photos)) {
5454
header('HTTP/1.1 500', true, 500);
5555
echo json_encode([
56-
'error' => "No elephpant metadata available."
56+
'error' => "No elephpant metadata available.",
5757
]);
5858
exit;
5959
}
@@ -79,7 +79,7 @@
7979
$elephpants[] = [
8080
'title' => $photo['title'],
8181
'url' => "http://flickr.com/photos/" . $photo['owner'] . "/" . $photo['id'],
82-
'data' => base64_encode(file_get_contents($path . '/' . $photo['filename']))
82+
'data' => base64_encode(file_get_contents($path . '/' . $photo['filename'])),
8383
];
8484
}
8585

Diff for: include/branches.inc

+4-4
Original file line numberDiff line numberDiff line change
@@ -68,8 +68,8 @@ function format_interval($from, DateTime $to) {
6868
return "$t[0] $t[1]" .
6969
($t[0] != 1 ? 's' : '');
7070
},
71-
$times
72-
)
71+
$times,
72+
),
7373
);
7474

7575
if ($diff->invert) {
@@ -378,7 +378,7 @@ function version_array(string $version, ?int $length = null)
378378
{
379379
$versionArray = array_map(
380380
'intval',
381-
explode('.', $version)
381+
explode('.', $version),
382382
);
383383

384384
if (is_int($length)) {
@@ -387,7 +387,7 @@ function version_array(string $version, ?int $length = null)
387387
: array_slice(
388388
$versionArray,
389389
0,
390-
$length
390+
$length,
391391
);
392392
}
393393

Diff for: include/get-download.inc

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ $possible_files = [$df, "manual/$df"];
1212

1313
$site_config = [
1414
'current' => 'downloads',
15-
'css' => ['mirror.css']
15+
'css' => ['mirror.css'],
1616
];
1717

1818
// Find out what is the exact file requested

Diff for: include/ip-to-country.inc

+2-2
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ function i2c_search_in_index($ip)
8989
// Open the index file for reading
9090
$dbidx = fopen(
9191
__DIR__ . "/../backend/ip-to-country.idx",
92-
"r"
92+
"r",
9393
);
9494
if (!$dbidx) { return false; }
9595

@@ -133,7 +133,7 @@ function i2c_search_in_db($ip, $idx)
133133
// Open DB for reading
134134
$ipdb = fopen(
135135
$_SERVER['DOCUMENT_ROOT'] . "/backend/ip-to-country.db",
136-
"r"
136+
"r",
137137
);
138138

139139
// Return with "NA" in case of we cannot open the db

Diff for: include/langchooser.inc

+1-1
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ function language_choose_code()
6868

6969
// Drop out langauge specification from URL, as this is already handled
7070
$_SERVER['STRIPPED_URI'] = preg_replace(
71-
"!^/$flang[1]/!", "/", htmlspecialchars($_SERVER['REQUEST_URI'], ENT_QUOTES, 'UTF-8')
71+
"!^/$flang[1]/!", "/", htmlspecialchars($_SERVER['REQUEST_URI'], ENT_QUOTES, 'UTF-8'),
7272
);
7373

7474
}

Diff for: include/layout.inc

+6-6
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ function resize_image($img, $width = 1, $height = 1)
6464
return preg_replace(
6565
'!/?>$!',
6666
sprintf(' height="%s" width="%s">', $height, $width),
67-
$str
67+
$str,
6868
);
6969
}
7070

@@ -99,7 +99,7 @@ function make_image($file, $alt = false, $align = false, $extras = false,
9999
($alt ?: ''),
100100
$sizeparams,
101101
$align,
102-
($extras ? ' ' . $extras : '')
102+
($extras ? ' ' . $extras : ''),
103103
);
104104
}
105105

@@ -132,7 +132,7 @@ function make_submit($file, $alt = false, $align = false, $extras = false,
132132
$img = str_replace(
133133
"border=\"$border\"",
134134
"style=\"border: {$border}px;\"",
135-
$img
135+
$img,
136136
);
137137

138138
// Return with ready input image
@@ -156,7 +156,7 @@ function make_popup_link($url, $linktext = false, $target = false, $windowprops
156156
($target ?: "_new"),
157157
$windowprops,
158158
($extras ? ' ' . $extras : ''),
159-
($linktext ?: $url)
159+
($linktext ?: $url),
160160
);
161161
}
162162

@@ -232,7 +232,7 @@ function clean_note($text)
232232
return preg_replace(
233233
'!((mailto:|(https?|ftp|nntp|news)://).*?)(\s|<|\)|"|\\\\|\'|$)!',
234234
'<a href="\1" rel="nofollow" target="_blank">\1</a>\4',
235-
$text
235+
$text,
236236
);
237237
}
238238

@@ -275,7 +275,7 @@ function display_event($event, $include_date = 1): void
275275
4 => 'Fourth',
276276
-1 => 'Last',
277277
-2 => '2nd Last',
278-
-3 => '3rd Last'
278+
-3 => '3rd Last',
279279
];
280280

281281
if (!isset($event['start']) && isset($event['sday'])) {

Diff for: include/results.inc

+1-1
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ function search_results($res, $q, $profile = 'all', $per_page = 10, $s = 0, $l =
2626
'php' => '<img src="' . $php_img_dir . '/logos/php-icon-white.gif" height="32" width="32" style="float:left; margin-left:-40px;"/>',
2727
'doc' => '<img src="' . $php_img_dir . '/logos/php-icon-white.gif" height="32" width="32" style="float:left; margin-left:-40px;"/>',
2828
'bugs' => '<img src="' . $php_img_dir . '/php_bug.gif" height="32" width="32" style="float:left; margin-left:-40px;"/>',
29-
'gtk' => '<img src="' . $php_img_dir . '/logos/php-gtk-white.gif" height="26" width="32" style="float:left; margin-left:-40px;"/>'
29+
'gtk' => '<img src="' . $php_img_dir . '/logos/php-gtk-white.gif" height="26" width="32" style="float:left; margin-left:-40px;"/>',
3030
];
3131

3232
foreach($res['ResultSet']['Result'] as $i => $hit) {

Diff for: include/shared-manual.inc

+5-5
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ function manual_notes($notes):void {
5050
'&amp;redirect=' . $_SERVER['BASE_HREF'];
5151
$addnotesnippet = make_link(
5252
$addnotelink,
53-
"+<small>add a note</small>"
53+
"+<small>add a note</small>",
5454
);
5555

5656
$num_notes = count($notes);
@@ -165,21 +165,21 @@ VOTEDIV;
165165
'https://main.php.net/manage/user-notes.php?action=edit+' . $note->id,
166166
'<img src="/images/[email protected]" height="12" width="12" alt="edit note">',
167167
'admin',
168-
'scrollbars=yes,width=650,height=400'
168+
'scrollbars=yes,width=650,height=400',
169169
) . "\n " .
170170

171171
make_popup_link(
172172
'https://main.php.net/manage/user-notes.php?action=reject+' . $note->id,
173173
'<img src="/images/[email protected]" height="12" width="12" alt="reject note">',
174174
'admin',
175-
'scrollbars=no,width=300,height=200'
175+
'scrollbars=no,width=300,height=200',
176176
) . "\n " .
177177

178178
make_popup_link(
179179
'https://main.php.net/manage/user-notes.php?action=delete+' . $note->id,
180180
'<img src="/images/[email protected]" height="12" width="12" alt="delete note">',
181181
'admin',
182-
'scrollbars=no,width=300,height=200'
182+
'scrollbars=no,width=300,height=200',
183183
) . "\n </span>";
184184

185185
} else {
@@ -387,7 +387,7 @@ function manual_footer(): void {
387387
manual_notes($USERNOTES);
388388
site_footer([
389389
'related_menu' => $__RELATED['toc'],
390-
'related_menu_deprecated' => $__RELATED['toc_deprecated']
390+
'related_menu_deprecated' => $__RELATED['toc_deprecated'],
391391
]);
392392
}
393393

Diff for: include/site.inc

+2-2
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,8 @@ $MIRRORS = [
2222
MIRROR_SPECIAL,
2323
true,
2424
"en",
25-
MIRROR_OK
26-
]
25+
MIRROR_OK,
26+
],
2727
];
2828

2929
/**

Diff for: index.php

+5-5
Original file line numberDiff line numberDiff line change
@@ -129,20 +129,20 @@
129129
'<script>',
130130
"function okc(f){var c=[38,38,40,40,37,39,37,39,66,65,13],x=function(){x.c=x.c||Array.apply({},c);x.r=function(){x.c=null};return x.c},h=function(e){if(x()[0]==(e||window.event).keyCode){x().shift();if(!x().length){x.r();f()}}else{x.r()}};window.addEventListener?window.addEventListener('keydown',h,false):document.attachEvent('onkeydown',h)}",
131131
"okc(function(){if(document.getElementById){i=document.getElementById('phplogo');i.src='" . $MYSITE . "images/php_konami.gif'}});",
132-
'</script>'
132+
'</script>',
133133
],
134134
'link' => [
135135
[
136136
"rel" => "search",
137137
"type" => "application/opensearchdescription+xml",
138138
"href" => $MYSITE . "phpnetimprovedsearch.src",
139-
"title" => "Add PHP.net search"
139+
"title" => "Add PHP.net search",
140140
],
141141
[
142142
"rel" => "alternate",
143143
"type" => "application/atom+xml",
144144
"href" => $MYSITE . "releases/feed.php",
145-
"title" => "PHP Release feed"
145+
"title" => "PHP Release feed",
146146
],
147147

148148
],
@@ -167,7 +167,7 @@
167167
168168
<link href="https://fosstodon.org/@php" rel="me" />
169169
META
170-
]
170+
],
171171
);
172172

173173
// Print body of home page.
@@ -228,5 +228,5 @@
228228
site_footer([
229229
"atom" => "/feed.atom", // Add a link to the feed at the bottom
230230
'elephpants' => true,
231-
'sidebar' => $SIDEBAR
231+
'sidebar' => $SIDEBAR,
232232
]);

0 commit comments

Comments
 (0)