Skip to content

Enhancement: Enable constant_case fixer #660

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jul 15, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .php-cs-fixer.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@

$config->setRules([
'array_indentation' => true,
'constant_case' => true,
'indentation_type' => true,
'line_ending' => true,
'no_extra_blank_lines' => true,
Expand Down
32 changes: 16 additions & 16 deletions cal.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
a fallback to display the actual month/year.
*/

$begun = FALSE; $errors = array();
$begun = false; $errors = array();
$id = isset($_GET['id']) ? (int) $_GET['id'] : 0;
$cy = isset($_GET['cy']) ? (int) $_GET['cy'] : 0;
$cm = isset($_GET['cm']) ? (int) $_GET['cm'] : 0;
Expand All @@ -37,7 +37,7 @@
if ($event = load_event($id)) {
site_header("Event: " . stripslashes(htmlentities($event['sdesc'], ENT_QUOTES | ENT_IGNORE, 'UTF-8')), $site_header_config);
display_event($event, 0);
$begun = TRUE;
$begun = true;
}
// Unable to find event, put this to the error messages' list
else {
Expand All @@ -63,7 +63,7 @@
display_event($event, 0);
echo "<br>";
}
$begun = TRUE;
$begun = true;
}

// Unable to load events for that day
Expand Down Expand Up @@ -110,10 +110,10 @@
}

// Get events list for a whole month
$events = load_events($date, TRUE);
$events = load_events($date, true);

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

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

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

// Return with the event, if it's ID is the one
// we search for (also close the file)
if ($event !== FALSE && $event['id'] == $id) {
if ($event !== false && $event['id'] == $id) {
fclose($fp);
return $event;
}
}

// Close file, and return sign of failure
fclose($fp);
return FALSE;
return false;
}

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

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

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

