Skip to content

Commit d7e1b81

Browse files
authored
Enhancement: Enable constant_case fixer
Co-authored-by: MathiasReker <[email protected]> Closes GH-660.
1 parent d8717d3 commit d7e1b81

8 files changed

+58
-57
lines changed

.php-cs-fixer.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313

1414
$config->setRules([
1515
'array_indentation' => true,
16+
'constant_case' => true,
1617
'indentation_type' => true,
1718
'line_ending' => true,
1819
'no_extra_blank_lines' => true,

cal.php

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
a fallback to display the actual month/year.
1919
*/
2020

21-
$begun = FALSE; $errors = array();
21+
$begun = false; $errors = array();
2222
$id = isset($_GET['id']) ? (int) $_GET['id'] : 0;
2323
$cy = isset($_GET['cy']) ? (int) $_GET['cy'] : 0;
2424
$cm = isset($_GET['cm']) ? (int) $_GET['cm'] : 0;
@@ -37,7 +37,7 @@
3737
if ($event = load_event($id)) {
3838
site_header("Event: " . stripslashes(htmlentities($event['sdesc'], ENT_QUOTES | ENT_IGNORE, 'UTF-8')), $site_header_config);
3939
display_event($event, 0);
40-
$begun = TRUE;
40+
$begun = true;
4141
}
4242
// Unable to find event, put this to the error messages' list
4343
else {
@@ -63,7 +63,7 @@
6363
display_event($event, 0);
6464
echo "<br>";
6565
}
66-
$begun = TRUE;
66+
$begun = true;
6767
}
6868

6969
// Unable to load events for that day
@@ -110,10 +110,10 @@
110110
}
111111

112112
// Get events list for a whole month
113-
$events = load_events($date, TRUE);
113+
$events = load_events($date, true);
114114

