mirror of
https://github.com/php/web-php.git
synced 2026-03-23 23:02:13 +01:00
Enhancement: Enable void_return fixer (#661)
* Enhancement: Enable void_return fixer * Fix: Run 'make coding-standards'
This commit is contained in:
@@ -43,6 +43,7 @@ $config
|
||||
'switch_case_space' => true,
|
||||
'trim_array_spaces' => true,
|
||||
'visibility_required' => true,
|
||||
'void_return' => true,
|
||||
'whitespace_after_comma_in_array' => true,
|
||||
]);
|
||||
|
||||
|
||||
@@ -1,33 +1,33 @@
|
||||
<?php
|
||||
function bugfix($number) {
|
||||
function bugfix($number): void {
|
||||
echo "Fixed bug "; bugl($number);
|
||||
}
|
||||
|
||||
function bugl($number) {
|
||||
function bugl($number): void {
|
||||
echo "<a href=\"http://bugs.php.net/$number\">#$number</a>";
|
||||
}
|
||||
|
||||
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 "<a href=\"http://pecl.php.net/bugs/bug.php?id=$number\">#$number</a>";
|
||||
}
|
||||
|
||||
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 "<a href=\"https://github.com/$repo/issues/$number\">GH-$number</a>";
|
||||
}
|
||||
|
||||
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);
|
||||
|
||||
@@ -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()) {
|
||||
|
||||
@@ -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 "<h1>No such mirror</h1>\n<p>The mirror you tried to access (" .
|
||||
htmlspecialchars($mirror) .
|
||||
|
||||
@@ -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 <img> 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 '<div class="errors">';
|
||||
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 "</dl>";
|
||||
|
||||
}
|
||||
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<dd><a href='/manual/$lang/{$entry[0]}'>{$entry[1]}</a></dd>\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];
|
||||
|
||||
@@ -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 {
|
||||
?>
|
||||
<noscript>
|
||||
php.net's search functionality requires JavaScript to operate. Please enable
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<?php
|
||||
function search_results($res, $q, $profile = 'all', $per_page = 10, $s = 0, $l = 'en', $show_title = true, $show_foot = true, $show_attrib = true) {
|
||||
function search_results($res, $q, $profile = 'all', $per_page = 10, $s = 0, $l = 'en', $show_title = true, $show_foot = true, $show_attrib = true): void {
|
||||
$start_result = $s;
|
||||
$end_result = $s + $res['ResultSet']['totalResultsReturned'] - 1;
|
||||
|
||||
|
||||
@@ -112,7 +112,7 @@ function manual_notes_load(string $id): array
|
||||
}
|
||||
|
||||
// Print out one user note entry
|
||||
function manual_note_display(UserNote $note, $voteOption = true)
|
||||
function manual_note_display(UserNote $note, $voteOption = true): void
|
||||
{
|
||||
if ($note->user) {
|
||||
$name = "\n <strong class=\"user\"><em>" . htmlspecialchars($note->user) . "</em></strong>";
|
||||
@@ -264,7 +264,7 @@ function manual_navigation_methodname($methodname) {
|
||||
|
||||
// Set up variables important for this page
|
||||
// including HTTP header information
|
||||
function manual_setup($setup) {
|
||||
function manual_setup($setup): void {
|
||||
global $PGI, $MYSITE, $USERNOTES;
|
||||
global $ACTIVE_ONLINE_LANGUAGES;
|
||||
|
||||
@@ -381,7 +381,7 @@ CHANGE_LANG;
|
||||
return trim($r);
|
||||
}
|
||||
|
||||
function manual_footer() {
|
||||
function manual_footer(): void {
|
||||
global $USERNOTES, $__RELATED;
|
||||
|
||||
manual_notes($USERNOTES);
|
||||
|
||||
@@ -123,7 +123,7 @@ function mirror_type($site = false)
|
||||
}
|
||||
|
||||
// Redirect to an URI on this mirror site or outside this site
|
||||
function mirror_redirect($absoluteURI)
|
||||
function mirror_redirect($absoluteURI): void
|
||||
{
|
||||
global $MYSITE;
|
||||
|
||||
@@ -160,7 +160,7 @@ function mirror_setcookie($name, $content, $exptime)
|
||||
|
||||
// Use this function to write out proper headers on
|
||||
// pages where the content should not be publicly cached
|
||||
function header_nocache()
|
||||
function header_nocache(): void
|
||||
{
|
||||
// Only try to send out headers in case
|
||||
// those were not sent already
|
||||
|
||||
Reference in New Issue
Block a user