Skip to content

Commit f127de5

Browse files
authored
Enhancement: Enable strict_param fixer
We set strict param to false to ensure current behavior, except for two cases where it is safe to go with true. Closes GH-658.
1 parent 5c9eab2 commit f127de5

File tree

13 files changed

+31
-28
lines changed

13 files changed

+31
-28
lines changed

.php-cs-fixer.php

Lines changed: 16 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -15,18 +15,21 @@
1515
->notPath('include/pregen-news.inc')
1616
->notPath('tests/run-tests.php');
1717

18-
$config->setRules([
19-
'array_indentation' => true,
20-
'constant_case' => true,
21-
'indentation_type' => true,
22-
'line_ending' => true,
23-
'no_extra_blank_lines' => true,
24-
'no_trailing_whitespace' => true,
25-
'ordered_class_elements' => true,
26-
'single_space_after_construct' => true,
27-
'trim_array_spaces' => true,
28-
'visibility_required' => true,
29-
'whitespace_after_comma_in_array' => true,
30-
]);
18+
$config
19+
->setRiskyAllowed(true)
20+
->setRules([
21+
'array_indentation' => true,
22+
'constant_case' => true,
23+
'indentation_type' => true,
24+
'line_ending' => true,
25+
'no_extra_blank_lines' => true,
26+
'no_trailing_whitespace' => true,
27+
'ordered_class_elements' => true,
28+
'single_space_after_construct' => true,
29+
'strict_param' => true,
30+
'trim_array_spaces' => true,
31+
'visibility_required' => true,
32+
'whitespace_after_comma_in_array' => true,
33+
]);
3134

3235
return $config;

cal.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -371,7 +371,7 @@ function read_event($fp)
371371
'recur_day' => $recur_day,
372372
'sdesc' => $sdesc,
373373
'url' => $url,
374-
'ldesc' => base64_decode($ldesc),
374+
'ldesc' => base64_decode($ldesc, false),
375375
'country' => $country,
376376
'category' => $category,
377377
);

error.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -175,7 +175,7 @@
175175
// Redirect if the entered URI was a PHP page name (except some pages,
176176
// which we display in the mirror's language or the explicitly specified
177177
// language [see below])
178-
if (!in_array($URI, array('mirror-info', 'error', 'mod')) &&
178+
if (!in_array($URI, array('mirror-info', 'error', 'mod'), false) &&
179179
file_exists($_SERVER['DOCUMENT_ROOT'] . "/$URI.php")) {
180180
mirror_redirect("/$URI.php");
181181
}

include/langchooser.inc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -177,7 +177,7 @@ function language_add($langcode, &$langs)
177177
// Append language code in priority order if it is not
178178
// there already and supported by the PHP site. Try to
179179
// lower number of file_exists() calls to the minumum...
180-
if (!in_array($langcode, $langs) && isset($LANGUAGES[$langcode])
180+
if (!in_array($langcode, $langs, false) && isset($LANGUAGES[$langcode])
181181
&& !isset($INACTIVE_ONLINE_LANGUAGES[$langcode])) {
182182
$langs[] = $langcode;
183183
}

include/layout.inc

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ function make_image($file, $alt = false, $align = false, $extras = false,
9696

9797
// Convert right or left alignment to CSS float,
9898
// but leave other alignments intact (for now)
99-
if (in_array($align, array("right", "left"))) {
99+
if (in_array($align, array("right", "left"), false)) {
100100
$align = ' style="float: ' . $align . ';"';
101101
} elseif ($align) {
102102
$align = ' align="' . $align . '"';
@@ -402,7 +402,7 @@ function print_news($news, $dog, $max = 5, $onlyyear = null, $return = false) {
402402
// Only print entries in the provided s/dog/cat/ egory
403403
// If $dog is null, everything matches
404404
foreach ($item["category"] as $category) {
405-
if (is_null($dog) || in_array($category["term"], (array)$dog)) {
405+
if (is_null($dog) || in_array($category["term"], (array)$dog, false)) {
406406
$ok = true;
407407
++$count;
408408
break;
@@ -561,7 +561,7 @@ function news_toc($sections = null) {
561561
foreach ($items as $section => $menu) {
562562

563563
// only print requested sections.
564-
if (is_array($sections) && !in_array($section, $sections)) {
564+
if (is_array($sections) && !in_array($section, $sections, false)) {
565565
continue;
566566
}
567567

include/manual-lookup.inc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ function find_manual_page($lang, $keyword)
107107
// when rsync updates the database
108108
$dbh = false;
109109
if (class_exists('PDO')) {
110-
if (in_array('sqlite', PDO::getAvailableDrivers())) {
110+
if (in_array('sqlite', PDO::getAvailableDrivers(), true)) {
111111
if (file_exists($_SERVER['DOCUMENT_ROOT'] . '/backend/manual-lookup.sqlite')) {
112112
try {
113113
$dbh = new PDO( 'sqlite:' . $_SERVER['DOCUMENT_ROOT'] . '/backend/manual-lookup.sqlite', '', '', array(PDO::ATTR_PERSISTENT => true, PDO::ATTR_EMULATE_PREPARES => true) );

include/prepend.inc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,7 @@ function myphpnet_urlsearch($type = false)
140140
global $MYPHPNET;
141141

142142
// Set type if specified and if correct
143-
if ($type && in_array($type, array(MYPHPNET_URL_FUNC, MYPHPNET_URL_MANUAL))) {
143+
if ($type && in_array($type, array(MYPHPNET_URL_FUNC, MYPHPNET_URL_MANUAL), false)) {
144144
$MYPHPNET[1] = $type;
145145
}
146146

include/shared-manual.inc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ function manual_notes_load($id)
102102
"rate" => $rate,
103103
"xwhen" => $ts,
104104
"user" => $user,
105-
"note" => base64_decode($note),
105+
"note" => base64_decode($note, false),
106106
"votes" => array("up"=> (int)$up, "down"=> (int)$down)
107107
);
108108
}

manual/help-translate.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828

2929
foreach ($INACTIVE_ONLINE_LANGUAGES as $cc => $lang) {
3030
$link = 'no archive';
31-
if (in_array($cc, $archived)) {
31+
if (in_array($cc, $archived, true)) {
3232
$link = '<a href="http://docs.php.net/manual/'. $cc .'">archive</a>';
3333
}
3434
echo '<li>', $lang, ': (', $link, ')</li>';

manual/spam_challenge.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,8 +56,8 @@ function test_answer($name, $an, $bn, $answer) {
5656
}
5757
}
5858

59-
$a = array_search($an, NUMS);
60-
$b = array_search($bn, NUMS);
59+
$a = array_search($an, NUMS, false);
60+
$b = array_search($bn, NUMS, false);
6161

6262
if (empty($c) || $a === false || $b === false) return false;
6363

0 commit comments

Comments
 (0)