Skip to content

Commit 09a4679

Browse files
committed
Fix: Run 'make coding-standards'
1 parent 95ef1ab commit 09a4679

File tree

9 files changed

+43
-43
lines changed

9 files changed

+43
-43
lines changed

include/changelogs.inc

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,33 +1,33 @@
11
<?php
2-
function bugfix($number) {
2+
function bugfix($number): void {
33
echo "Fixed bug "; bugl($number);
44
}
55

6-
function bugl($number) {
6+
function bugl($number): void {
77
echo "<a href=\"http://bugs.php.net/$number\">#$number</a>";
88
}
99

10-
function implemented($number) {
10+
function implemented($number): void {
1111
echo "Implemented FR "; bugl($number);
1212
}
1313

14-
function peclbugfix($number) {
14+
function peclbugfix($number): void {
1515
echo "Fixed PECL bug "; bugl($number);
1616
}
1717

18-
function peclbugl($number) {
18+
function peclbugl($number): void {
1919
echo "<a href=\"http://pecl.php.net/bugs/bug.php?id=$number\">#$number</a>";
2020
}
2121

22-
function githubissue($repo, $number) {
22+
function githubissue($repo, $number): void {
2323
echo "Fixed issue "; githubissuel($repo, $number);
2424
}
2525

26-
function githubissuel($repo, $number) {
26+
function githubissuel($repo, $number): void {
2727
echo "<a href=\"https://github.com/$repo/issues/$number\">GH-$number</a>";
2828
}
2929

30-
function release_date($in) {
30+
function release_date($in): void {
3131
$time = strtotime($in);
3232
$human_readable = date('d M Y', $time);
3333
$for_tools = date('Y-m-d', $time);

include/do-download.inc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ function get_actual_download_file($file)
2323
return $found;
2424
}
2525
// Download a file from a mirror site
26-
function download_file($mirror, $file)
26+
function download_file($mirror, $file): void
2727
{
2828
// Redirect to the particular file
2929
if (!headers_sent()) {

include/errors.inc

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
*/
77

88
// A 'good looking' 404 error message page
9-
function error_404()
9+
function error_404(): void
1010
{
1111
global $MYSITE;
1212
status_header(404);
@@ -19,7 +19,7 @@ function error_404()
1919
}
2020

2121
// A 'good looking' 404 error message page for manual pages
22-
function error_404_manual()
22+
function error_404_manual(): void
2323
{
2424
global $MYSITE;
2525
status_header(404);
@@ -35,7 +35,7 @@ function error_404_manual()
3535
}
3636

3737
// An error message page for manual pages from inactive languages
38-
function error_inactive_manual_page($lang_name, $en_page)
38+
function error_inactive_manual_page($lang_name, $en_page): void
3939
{
4040
global $MYSITE, $ACTIVE_ONLINE_LANGUAGES;
4141
status_header(404);
@@ -61,7 +61,7 @@ function error_inactive_manual_page($lang_name, $en_page)
6161
}
6262

6363
// This service is not working right now
64-
function error_noservice()
64+
function error_noservice(): void
6565
{
6666
global $MYSITE;
6767
site_header('Service not working', array("noindex"));
@@ -76,7 +76,7 @@ function error_noservice()
7676
}
7777

7878
// There is no such mirror
79-
function error_nomirror($mirror) {
79+
function error_nomirror($mirror): void {
8080
site_header("No such mirror", array("noindex"));
8181
echo "<h1>No such mirror</h1>\n<p>The mirror you tried to access (" .
8282
htmlspecialchars($mirror) .

include/layout.inc

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -60,10 +60,10 @@ function highlight_php_trimmed($code, $return = false)
6060
}
6161

6262
// Stats pages still need this
63-
function commonHeader($title) { site_header($title); }
63+
function commonHeader($title): void { site_header($title); }
6464

6565
// Stats pages still need this
66-
function commonFooter() { site_footer(); }
66+
function commonFooter(): void { site_footer(); }
6767

6868
// Resize the image using the output of make_image()
6969
function resize_image($img, $width = 1, $height = 1)
@@ -117,7 +117,7 @@ function make_image($file, $alt = false, $align = false, $extras = false,
117117

118118
// Print an <img> tag out for a given file
119119
function print_image($file, $alt = false, $align = false, $extras = false,
120-
$dir = '/images')
120+
$dir = '/images'): void
121121
{
122122
echo make_image($file, $alt, $align, $extras, $dir);
123123
}
@@ -163,7 +163,7 @@ function make_link ($url, $linktext = false, $target = false, $extras = false)
163163
}
164164

165165
// Print a hyperlink to something, within the site
166-
function print_link($url, $linktext = false, $target = false, $extras = false)
166+
function print_link($url, $linktext = false, $target = false, $extras = false): void
167167
{
168168
echo make_link($url, $linktext, $target, $extras);
169169
}
@@ -186,12 +186,12 @@ function make_popup_link ($url, $linktext=false, $target=false, $windowprops="",
186186
// print_popup_link()
187187
// print a hyperlink to something, within the site, that pops up a new window
188188
//
189-
function print_popup_link($url, $linktext=false, $windowprops="", $target=false, $extras=false) {
189+
function print_popup_link($url, $linktext=false, $windowprops="", $target=false, $extras=false): void {
190190
echo make_popup_link($url, $linktext, $windowprops, $target, $extras);
191191
}
192192

193193
// Print a link for a downloadable file (including filesize)
194-
function download_link($file, $title)
194+
function download_link($file, $title): void
195195
{
196196
$download_link = "/distributions/" . $file;
197197

@@ -259,7 +259,7 @@ function clean_note($text)
259259
);
260260
}
261261

262-
function display_errors($errors)
262+
function display_errors($errors): void
263263
{
264264
echo '<div class="errors">';
265265
if (count($errors) > 1) {
@@ -277,7 +277,7 @@ function display_errors($errors)
277277

278278
// Displays an event. Used in event submission
279279
// previews and event information displays
280-
function display_event($event, $include_date = 1)
280+
function display_event($event, $include_date = 1): void
281281
{
282282
global $COUNTRIES;
283283
// Current month (int)($_GET['cm'] ?: 0)
@@ -377,7 +377,7 @@ function display_event($event, $include_date = 1)
377377
}
378378

379379
// Print news links for archives
380-
function news_archive_sidebar()
380+
function news_archive_sidebar(): void
381381
{
382382
global $SIDEBAR_DATA;
383383
$SIDEBAR_DATA = '
@@ -470,7 +470,7 @@ EOT;
470470
return $retval;
471471
}
472472

473-
function site_header($title = '', $config = array())
473+
function site_header($title = '', $config = array()): void
474474
{
475475
global $MYSITE;
476476

@@ -508,7 +508,7 @@ function site_header($title = '', $config = array())
508508

509509
require __DIR__ ."/header.inc";
510510
}
511-
function site_footer($config = array())
511+
function site_footer($config = array()): void
512512
{
513513
require __DIR__ . "/footer.inc";
514514
}
@@ -538,7 +538,7 @@ function get_news_changes()
538538
return false;
539539
}
540540

541-
function news_toc($sections = null) {
541+
function news_toc($sections = null): void {
542542
include __DIR__ . "/pregen-news.inc";
543543
$items = array(
544544
"news" => array(
@@ -571,7 +571,7 @@ function news_toc($sections = null) {
571571
}
572572
}
573573
}
574-
function doc_toc($lang) {
574+
function doc_toc($lang): void {
575575
$file = __DIR__ . "/../manual/$lang/toc/index.inc";
576576
if (!file_exists($file)) {
577577
$lang = "en"; // Fallback on english if the translation doesn't exist
@@ -618,15 +618,15 @@ function doc_toc($lang) {
618618
echo "</dl>";
619619

620620
}
621-
function doc_toc_list($lang, $index, $file) {
621+
function doc_toc_list($lang, $index, $file): void {
622622
include __DIR__ . "/../manual/$lang/toc/$file.inc";
623623

624624
doc_toc_title($lang, $index, $file);
625625
foreach ($TOC as $entry) {
626626
echo "\t<dd><a href='/manual/$lang/{$entry[0]}'>{$entry[1]}</a></dd>\n";
627627
}
628628
}
629-
function doc_toc_title($lang, $index, $file, $elm = "dt") {
629+
function doc_toc_title($lang, $index, $file, $elm = "dt"): void {
630630
foreach ($index as $entry) {
631631
if ($entry[0] == "$file.php") {
632632
$link = $entry[0];

include/prepend.inc

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ header("Content-type: text/html; charset=utf-8");
1515
header("Permissions-Policy: interest-cohort=()");
1616

1717
/* Fix Silly Same Origin Policies */
18-
(function () {
18+
(function (): void {
1919
if (!isset($_SERVER["HTTP_ORIGIN"])) {
2020
return;
2121
}
@@ -94,7 +94,7 @@ include __DIR__ . '/last_updated.inc';
9494
// -----------------------------------------------------------------------------
9595

9696
// Load in the user preferences
97-
function myphpnet_load()
97+
function myphpnet_load(): void
9898
{
9999
global $MYPHPNET, $MYSITE;
100100

@@ -173,7 +173,7 @@ function myphpnet_showug($enable = null) {
173173
}
174174

175175
// Save user settings in cookie
176-
function myphpnet_save()
176+
function myphpnet_save(): void
177177
{
178178
global $MYPHPNET;
179179

@@ -187,7 +187,7 @@ function myphpnet_save()
187187

188188
}
189189

190-
function google_cse() {
190+
function google_cse(): void {
191191
?>
192192
<noscript>
193193
php.net's search functionality requires JavaScript to operate. Please enable

include/results.inc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<?php
2-
function search_results($res, $q, $profile='all', $per_page=10, $s=0, $l='en', $show_title=true, $show_foot=true, $show_attrib=true) {
2+
function search_results($res, $q, $profile='all', $per_page=10, $s=0, $l='en', $show_title=true, $show_foot=true, $show_attrib=true): void {
33
$start_result = $s;
44
$end_result = $s + $res['ResultSet']['totalResultsReturned'] -1;
55

include/shared-manual.inc

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ require_once __DIR__ . '/../autoload.php';
2626
use phpweb\UserNotes\Sorter;
2727

2828
// Print out all user notes for this manual page
29-
function manual_notes($notes) {
29+
function manual_notes($notes): void {
3030
// Get needed values
3131
list($filename) = $GLOBALS['PGI']['this'];
3232

@@ -112,7 +112,7 @@ function manual_notes_load($id)
112112
}
113113

114114
// Print out one user note entry
115-
function manual_note_display($date, $name, $text, $id, $votes = array('up'=>0, 'down'=>0), $voteOption = true)
115+
function manual_note_display($date, $name, $text, $id, $votes = array('up'=>0, 'down'=>0), $voteOption = true): void
116116
{
117117
if ($name) {
118118
$name = "\n <strong class=\"user\"><em>" . htmlspecialchars($name) . "</em></strong>";
@@ -263,7 +263,7 @@ function manual_navigation_methodname($methodname) {
263263

264264
// Set up variables important for this page
265265
// including HTTP header information
266-
function manual_setup($setup) {
266+
function manual_setup($setup): void {
267267
global $PGI, $MYSITE, $USERNOTES;
268268
global $ACTIVE_ONLINE_LANGUAGES;
269269

@@ -389,7 +389,7 @@ CHANGE_LANG;
389389
return trim($r);
390390
}
391391

392-
function manual_footer() {
392+
function manual_footer(): void {
393393
global $USERNOTES, $__RELATED;
394394

395395
manual_notes($USERNOTES);

include/site.inc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ function mirror_type($site = false)
117117
}
118118

119119
// Redirect to an URI on this mirror site or outside this site
120-
function mirror_redirect($absoluteURI)
120+
function mirror_redirect($absoluteURI): void
121121
{
122122
global $MYSITE;
123123

@@ -154,7 +154,7 @@ function mirror_setcookie($name, $content, $exptime)
154154

155155
// Use this function to write out proper headers on
156156
// pages where the content should not be publicly cached
157-
function header_nocache()
157+
function header_nocache(): void
158158
{
159159
// Only try to send out headers in case
160160
// those were not sent already

src/UserNotes/Sorter.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ class Sorter {
1515
private $ratingWeight = 60;
1616
private $ageWeight = 2;
1717

18-
public function sort(array &$notes) {
18+
public function sort(array &$notes): void {
1919
// First we make a pass over the data to get the min and max values
2020
// for data normalization.
2121
$this->findMinMaxValues($notes);
@@ -48,7 +48,7 @@ private function calcRatingPriority(array $note) {
4848
return $note['rating'];
4949
}
5050

51-
private function calcSortPriority(array &$notes) {
51+
private function calcSortPriority(array &$notes): void {
5252
foreach ($notes as &$note) {
5353
$prio = array(
5454
'vote' => $this->calcVotePriority($note) * $this->voteWeight,
@@ -75,7 +75,7 @@ private function factorSort($a, $b) {
7575
return -1;
7676
}
7777

78-
private function findMinMaxValues(array &$notes) {
78+
private function findMinMaxValues(array &$notes): void {
7979
$count = count($notes);
8080
if ($count <= 0) {
8181
return;

0 commit comments

Comments
 (0)