Author: Andreas Möller (localheinz) Committer: GitHub (web-flow) Pusher: cmb69 Date: 2022-07-15T13:50:13+02:00
Commit: https://github.com/php/web-php/commit/d7e1b8159c9d60111d7cdc09070e87dcab541088 Raw diff: https://github.com/php/web-php/commit/d7e1b8159c9d60111d7cdc09070e87dcab541088.diff Enhancement: Enable `constant_case` fixer Co-authored-by: MathiasReker <math...@reker.dk> Closes GH-660. Changed paths: M .php-cs-fixer.php M cal.php M download-docs.php M download-logos.php M mailing-lists.php M manual/add-note.php M mirror.php M quickref.php Diff: diff --git a/.php-cs-fixer.php b/.php-cs-fixer.php index f2ea02380..f9ca18795 100644 --- a/.php-cs-fixer.php +++ b/.php-cs-fixer.php @@ -13,6 +13,7 @@ $config->setRules([ 'array_indentation' => true, + 'constant_case' => true, 'indentation_type' => true, 'line_ending' => true, 'no_extra_blank_lines' => true, diff --git a/cal.php b/cal.php index 55599eb7e..990040cf5 100644 --- a/cal.php +++ b/cal.php @@ -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; @@ -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 { @@ -63,7 +63,7 @@ display_event($event, 0); echo "<br>"; } - $begun = TRUE; + $begun = true; } // Unable to load events for that day @@ -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"; } @@ -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)) { @@ -266,7 +266,7 @@ 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; } @@ -274,12 +274,12 @@ function load_event($id) // 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); @@ -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; } @@ -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( @@ -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; } ?> diff --git a/download-docs.php b/download-docs.php index bdd5d4a24..471f15304 100644 --- a/download-docs.php +++ b/download-docs.php @@ -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), @@ -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) { diff --git a/download-logos.php b/download-logos.php index 85f59dd1c..b331754d9 100644 --- a/download-logos.php +++ b/download-logos.php @@ -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> @@ -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> diff --git a/mailing-lists.php b/mailing-lists.php index 36186c820..37993fd76 100644 --- a/mailing-lists.php +++ b/mailing-lists.php @@ -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' ), ); @@ -244,37 +244,37 @@ 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', @@ -282,24 +282,24 @@ '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" ), ); @@ -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>'; diff --git a/manual/add-note.php b/manual/add-note.php index 107d4c3a7..7db4a4e4b 100644 --- a/manual/add-note.php +++ b/manual/add-note.php @@ -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; } } @@ -45,7 +45,7 @@ } // We don't know of any error now - $error = FALSE; + $error = false; // No note specified if (strlen($note) == 0) { @@ -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 -->"; @@ -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>'; } diff --git a/mirror.php b/mirror.php index c153bc01e..1df2a1682 100644 --- a/mirror.php +++ b/mirror.php @@ -31,8 +31,8 @@ $MIRROR_IMAGE = make_image( 'mirror.' . $ext, htmlspecialchars(mirror_provider()), - FALSE, - FALSE, + false, + false, 'backend' ); diff --git a/quickref.php b/quickref.php index cb4c757de..6e33915c9 100644 --- a/quickref.php +++ b/quickref.php @@ -54,7 +54,7 @@ function quickref_table($functions, $sort = true): void $p = 0; // Get all file names from the directory -while (($entry = readdir($dirh)) !== FALSE) { +while (($entry = readdir($dirh)) !== false) { // Skip names starting with a dot if (substr($entry, 0, 1) == ".") { continue; } @@ -70,7 +70,7 @@ function quickref_table($functions, $sort = true): void // If $notfound is a substring of $funcname then overwrite the score // similar_text() gave it. - if ($p < 70 && ($pos = strpos($funcname, $notfound)) !== FALSE) { + if ($p < 70 && ($pos = strpos($funcname, $notfound)) !== false) { $p = 90 - $pos; } $temp[$entry] = $p; @@ -93,7 +93,7 @@ function quickref_table($functions, $sort = true): void // If the two are more then 70% similar or $notfound is a substring // of $funcname, then the match is a very similar one - if ($p >= 70 || (strpos($functions[$file], $notfound) !== FALSE)) { + if ($p >= 70 || (strpos($functions[$file], $notfound) !== false)) { $maybe[$file] = '<b>' . $functions[$file] . '</b>'; } // Otherwise it is just similar -- PHP Webmaster List Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php