// Read the event data into $event, or continue with next
// line, if there was an error with this line
if (($event = read_event($fp)) === FALSE) {
if (($event = read_event($fp)) === false) {
continue;
}

Expand Down Expand Up @@ -345,12 +345,12 @@ function load_events($from, $whole_month = FALSE)
function read_event($fp)
{
// We were unable to read a line from the file, return
if (($linearr = fgetcsv($fp, 8192)) === FALSE) {
return FALSE;
if (($linearr = fgetcsv($fp, 8192)) === false) {
return false;
}

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

// Get components
list(
Expand Down Expand Up @@ -386,11 +386,11 @@ function valid_year($year)

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

// The year is all right
return TRUE;
return true;
}

?>
6 changes: 3 additions & 3 deletions download-docs.php
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@
$changed = @filemtime($filepath);

// Size available, collect information
if ($size !== FALSE) {
if ($size !== false) {
$files[$langcode][$formatname] = array(
$link_to,
(int) ($size/1024),
Expand Down Expand Up @@ -170,8 +170,8 @@
foreach ($files as $langcode => $lang_files) {

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

// Highlight manual in preferred language
if ($preflang) {
Expand Down
4 changes: 2 additions & 2 deletions download-logos.php
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ function random_bgcolor($min, $max): void
</p>

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

<div class="center logo-list">
<?php print_image("logos/php-logo.svg", "PHP logo", FALSE, 'width="200"'); ?>
<?php print_image("logos/php-logo.svg", "PHP logo", false, 'width="200"'); ?>
<br>
<a href="/images/logos/php-logo.svg">SVG</a> |
<a href="/images/logos/php-logo-bigger.png">PNG</a>
Expand Down
46 changes: 23 additions & 23 deletions mailing-lists.php
Original file line number Diff line number Diff line change
Expand Up @@ -189,50 +189,50 @@
array (
'php-announce', 'Announcements',
'Announcements of new PHP releases are sent to this very low-volume list',
TRUE, FALSE, FALSE, "php.announce"
true, false, false, "php.announce"
),
array (
'php-general', 'General user list',
'This is a high volume list for general PHP support; ask PHP questions here',
FALSE, TRUE, TRUE, "php.general"
false, true, true, "php.general"
),
array (
'php-windows', 'Windows PHP users list',
'Using PHP on Microsoft Windows',
FALSE, TRUE, TRUE, "php.windows"
false, true, true, "php.windows"
),

'Subject specific lists for PHP users',
array (
'php-install', 'Installation issues and problems',
'How to install PHP with particular configurations and servers',
FALSE, TRUE, TRUE, "php.install"
false, true, true, "php.install"
),
array (
'php-db', 'Databases and PHP',
'This list is for the discussion of PHP database topics',
FALSE, TRUE, TRUE, "php.db"
false, true, true, "php.db"
),
array (
'php-i18n', 'Unicode and Internationalization',
'Unicode support, Internationalization (i18n) and localization (l10n) issues and features',
FALSE, TRUE, TRUE, "php.i18n"
false, true, true, "php.i18n"
),
array (
'php-evangelism', 'PHP evangelism mailing list',
'A list for people interested in promoting PHP and learning good reasons to support PHP in the enterprise',
TRUE, TRUE, TRUE, "php.evangelism"
true, true, true, "php.evangelism"
),
array (
'soap', 'PHP SOAP list',
'List for the SOAP developers',
FALSE, FALSE, FALSE, 'php.soap'
false, false, false, 'php.soap'
),
'Non-English language mailing lists',
array (
'php-es', 'Spanish PHP Mailing list',
'List for Spanish speaking people interested in PHP',
FALSE, FALSE, FALSE, 'php.general.es'
false, false, false, 'php.general.es'
),

);
Expand All @@ -244,62 +244,62 @@
array (
'internals', 'Internals list',
'A medium volume list for those who want to help out with the development of PHP',
FALSE, 'php-internals', TRUE, "php.internals"
false, 'php-internals', true, "php.internals"
),
array (
'internals-win', 'Windows Internals list',
'A low volume list for those who want to help out with the development of PHP on Windows',
FALSE, FALSE, TRUE, "php.internals.win"
false, false, true, "php.internals.win"
),
array (
'php-cvs', 'Git commit list',
'All commits to internals (php-src) and the Zend Engine are posted to this list automatically',
TRUE, TRUE, FALSE, "php.cvs"
true, true, false, "php.cvs"
),
array (
'git-pulls', 'Git pull requests',
'Pull requests from Github',
FALSE, FALSE, FALSE, "php.git-pulls"
false, false, false, "php.git-pulls"
),
array (
'php-qa', 'Quality Assurance list',
'List for the members of the PHP-QA Team',
FALSE, TRUE, FALSE, "php.qa"
false, true, false, "php.qa"
),
array (
'php-bugs', 'General bugs',
'General bug activity are posted here',
FALSE, FALSE, FALSE, "php.bugs"
false, false, false, "php.bugs"
),
array (
'standards', 'PHP Standardization and interoperability list',
'Development of language standards',
FALSE, FALSE, FALSE, "php.standards"
false, false, false, "php.standards"
),

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

'PHP documentation mailing lists',
array (
'phpdoc', 'Documentation discussion',
'List for discussing the PHP documentation',
FALSE, TRUE, FALSE, "php.doc"
false, true, false, "php.doc"
),
array (
'doc-cvs', 'Documentation changes and commits',
'Changes to the documentation are posted here',
TRUE, "php-doc-cvs", FALSE, "php.doc.cvs"
true, "php-doc-cvs", false, "php.doc.cvs"
),
array (
'doc-bugs', 'Documentation bugs',
'Documentation bug activity (translations, sources, and build system) are posted here',
TRUE, 'php-doc-bugs', FALSE, "php.doc.bugs"
true, 'php-doc-bugs', false, "php.doc.bugs"
),
);

Expand All @@ -319,9 +319,9 @@ function output_lists_table($mailing_lists): void
// Let the list name defined with a string, if the
// list is archived under a different name then php.net
// uses for it (for backward compatibilty for example)
if ($listinfo[4] !== FALSE) {
$larchive = ($listinfo[4] === TRUE ? $listinfo[0] : $listinfo[4]);
} else { $larchive = FALSE; }
if ($listinfo[4] !== false) {
$larchive = ($listinfo[4] === true ? $listinfo[0] : $listinfo[4]);
} else { $larchive = false; }
echo '<td>' . ($larchive ? "<a href=\"http://marc.info/?l={$larchive}\">yes</a>" : 'n/a') . '</td>';
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>';
echo '<td><input name="maillist" type="radio" value="' . $listinfo[0] . '"></td>';
Expand Down
16 changes: 8 additions & 8 deletions manual/add-note.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,11 @@
}

// Decide on whether all vars are present for processing
$process = TRUE;
$process = true;
$needed_vars = array('note', 'user', 'sect', 'redirect', 'action', 'func', 'arga', 'argb', 'answer');
foreach ($needed_vars as $varname) {
if (empty($_POST[$varname])) {
$process = FALSE;
$process = false;
break;
}
}
Expand All @@ -45,7 +45,7 @@
}

// We don't know of any error now
$error = FALSE;
$error = false;

// No note specified
if (strlen($note) == 0) {
Expand Down Expand Up @@ -104,15 +104,15 @@

// If there is any non-header result, then it is an error
if ($result) {
if (strpos($result, '[TOO MANY NOTES]') !== FALSE) {
if (strpos($result, '[TOO MANY NOTES]') !== false) {
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>";
} elseif (($pos = strpos($result, '[SPAMMER]')) !== FALSE) {
} elseif (($pos = strpos($result, '[SPAMMER]')) !== false) {
$ip = trim(substr($result, $pos+9));
$spam_url = $ip_spam_lookup_url . $ip;
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>';
} elseif (strpos($result, '[SPAM WORD]') !== FALSE) {
} elseif (strpos($result, '[SPAM WORD]') !== false) {
echo '<p class="formerror">Your note contains a prohibited (usually SPAM) word. Please remove it and try again.</p>';
} elseif (strpos($result, '[CLOSED]') !== FALSE) {
} elseif (strpos($result, '[CLOSED]') !== false) {
echo '<p class="formerror">Due to some technical problems this service isn\'t currently working. Please try again later. Sorry for any inconvenience.</p>';
} else {
echo "<!-- $result -->";
Expand Down Expand Up @@ -140,7 +140,7 @@
// Print out preview of note
echo '<p>This is what your entry will look like, roughly:</p>';
echo '<div id="usernotes">';
manual_note_display(time(), $user, $note, FALSE);
manual_note_display(time(), $user, $note, false);
echo '</div><br><br>';
}

Expand Down
4 changes: 2 additions & 2 deletions mirror.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@
$MIRROR_IMAGE = make_image(
'mirror.' . $ext,
htmlspecialchars(mirror_provider()),
FALSE,
FALSE,
false,
false,
'backend'
);

Expand Down
Loading