diff --git a/.php-cs-fixer.php b/.php-cs-fixer.php index 40d0847678..c76d76095e 100644 --- a/.php-cs-fixer.php +++ b/.php-cs-fixer.php @@ -43,6 +43,7 @@ 'switch_case_space' => true, 'trim_array_spaces' => true, 'visibility_required' => true, + 'void_return' => true, 'whitespace_after_comma_in_array' => true, ]); diff --git a/include/changelogs.inc b/include/changelogs.inc index 22c346a0ae..a3317ab03d 100644 --- a/include/changelogs.inc +++ b/include/changelogs.inc @@ -1,33 +1,33 @@ #$number"; } -function implemented($number) { +function implemented($number): void { echo "Implemented FR "; bugl($number); } -function peclbugfix($number) { +function peclbugfix($number): void { echo "Fixed PECL bug "; bugl($number); } -function peclbugl($number) { +function peclbugl($number): void { echo "#$number"; } -function githubissue($repo, $number) { +function githubissue($repo, $number): void { echo "Fixed issue "; githubissuel($repo, $number); } -function githubissuel($repo, $number) { +function githubissuel($repo, $number): void { echo "GH-$number"; } -function release_date($in) { +function release_date($in): void { $time = strtotime($in); $human_readable = date('d M Y', $time); $for_tools = date('Y-m-d', $time); diff --git a/include/do-download.inc b/include/do-download.inc index 9c767ce5ee..b31f763b2c 100644 --- a/include/do-download.inc +++ b/include/do-download.inc @@ -23,7 +23,7 @@ function get_actual_download_file($file) return $found; } // Download a file from a mirror site -function download_file($mirror, $file) +function download_file($mirror, $file): void { // Redirect to the particular file if (!headers_sent()) { diff --git a/include/errors.inc b/include/errors.inc index 93a1840bc4..ac5d2586d3 100644 --- a/include/errors.inc +++ b/include/errors.inc @@ -6,7 +6,7 @@ */ // A 'good looking' 404 error message page -function error_404() +function error_404(): void { global $MYSITE; status_header(404); @@ -19,7 +19,7 @@ function error_404() } // A 'good looking' 404 error message page for manual pages -function error_404_manual() +function error_404_manual(): void { global $MYSITE; status_header(404); @@ -35,7 +35,7 @@ function error_404_manual() } // An error message page for manual pages from inactive languages -function error_inactive_manual_page($lang_name, $en_page) +function error_inactive_manual_page($lang_name, $en_page): void { global $MYSITE, $ACTIVE_ONLINE_LANGUAGES; status_header(404); @@ -61,7 +61,7 @@ function error_inactive_manual_page($lang_name, $en_page) } // This service is not working right now -function error_noservice() +function error_noservice(): void { global $MYSITE; site_header('Service not working', ["noindex"]); @@ -76,7 +76,7 @@ function error_noservice() } // There is no such mirror -function error_nomirror($mirror) { +function error_nomirror($mirror): void { site_header("No such mirror", ["noindex"]); echo "
The mirror you tried to access (" .
htmlspecialchars($mirror) .
diff --git a/include/layout.inc b/include/layout.inc
index 7378d66ec1..563ed8bade 100644
--- a/include/layout.inc
+++ b/include/layout.inc
@@ -48,10 +48,10 @@ function highlight_php_trimmed($code, $return = false)
}
// Stats pages still need this
-function commonHeader($title) { site_header($title); }
+function commonHeader($title): void { site_header($title); }
// Stats pages still need this
-function commonFooter() { site_footer(); }
+function commonFooter(): void { site_footer(); }
// Resize the image using the output of make_image()
function resize_image($img, $width = 1, $height = 1)
@@ -105,7 +105,7 @@ function make_image($file, $alt = false, $align = false, $extras = false,
// Print an tag out for a given file
function print_image($file, $alt = false, $align = false, $extras = false,
- $dir = '/images')
+ $dir = '/images'): void
{
echo make_image($file, $alt, $align, $extras, $dir);
}
@@ -163,12 +163,12 @@ function make_popup_link ($url, $linktext = false, $target = false, $windowprops
// print_popup_link()
// print a hyperlink to something, within the site, that pops up a new window
//
-function print_popup_link($url, $linktext = false, $windowprops = "", $target = false, $extras = false) {
+function print_popup_link($url, $linktext = false, $windowprops = "", $target = false, $extras = false): void {
echo make_popup_link($url, $linktext, $windowprops, $target, $extras);
}
// Print a link for a downloadable file (including filesize)
-function download_link($file, $title)
+function download_link($file, $title): void
{
$download_link = "/distributions/" . $file;
@@ -236,7 +236,7 @@ function clean_note($text)
);
}
-function display_errors($errors)
+function display_errors($errors): void
{
echo '