115115
// If there was an error, or there are no events, this is an error
116-
if ($events === FALSE || count($events) == 0) {
116+
if ($events === false || count($events) == 0) {
117117
$errors[] = "No events found for this month";
118118
}
119119

@@ -257,7 +257,7 @@ function load_event($id)
257257
{
258258
// Open events CSV file, return on error
259259
$fp = @fopen("backend/events.csv",'r');
260-
if (!$fp) { return FALSE; }
260+
if (!$fp) { return false; }
261261

262262
// Read as we can, event by event
263263
while (!feof($fp)) {
@@ -266,20 +266,20 @@ function load_event($id)
266266

267267
// Return with the event, if it's ID is the one
268268
// we search for (also close the file)
269-
if ($event !== FALSE && $event['id'] == $id) {
269+
if ($event !== false && $event['id'] == $id) {
270270
fclose($fp);
271271
return $event;
272272
}
273273
}
274274

275275
// Close file, and return sign of failure
276276
fclose($fp);
277-
return FALSE;
277+
return false;
278278
}
279279

280280
// Load a list of events. Either for a particular day ($from) or a whole
281281
// month (if second parameter specified with TRUE)
282-
function load_events($from, $whole_month = FALSE)
282+
function load_events($from, $whole_month = false)
283283
{
284284
// Take advantage of the equality behavior of this date format
285285
$from_date = date("Y-m-d", $from);
@@ -292,14 +292,14 @@ function load_events($from, $whole_month = FALSE)
292292

293293
// Try to open the events file for reading, return if unable to
294294
$fp = @fopen("backend/events.csv",'r');
295-
if (!$fp) { return FALSE; }
295+
if (!$fp) { return false; }
296296

297297
// For all events, read in the event and check it if fits our scope
298298
while (!feof($fp)) {
299299

300300
// Read the event data into $event, or continue with next
301301
// line, if there was an error with this line
302-
if (($event = read_event($fp)) === FALSE) {
302+
if (($event = read_event($fp)) === false) {
303303
continue;
304304
}
305305

@@ -345,12 +345,12 @@ function load_events($from, $whole_month = FALSE)
345345
function read_event($fp)
346346
{
347347
// We were unable to read a line from the file, return
348-
if (($linearr = fgetcsv($fp, 8192)) === FALSE) {
349-
return FALSE;
348+
if (($linearr = fgetcsv($fp, 8192)) === false) {
349+
return false;
350350
}
351351

352352
// Corrupt line in CSV file
353-
if (count($linearr) < 13) { return FALSE; }
353+
if (count($linearr) < 13) { return false; }
354354

355355
// Get components
356356
list(
@@ -386,11 +386,11 @@ function valid_year($year)
386386

387387
// We only allow this and the next year for displays
388388
if ($year != $current_year && $year != $current_year+1) {
389-
return FALSE;
389+
return false;
390390
}
391391

392392
// The year is all right
393-
return TRUE;
393+
return true;
394394
}
395395

396396
?>

download-docs.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@
118118
$changed = @filemtime($filepath);
119119

120120
// Size available, collect information
121-
if ($size !== FALSE) {
121+
if ($size !== false) {
122122
$files[$langcode][$formatname] = array(
123123
$link_to,
124124
(int) ($size/1024),
@@ -170,8 +170,8 @@
170170
foreach ($files as $langcode => $lang_files) {
171171

172172
// See if current language is the preferred one
173-
if ($langcode == $LANG) { $preflang = TRUE; }
174-
else { $preflang = FALSE; }
173+
if ($langcode == $LANG) { $preflang = true; }
174+
else { $preflang = false; }
175175

176176
// Highlight manual in preferred language
177177
if ($preflang) {

download-logos.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ function random_bgcolor($min, $max): void
6565
</p>
6666

6767
<div class="center logo-list">
68-
<?php print_image("logos/new-php-logo.svg", "PHP logo", FALSE, 'width="200"'); ?>
68+
<?php print_image("logos/new-php-logo.svg", "PHP logo", false, 'width="200"'); ?>
6969
<br>
7070
<a href="/images/logos/new-php-logo.svg">SVG</a> |
7171
<a href="/images/logos/new-php-logo.png">PNG</a>
@@ -78,7 +78,7 @@ function random_bgcolor($min, $max): void
7878
</p>
7979

8080
<div class="center logo-list">
81-
<?php print_image("logos/php-logo.svg", "PHP logo", FALSE, 'width="200"'); ?>
81+
<?php print_image("logos/php-logo.svg", "PHP logo", false, 'width="200"'); ?>
8282
<br>
8383
<a href="/images/logos/php-logo.svg">SVG</a> |
8484
<a href="/images/logos/php-logo-bigger.png">PNG</a>

mailing-lists.php

Lines changed: 23 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -189,50 +189,50 @@
189189
array (
190190
'php-announce', 'Announcements',
191191
'Announcements of new PHP releases are sent to this very low-volume list',
192-
TRUE, FALSE, FALSE, "php.announce"
192+
true, false, false, "php.announce"
193193
),
194194
array (
195195
'php-general', 'General user list',
196196
'This is a high volume list for general PHP support; ask PHP questions here',
197-
FALSE, TRUE, TRUE, "php.general"
197+
false, true, true, "php.general"
198198
),
199199
array (
200200
'php-windows', 'Windows PHP users list',
201201
'Using PHP on Microsoft Windows',
202-
FALSE, TRUE, TRUE, "php.windows"
202+
false, true, true, "php.windows"
203203
),
204204

205205
'Subject specific lists for PHP users',
206206
array (
207207
'php-install', 'Installation issues and problems',
208208
'How to install PHP with particular configurations and servers',
209-
FALSE, TRUE, TRUE, "php.install"
209+
false, true, true, "php.install"
210210
),
211211
array (
212212
'php-db', 'Databases and PHP',
213213
'This list is for the discussion of PHP database topics',
214-
FALSE, TRUE, TRUE, "php.db"
214+
false, true, true, "php.db"
215215
),
216216
array (
217217
'php-i18n', 'Unicode and Internationalization',
218218
'Unicode support, Internationalization (i18n) and localization (l10n) issues and features',
219-
FALSE, TRUE, TRUE, "php.i18n"
219+
false, true, true, "php.i18n"
220220
),
221221
array (
222222
'php-evangelism', 'PHP evangelism mailing list',
223223
'A list for people interested in promoting PHP and learning good reasons to support PHP in the enterprise',
224-
TRUE, TRUE, TRUE, "php.evangelism"
224+
true, true, true, "php.evangelism"
225225
),
226226
array (
227227
'soap', 'PHP SOAP list',
228228
'List for the SOAP developers',
229-
FALSE, FALSE, FALSE, 'php.soap'
229+
false, false, false, 'php.soap'
230230
),
231231
'Non-English language mailing lists',
232232
array (
233233
'php-es', 'Spanish PHP Mailing list',
234234
'List for Spanish speaking people interested in PHP',
235-
FALSE, FALSE, FALSE, 'php.general.es'
235+
false, false, false, 'php.general.es'
236236
),
237237

238238
);
@@ -244,62 +244,62 @@
244244
array (
245245
'internals', 'Internals list',
246246
'A medium volume list for those who want to help out with the development of PHP',
247-
FALSE, 'php-internals', TRUE, "php.internals"
247+
false, 'php-internals', true, "php.internals"
248248
),
249249
array (
250250
'internals-win', 'Windows Internals list',
251251
'A low volume list for those who want to help out with the development of PHP on Windows',
252-
FALSE, FALSE, TRUE, "php.internals.win"
252+
false, false, true, "php.internals.win"
253253
),
254254
array (
255255
'php-cvs', 'Git commit list',
256256
'All commits to internals (php-src) and the Zend Engine are posted to this list automatically',
257-
TRUE, TRUE, FALSE, "php.cvs"
257+
true, true, false, "php.cvs"
258258
),
259259
array (
260260
'git-pulls', 'Git pull requests',
261261
'Pull requests from Github',
262-
FALSE, FALSE, FALSE, "php.git-pulls"
262+
false, false, false, "php.git-pulls"
263263
),
264264
array (
265265
'php-qa', 'Quality Assurance list',
266266
'List for the members of the PHP-QA Team',
267-
FALSE, TRUE, FALSE, "php.qa"
267+
false, true, false, "php.qa"
268268
),
269269
array (
270270
'php-bugs', 'General bugs',
271271
'General bug activity are posted here',
272-
FALSE, FALSE, FALSE, "php.bugs"
272+
false, false, false, "php.bugs"
273273
),
274274
array (
275275
'standards', 'PHP Standardization and interoperability list',
276276
'Development of language standards',
277-
FALSE, FALSE, FALSE, "php.standards"
277+
false, false, false, "php.standards"
278278
),
279279

280280
'PHP internal website mailing lists',
281281
array (
282282
'php-webmaster', 'PHP php.net internal infrastructure discussion',
283283
'List for discussing and maintaining the php.net web infrastructure.<br>
284284
For general PHP support questions, see "General Mailing Lists" or the <a href="/support.php">support page</a>',
285-
FALSE, FALSE, FALSE, "php.webmaster"
285+
false, false, false, "php.webmaster"
286286
),
287287

288288
'PHP documentation mailing lists',
289289
array (
290290
'phpdoc', 'Documentation discussion',
291291
'List for discussing the PHP documentation',
292-
FALSE, TRUE, FALSE, "php.doc"
292+
false, true, false, "php.doc"
293293
),
294294
array (
295295
'doc-cvs', 'Documentation changes and commits',
296296
'Changes to the documentation are posted here',
297-
TRUE, "php-doc-cvs", FALSE, "php.doc.cvs"
297+
true, "php-doc-cvs", false, "php.doc.cvs"
298298
),
299299
array (
300300
'doc-bugs', 'Documentation bugs',
301301
'Documentation bug activity (translations, sources, and build system) are posted here',
302-
TRUE, 'php-doc-bugs', FALSE, "php.doc.bugs"
302+
true, 'php-doc-bugs', false, "php.doc.bugs"
303303
),
304304
);
305305

@@ -319,9 +319,9 @@ function output_lists_table($mailing_lists): void
319319
// Let the list name defined with a string, if the
320320
// list is archived under a different name then php.net
321321
// uses for it (for backward compatibilty for example)
322-
if ($listinfo[4] !== FALSE) {
323-
$larchive = ($listinfo[4] === TRUE ? $listinfo[0] : $listinfo[4]);
324-
} else { $larchive = FALSE; }
322+
if ($listinfo[4] !== false) {
323+
$larchive = ($listinfo[4] === true ? $listinfo[0] : $listinfo[4]);
324+
} else { $larchive = false; }
325325
echo '<td>' . ($larchive ? "<a href=\"http://marc.info/?l={$larchive}\">yes</a>" : 'n/a') . '</td>';
326326
echo '<td>' . ($listinfo[6] ? "<a href=\"news://news.php.net/{$listinfo[6]}\">yes</a> <a href=\"http://news.php.net/group.php?group={$listinfo[6]}\">http</a>" : 'n/a') . '</td>';
327327
echo '<td><input name="maillist" type="radio" value="' . $listinfo[0] . '"></td>';

manual/add-note.php

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -18,11 +18,11 @@
1818
}
1919

2020
// Decide on whether all vars are present for processing
21-
$process = TRUE;
21+
$process = true;
2222
$needed_vars = array('note', 'user', 'sect', 'redirect', 'action', 'func', 'arga', 'argb', 'answer');
2323
foreach ($needed_vars as $varname) {
2424
if (empty($_POST[$varname])) {
25-
$process = FALSE;
25+
$process = false;
2626
break;
2727
}
2828
}
@@ -45,7 +45,7 @@
4545
}
4646

4747
// We don't know of any error now
48-
$error = FALSE;
48+
$error = false;
4949

5050
// No note specified
5151
if (strlen($note) == 0) {
@@ -104,15 +104,15 @@
104104

105105
// If there is any non-header result, then it is an error
106106
if ($result) {
107-
if (strpos($result, '[TOO MANY NOTES]') !== FALSE) {
107+
if (strpos($result, '[TOO MANY NOTES]') !== false) {
108108
print "<p class=\"formerror\">As a security precaution, we only allow a certain number of notes to be submitted per minute. At this time, this number has been exceeded. Please re-submit your note in about a minute.</p>";
109-
} elseif (($pos = strpos($result, '[SPAMMER]')) !== FALSE) {
109+
} elseif (($pos = strpos($result, '[SPAMMER]')) !== false) {
110110
$ip = trim(substr($result, $pos+9));
111111
$spam_url = $ip_spam_lookup_url . $ip;
112112
print '<p class="formerror">Your IP is listed in one of the spammers lists we use, which aren\'t controlled by us. More information is available at <a href="'.$spam_url.'">'.$spam_url.'</a>.</p>';
113-
} elseif (strpos($result, '[SPAM WORD]') !== FALSE) {
113+
} elseif (strpos($result, '[SPAM WORD]') !== false) {
114114
echo '<p class="formerror">Your note contains a prohibited (usually SPAM) word. Please remove it and try again.</p>';
115-
} elseif (strpos($result, '[CLOSED]') !== FALSE) {
115+
} elseif (strpos($result, '[CLOSED]') !== false) {
116116
echo '<p class="formerror">Due to some technical problems this service isn\'t currently working. Please try again later. Sorry for any inconvenience.</p>';
117117
} else {
118118
echo "<!-- $result -->";
@@ -140,7 +140,7 @@
140140
// Print out preview of note
141141
echo '<p>This is what your entry will look like, roughly:</p>';
142142
echo '<div id="usernotes">';
143-
manual_note_display(time(), $user, $note, FALSE);
143+
manual_note_display(time(), $user, $note, false);
144144
echo '</div><br><br>';
145145
}
146146

mirror.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,8 @@
3131
$MIRROR_IMAGE = make_image(
3232
'mirror.' . $ext,
3333
htmlspecialchars(mirror_provider()),
34-
FALSE,
35-
FALSE,
34+
false,
35+
false,
3636
'backend'
3737
);
3838

0 commit comments

Comments
 (0)