Author: Mathias Reker ⚡️ (MathiasReker) Committer: GitHub (web-flow) Pusher: cmb69 Date: 2022-06-17T19:16:52+02:00
Commit: https://github.com/php/web-php/commit/530b28e95b4d66323b3078cd8b6bf65c390c2e50 Raw diff: https://github.com/php/web-php/commit/530b28e95b4d66323b3078cd8b6bf65c390c2e50.diff Add void return types Add void return type to functions with missing or empty return statements. Closes GH-535. Changed paths: M cal.php M download-logos.php M images/logo.php M index.php M mailing-lists.php M quickref.php M releases/index.php M submit-event.php M urlhowto.php Diff: diff --git a/cal.php b/cal.php index ed02e43d0..3b5399959 100644 --- a/cal.php +++ b/cal.php @@ -230,7 +230,7 @@ function date_for_recur($recur, $day, $bom, $eom) } // Display a <div> for each of the events that are on a given day -function display_events_for_day($day, $events) +function display_events_for_day($day, $events): void { // For preservation of state in the links global $cm, $cy, $COUNTRY; diff --git a/download-logos.php b/download-logos.php index 02158900a..85f59dd1c 100644 --- a/download-logos.php +++ b/download-logos.php @@ -13,13 +13,13 @@ site_header("Download Logos", array("current" => "downloads")); // Print recommended star cell -function print_star() +function print_star(): void { echo "<td class=\"star\"><span class=\"star\" title=\"recommended\">*</span></td>\n"; } // Provide a random bgcolor setting for a cell -function random_bgcolor($min, $max) +function random_bgcolor($min, $max): void { echo "style=\"background-color: #" . sprintf('%02x%02x%02x', rand($min, $max)*51, rand($min, $max)*51, rand($min, $max)*51) . diff --git a/images/logo.php b/images/logo.php index 525efb7da..0c64158c5 100644 --- a/images/logo.php +++ b/images/logo.php @@ -53,7 +53,7 @@ function get_accepted_encodings() { } -function serve_compressed_if_available($logo) { +function serve_compressed_if_available($logo): void { $encodings = get_accepted_encodings(); if (!empty($encodings)) { foreach ($encodings as $encoding) { diff --git a/index.php b/index.php index 34f7b2a30..352d5750e 100644 --- a/index.php +++ b/index.php @@ -1,5 +1,5 @@ <?php // vim: et -(function($uri) { +(function($uri): void { // Special redirect cases not able to be captured in error.php $shortcuts = [ '/?:' => '/language.operators.comparison#language.operators.comparison.ternary', diff --git a/mailing-lists.php b/mailing-lists.php index a2a5232b8..e134096af 100644 --- a/mailing-lists.php +++ b/mailing-lists.php @@ -304,7 +304,7 @@ ); // Print out a table for a given list array -function output_lists_table($mailing_lists) +function output_lists_table($mailing_lists): void { echo '<table cellpadding="5" border="0" class="standard mailing-lists">', "\n"; foreach ($mailing_lists as $listinfo) { diff --git a/quickref.php b/quickref.php index da786b9ca..940165521 100644 --- a/quickref.php +++ b/quickref.php @@ -24,7 +24,7 @@ // Print out the table of found (or all) functions. The HTML comments are // needed to support MyCroft search (Mozilla browser family and Sherlock for MacOSX) -function quickref_table($functions, $sort = true) +function quickref_table($functions, $sort = true): void { global $LANG; diff --git a/releases/index.php b/releases/index.php index 4f141f8f2..b2bf361e2 100644 --- a/releases/index.php +++ b/releases/index.php @@ -186,7 +186,7 @@ function mk_rel(int $major, /* bool | array */ $announcement, array $source, array $windows, - bool $museum) { + bool $museum): void { printf("<a id=\"%s\"></a>\n<h2>%1\$s</h2>\n<ul>\n <li>Released: %s</li>\n <li>Announcement: ", ($pos = strpos($ver, " ")) ? substr($ver, 0, $pos) : $ver, $date); diff --git a/submit-event.php b/submit-event.php index 055c694d6..adba380c1 100644 --- a/submit-event.php +++ b/submit-event.php @@ -265,7 +265,7 @@ site_footer(); // Display an option list with one selected -function display_options($options, $current) +function display_options($options, $current): void { foreach ($options as $k => $v) { echo '<option value="', $k, '"', diff --git a/urlhowto.php b/urlhowto.php index 196be2bec..0ea3c0329 100644 --- a/urlhowto.php +++ b/urlhowto.php @@ -25,7 +25,7 @@ '; site_header("URL Howto", array("current" => "help")); -function a($href) { +function a($href): void { global $MYSITE; echo '<a href="' . $MYSITE . $href . '">' . $MYSITE . $href . '</a>'; } -- PHP Webmaster List Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php