From 04b8215ed5cd550178bd46a296ca418d8d505534 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andreas=20M=C3=B6ller?= Date: Fri, 15 Jul 2022 13:31:14 +0200 Subject: [PATCH 1/2] Enhancement: Enable void_return fixer --- .php-cs-fixer.php | 1 + 1 file changed, 1 insertion(+) 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, ]); From f2f793c8f88a6e027396d8e217867d04cc40eb62 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andreas=20M=C3=B6ller?= Date: Tue, 5 Dec 2023 13:34:30 +0100 Subject: [PATCH 2/2] Fix: Run 'make coding-standards' --- include/changelogs.inc | 16 ++++++++-------- include/do-download.inc | 2 +- include/errors.inc | 10 +++++----- include/layout.inc | 28 ++++++++++++++-------------- include/prepend.inc | 8 ++++---- include/results.inc | 2 +- include/shared-manual.inc | 6 +++--- include/site.inc | 4 ++-- 8 files changed, 38 insertions(+), 38 deletions(-) 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 "

No such mirror

\n

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 '

'; if (count($errors) > 1) { @@ -254,7 +254,7 @@ function display_errors($errors) // Displays an event. Used in event submission // previews and event information displays -function display_event($event, $include_date = 1) +function display_event($event, $include_date = 1): void { global $COUNTRIES; // Current month (int)($_GET['cm'] ?: 0) @@ -354,7 +354,7 @@ function display_event($event, $include_date = 1) } // Print news links for archives -function news_archive_sidebar() +function news_archive_sidebar(): void { global $SIDEBAR_DATA; $SIDEBAR_DATA = ' @@ -447,7 +447,7 @@ EOT; return $retval; } -function site_header($title = 'Hypertext Preprocessor', $config = []) +function site_header($title = 'Hypertext Preprocessor', $config = []): void { global $MYSITE; @@ -481,7 +481,7 @@ function site_header($title = 'Hypertext Preprocessor', $config = []) require __DIR__ . "/header.inc"; } -function site_footer($config = []) +function site_footer($config = []): void { require __DIR__ . "/footer.inc"; } @@ -511,7 +511,7 @@ function get_news_changes() return false; } -function news_toc($sections = null) { +function news_toc($sections = null): void { include __DIR__ . "/pregen-news.inc"; $items = [ "news" => [ @@ -544,7 +544,7 @@ function news_toc($sections = null) { } } } -function doc_toc($lang) { +function doc_toc($lang): void { $file = __DIR__ . "/../manual/$lang/toc/index.inc"; if (!file_exists($file)) { $lang = "en"; // Fallback on english if the translation doesn't exist @@ -591,7 +591,7 @@ function doc_toc($lang) { echo ""; } -function doc_toc_list($lang, $index, $file) { +function doc_toc_list($lang, $index, $file): void { include __DIR__ . "/../manual/$lang/toc/$file.inc"; doc_toc_title($lang, $index, $file); @@ -599,7 +599,7 @@ function doc_toc_list($lang, $index, $file) { echo "\t
{$entry[1]}
\n"; } } -function doc_toc_title($lang, $index, $file, $elm = "dt") { +function doc_toc_title($lang, $index, $file, $elm = "dt"): void { foreach ($index as $entry) { if ($entry[0] == "$file.php") { $link = $entry[0]; diff --git a/include/prepend.inc b/include/prepend.inc index 13f901dff1..c6f03a4d5d 100644 --- a/include/prepend.inc +++ b/include/prepend.inc @@ -15,7 +15,7 @@ header("Content-type: text/html; charset=utf-8"); header("Permissions-Policy: interest-cohort=()"); /* Fix Silly Same Origin Policies */ -(function () { +(function (): void { if (!isset($_SERVER["HTTP_ORIGIN"])) { return; } @@ -94,7 +94,7 @@ include __DIR__ . '/last_updated.inc'; // ----------------------------------------------------------------------------- // Load in the user preferences -function myphpnet_load() +function myphpnet_load(): void { global $MYPHPNET, $MYSITE; @@ -169,7 +169,7 @@ function myphpnet_showug($enable = null) { } // Save user settings in cookie -function myphpnet_save() +function myphpnet_save(): void { global $MYPHPNET; @@ -183,7 +183,7 @@ function myphpnet_save() } -function google_cse() { +function google_cse(): void { ?>