diff --git a/.php-cs-fixer.php b/.php-cs-fixer.php
index bee766f1f5..0d1a5c5400 100644
--- a/.php-cs-fixer.php
+++ b/.php-cs-fixer.php
@@ -19,6 +19,7 @@
->setRiskyAllowed(true)
->setRules([
'array_indentation' => true,
+ 'blank_line_before_statement' => true,
'constant_case' => true,
'indentation_type' => true,
'line_ending' => true,
diff --git a/archive/index.php b/archive/index.php
index 7f2b776bbd..d728471f54 100644
--- a/archive/index.php
+++ b/archive/index.php
@@ -5,6 +5,7 @@
$y = date("Y")-$i;
if (file_exists("./$y.php")) {
mirror_redirect("/archive/$y.php");
+
break;
}
} while (++$i<3);
diff --git a/cal.php b/cal.php
index 9da3e20d12..56c8726d95 100644
--- a/cal.php
+++ b/cal.php
@@ -138,6 +138,7 @@
$month = date('m', $lm);
$monthName = date('F', $lm);
+
return sprintf('%s, %s',
urlencode($month),
urlencode($year),
@@ -155,6 +156,7 @@
$month = date('m', $nm);
$monthName = date('F', $nm);
+
return sprintf('%s, %s',
urlencode($month),
urlencode($year),
@@ -218,6 +220,7 @@ function date_for_recur($recur, $day, $bom, $eom)
if ($recur > 0) {
$bomd = date("w", $bom) + 1;
$days = (($day - $bomd + 7) % 7) + (($recur - 1) * 7);
+
return mktime(0,0,1, date("m",$bom), $days + 1, date("Y",$bom));
}
@@ -268,12 +271,14 @@ function load_event($id)
// we search for (also close the file)
if ($event !== false && $event['id'] == $id) {
fclose($fp);
+
return $event;
}
}
// Close file, and return sign of failure
fclose($fp);
+
return false;
}
@@ -322,6 +327,7 @@ function load_events($from, $whole_month = false)
if ($event['start'] >= $from_date && $event['start'] <= $to_date) {
$events[] = $event;
}
+
break;
// Multi-day event
@@ -331,12 +337,14 @@ function load_events($from, $whole_month = false)
|| ($event['start'] <= $from_date && $event['end'] >= $to_date)) {
$events[] = $event;
}
+
break;
}
}
// Close file and return with results
fclose($fp);
+
return $events;
}
diff --git a/conferences/index.php b/conferences/index.php
index 04fe033886..1d06faba54 100644
--- a/conferences/index.php
+++ b/conferences/index.php
@@ -16,10 +16,12 @@
foreach ($entry["category"] as $category) {
if ($category["term"] == "cfp") {
$frontpage[] = $entry;
+
break;
}
if ($category["term"] == "conferences") {
$frontpage[] = $entry;
+
break;
}
}
diff --git a/error.php b/error.php
index 01d1976787..26c517f74a 100644
--- a/error.php
+++ b/error.php
@@ -122,9 +122,13 @@
// Some nice URLs for getting something for download
if (preg_match("!^get/([^/]+)$!", $URI, $what)) {
switch ($what[1]) {
- case "php" : $URI = "downloads"; break;
+ case "php" : $URI = "downloads";
+
+break;
case "docs" : // intentional
- case "documentation" : $URI = "download-docs"; break;
+ case "documentation" : $URI = "download-docs";
+
+break;
}
}
diff --git a/images/logo.php b/images/logo.php
index ae4d3585ca..3cac365bc0 100644
--- a/images/logo.php
+++ b/images/logo.php
@@ -24,16 +24,20 @@ function imgheader($filename) {
switch ($ext) {
case 'gif':
$hdr = 'image/gif';
+
break;
case 'png':
$hdr = 'image/png';
+
break;
case 'jpg':
case 'jpeg':
$hdr = 'image/jpeg';
+
break;
case 'svg':
$hdr = 'image/svg+xml';
+
break;
default:
return false;
@@ -44,10 +48,12 @@ function imgheader($filename) {
function get_accepted_encodings() {
if (isset($_SERVER['HTTP_ACCEPT_ENCODING'])) {
$encodings = explode(',', $_SERVER['HTTP_ACCEPT_ENCODING']);
+
return array_map(function ($x) {
return trim($x);
}, $encodings);
}
+
return array();
}
@@ -60,6 +66,7 @@ function serve_compressed_if_available($logo): void {
if (file_exists($encoded_file)) {
header("Content-Encoding: $encoding");
readfile($encoded_file);
+
return;
}
}
@@ -74,6 +81,7 @@ function serve_compressed_if_available($logo): void {
case 'QA':
case 'qa':
$logo = './logos/qa.jpg';
+
break;
}
}
diff --git a/images/supported-versions.php b/images/supported-versions.php
index 9fbe87ad6c..edb5c4abad 100644
--- a/images/supported-versions.php
+++ b/images/supported-versions.php
@@ -24,16 +24,19 @@ function branches_to_show() {
}
ksort($branches);
+
return $branches;
}
function min_date() {
$now = new DateTime('January 1');
+
return $now->sub(new DateInterval('P3Y'));
}
function max_date() {
$now = new DateTime('January 1');
+
return $now->add(new DateInterval('P5Y'));
}
@@ -42,6 +45,7 @@ function date_horiz_coord(DateTime $date) {
if (!$diff->invert) {
return $GLOBALS['margin_left'];
}
+
return $GLOBALS['margin_left'] + ($diff->days / (365.24 / $GLOBALS['year_width']));
}
diff --git a/include/branches.inc b/include/branches.inc
index 05063fe393..cced2dd297 100644
--- a/include/branches.inc
+++ b/include/branches.inc
@@ -155,6 +155,7 @@ function get_active_branches($include_recent_eols = true) {
}
ksort($branches);
+
return $branches;
}
@@ -248,6 +249,7 @@ function get_initial_release($branch) {
// Fake a date like we have on the oldreleases array.
$release = $GLOBALS['RELEASES'][$major]["$branch.0"];
$release['date'] = $release['source'][0]['date'];
+
return $release;
}
@@ -279,6 +281,7 @@ function get_final_release($branch) {
// Fake a date like we have on the oldreleases array.
$release = $GLOBALS['RELEASES'][$major][$last];
$release['date'] = $release['source'][0]['date'];
+
return $release;
}
@@ -310,6 +313,7 @@ function get_branch_security_eol_date($branch) {
}
$date = get_branch_release_date($branch);
+
return $date ? $date->add(new DateInterval('P3Y')) : null;
}
diff --git a/include/do-download.inc b/include/do-download.inc
index 33517dd6da..db6eca666c 100644
--- a/include/do-download.inc
+++ b/include/do-download.inc
@@ -16,6 +16,7 @@ function get_actual_download_file($file)
foreach ($possible_files as $name => $log) {
if (@file_exists($_SERVER['DOCUMENT_ROOT'] . '/distributions/' . $name)) {
$found = $name;
+
break;
}
}
diff --git a/include/email-validation.inc b/include/email-validation.inc
index 0c54eade6f..64b41b4d75 100644
--- a/include/email-validation.inc
+++ b/include/email-validation.inc
@@ -4,6 +4,7 @@
function clean_AntiSPAM($email)
{
$remove_spam = "![-_]?(NO|I[-_]?HATE|DELETE|REMOVE)[-_]?(THIS)?(ME|SPAM)?[-_]?!i";
+
return preg_replace($remove_spam, "", trim($email));
}
diff --git a/include/errors.inc b/include/errors.inc
index f4361ec1a3..332a241299 100644
--- a/include/errors.inc
+++ b/include/errors.inc
@@ -498,6 +498,7 @@ function is_known_snippet(string $term): ?string {
];
$term = ltrim(strtolower(trim($term)), '$');
+
return $snippets[$term] ?? null;
}
@@ -513,6 +514,7 @@ function get_legacy_manual_urls(string $uri): array
if (count($matches) < 2) {
return '';
}
+
return $matches[1] ;
}, $uri);
diff --git a/include/get-download.inc b/include/get-download.inc
index 6ae300b431..09a1ae3e3e 100644
--- a/include/get-download.inc
+++ b/include/get-download.inc
@@ -20,6 +20,7 @@ $file = false;
foreach ($possible_files as $name) {
if (@file_exists($_SERVER['DOCUMENT_ROOT'] . '/distributions/' . $name)) {
$file = $name;
+
break;
}
}
diff --git a/include/gpg-keys.inc b/include/gpg-keys.inc
index 48ce9310f3..225c6232b1 100644
--- a/include/gpg-keys.inc
+++ b/include/gpg-keys.inc
@@ -152,8 +152,10 @@ function gpg_key_get_branches(bool $activeOnly): array {
if (!$activeOnly) { return $branches; }
$active = get_active_branches();
+
return array_filter($branches, function ($branch) use ($active) {
[$major] = explode('.', $branch, 2);
+
return isset($active[$major][$branch]);
}, ARRAY_FILTER_USE_KEY);
}
diff --git a/include/ip-to-country.inc b/include/ip-to-country.inc
index 44c7a29a82..b2d375ff0d 100644
--- a/include/ip-to-country.inc
+++ b/include/ip-to-country.inc
@@ -151,14 +151,18 @@ function i2c_search_in_db($ip, $idx)
// We had run out of the indexed region,
// where we expected to find the IP
if ($idx[1] != -1 && $idx[0] > $idx[1]) {
- $country = "NA"; break;
+ $country = "NA";
+
+break;
}
// Try to read record
$record = fread($ipdb, 24);
// Unable to read the record => error
- if (strlen($record) != 24) { $country = "NA"; break; }
+ if (strlen($record) != 24) { $country = "NA";
+
+break; }
// Split the record to it's parts
$range_start = (float) substr($record, 0, 10);
@@ -180,6 +184,7 @@ function i2c_search_in_db($ip, $idx)
function i2c_valid_country()
{
global $COUNTRY, $COUNTRIES;
+
return (!empty($COUNTRY) && $COUNTRY != "NA" && isset($COUNTRIES[$COUNTRY]));
}
@@ -211,6 +216,7 @@ function i2c_realip()
// Also skip RFC 6598 IP's
if (!preg_match('/^(?:10|100\.(?:6[4-9]|[7-9]\d|1[01]\d|12[0-7])|172\.(?:1[6-9]|2\d|3[01])|192\.168)\./', $ips[$i]) && ip2long($ips[$i])) {
$ip = $ips[$i];
+
break;
}
}
diff --git a/include/langchooser.inc b/include/langchooser.inc
index 9b6cd8a0e7..fb8fd3ca41 100644
--- a/include/langchooser.inc
+++ b/include/langchooser.inc
@@ -122,10 +122,18 @@ function language_choose_code()
// Translation table for accept-language codes and phpdoc codes
switch ($langdata[0]) {
- case "pt-br" : $langdata[0] = 'pt_br'; break;
- case "zh-cn" : $langdata[0] = 'zh'; break;
- case "zh-hk" : $langdata[0] = 'hk'; break;
- case "zh-tw" : $langdata[0] = 'tw'; break;
+ case "pt-br" : $langdata[0] = 'pt_br';
+
+break;
+ case "zh-cn" : $langdata[0] = 'zh';
+
+break;
+ case "zh-hk" : $langdata[0] = 'hk';
+
+break;
+ case "zh-tw" : $langdata[0] = 'tw';
+
+break;
}
// We do not support flavors of languages (except the ones above)
@@ -191,6 +199,7 @@ function language_add($langcode, &$langs)
function language_accept_order($a, $b)
{
if ($a[1] == $b[1]) { return 0; }
+
return ($a[1] > $b[1]) ? -1 : 1;
}
diff --git a/include/layout.inc b/include/layout.inc
index 2d4ff63678..c05a07dab2 100644
--- a/include/layout.inc
+++ b/include/layout.inc
@@ -44,6 +44,7 @@ function highlight_php($code, $return = false)
if ($return) { return $highlighted; }
echo $highlighted;
+
return null;
}
@@ -56,6 +57,7 @@ function highlight_php_trimmed($code, $return = false)
if ($return) { return $highlighted_code; }
echo $highlighted_code;
+
return null;
}
@@ -130,6 +132,7 @@ function news_image($URL, $image, $alt, $print = true)
if ($print) {
echo $str;
}
+
return $str;
}
@@ -335,6 +338,7 @@ function display_event($event, $include_date = 1)
case 'multi':
$dtend = date("Y-m-d", strtotime("+1 day", $eday));
echo " (", date("Y-m-d",$sday), " to ", date("Y-m-d",$eday), ")";
+
break;
case 3:
case 'recur':
@@ -346,6 +350,7 @@ function display_event($event, $include_date = 1)
$month = date("M", mktime(0, 0, 0, $cm, 1, $cy));
$dtstart = date("Y-m-d", strtotime($days . ' 0st' .$month. ' ' .$cy));
echo ' (Every ', $days, " of the month)";
+
break;
}
@@ -405,6 +410,7 @@ function print_news($news, $dog, $max = 5, $onlyyear = null, $return = false) {
if (is_null($dog) || in_array($category["term"], (array)$dog, false)) {
$ok = true;
++$count;
+
break;
}
}
@@ -427,6 +433,7 @@ function print_news($news, $dog, $max = 5, $onlyyear = null, $return = false) {
foreach ($item["link"] as $link) {
if ($link["rel"] === "via") {
$permlink = $link["href"];
+
break;
}
}
@@ -439,6 +446,7 @@ function print_news($news, $dog, $max = 5, $onlyyear = null, $return = false) {
$newsdate = date("d M Y", $nixtimestamp);
if ($onlyyear && date("Y", $nixtimestamp) != $onlyyear) {
$count--;
+
continue;
}
@@ -449,6 +457,7 @@ function print_news($news, $dog, $max = 5, $onlyyear = null, $return = false) {
"permlink" => $permlink,
"date" => $newsdate,
);
+
continue;
}
@@ -533,8 +542,10 @@ function get_news_changes()
if ($date->getTimestamp() > $_SERVER["REQUEST_TIME"]) {
$link = preg_replace('~^(http://php.net/|https://www.php.net/)~', '/', $NEWS_ENTRIES[0]["link"][0]["href"]);
$title = $NEWS_ENTRIES[0]["title"];
+
return "{$title}";
}
+
return false;
}
@@ -631,6 +642,7 @@ function doc_toc_title($lang, $index, $file, $elm = "dt") {
if ($entry[0] == "$file.php") {
$link = $entry[0];
$title = $entry[1];
+
break;
}
}
diff --git a/include/manual-lookup.inc b/include/manual-lookup.inc
index 6dcde13211..b8eed37806 100644
--- a/include/manual-lookup.inc
+++ b/include/manual-lookup.inc
@@ -90,6 +90,7 @@ function find_manual_page_slow($lang, $keyword)
// BC: Few references pages where moved to book.
if (strpos($keyword, "ref.") === 0) {
$kw = substr_replace($keyword, "book.", 0, 4);
+
return find_manual_page($lang, $kw);
}
diff --git a/include/prepend.inc b/include/prepend.inc
index 51a7024f33..390ab71e39 100644
--- a/include/prepend.inc
+++ b/include/prepend.inc
@@ -127,6 +127,7 @@ function myphpnet_language($langcode = false)
elseif (isset($MYPHPNET[0]) && $MYPHPNET[0]) {
return $MYPHPNET[0];
}
+
return false;
}
diff --git a/include/shared-manual.inc b/include/shared-manual.inc
index dd43245d19..da5111842e 100644
--- a/include/shared-manual.inc
+++ b/include/shared-manual.inc
@@ -108,6 +108,7 @@ function manual_notes_load($id)
}
fclose($fp);
}
+
return $notes;
}
@@ -213,6 +214,7 @@ function manual_navigation_breadcrumbs(array $setup) {
);
$menu[] = $last_item;
}
+
return $menu;
}
@@ -234,6 +236,7 @@ function manual_navigation_related(array $setup) {
);
$siblings = array(array_merge($last_item, array("children" => $siblings)));
}
+
return $siblings;
}
@@ -373,6 +376,7 @@ function manual_language_chooser($currentlang, $currentpage) {
}
$out .= "$tab\n";
}
+
return trim($out);
};
$r = <<
CHANGE_LANG;
+
return trim($r);
}
@@ -417,8 +422,10 @@ function relTime(DateTime $date) {
continue;
}
$out = $amount . " " . ($amount == 1 ? $unit : $unit . "s") . " ago";
+
break;
}
+
return $out;
}
diff --git a/include/site.inc b/include/site.inc
index 01f8400d2d..d6170a294d 100644
--- a/include/site.inc
+++ b/include/site.inc
@@ -34,6 +34,7 @@ function is_primary_site($site = false)
{
global $MYSITE;
if (!$site) { $site = $MYSITE; }
+
return ($site == "https://www.php.net/" );
}
@@ -50,6 +51,7 @@ function default_language($site = false)
{
global $MIRRORS, $MYSITE;
if (!$site) { $site = $MYSITE; }
+
return (isset($MIRRORS[$site]) ? $MIRRORS[$site][6] : false);
}
@@ -59,6 +61,7 @@ function have_search($site = false)
{
global $MIRRORS, $MYSITE;
if (!$site) { $site = $MYSITE; }
+
return (isset($MIRRORS[$site]) ? $MIRRORS[$site][5] : false);
}
@@ -180,13 +183,16 @@ function get_available_sqlites() {
switch ($driver) {
case 'sqlite':
$avail += 4;
+
break;
case 'sqlite2':
$avail += 8;
+
break;
}
}
}
+
return $avail;
}
diff --git a/include/version.inc b/include/version.inc
index b945572b6f..5c7eff3ced 100644
--- a/include/version.inc
+++ b/include/version.inc
@@ -75,6 +75,7 @@ $RELEASES = (function () {
}
$ret[$major][$version] = $info;
}
+
return $ret;
})();
diff --git a/manual/add-note.php b/manual/add-note.php
index 7db4a4e4b2..de68623559 100644
--- a/manual/add-note.php
+++ b/manual/add-note.php
@@ -23,6 +23,7 @@
foreach ($needed_vars as $varname) {
if (empty($_POST[$varname])) {
$process = false;
+
break;
}
}
@@ -79,6 +80,7 @@
foreach (preg_split("/\\s+/", $note) as $chunk) {
if (strlen($chunk) > 120) {
$error = "Your note contains a bit of text that will result in a line that is too long, even after using wordwrap().";
+
break;
}
}
diff --git a/manual/spam_challenge.php b/manual/spam_challenge.php
index 9a0c353ac7..e3751a53f2 100644
--- a/manual/spam_challenge.php
+++ b/manual/spam_challenge.php
@@ -52,6 +52,7 @@ function test_answer($name, $an, $bn, $answer) {
foreach (CHALLENGES as $x) {
if ($x[0] === $name) {
$c = $x;
+
break;
}
}
diff --git a/releases/index.php b/releases/index.php
index bd16516264..11543b2cac 100644
--- a/releases/index.php
+++ b/releases/index.php
@@ -67,6 +67,7 @@
header('Content-Type: application/json');
echo json_encode($machineReadable);
}
+
return;
}
@@ -175,6 +176,7 @@ function recentEOLBranchesHTML(): string {
}
}
krsort($eol);
+
return implode('', array_slice($eol, 0, 2));
}
diff --git a/search.php b/search.php
index c7b2dce919..d4cd789b0a 100644
--- a/search.php
+++ b/search.php
@@ -26,17 +26,20 @@
case "404quickref" :
$langparam = (isset($EXPL_LANG) ? "&lang=$EXPL_LANG" : "");
mirror_redirect("/manual-lookup.php?pattern={$ucp}{$langparam}&scope={$_FORM['show']}");
+
break;
case "manual":
case "404manual":
mirror_redirect($MYSITE . "results.php?q={$ucp}&p={$_FORM['show']}&l=$LANG");
+
break;
// Covers the rest
default:
$p = urlencode($_FORM['show']);
mirror_redirect($MYSITE . "results.php?q={$ucp}&l=$LANG&p=$p");
+
break;
}
}
diff --git a/security/index.php b/security/index.php
index b0a76835f0..cbe7b25df1 100644
--- a/security/index.php
+++ b/security/index.php
@@ -43,6 +43,7 @@
}
$field = null;
$record_no++;
+
continue;
}
if (preg_match("/^([-\w]+):\s*(.*)/", $s, $m)) {
@@ -84,8 +85,10 @@ function cmp_records($a, $b) {
if ($c > $d) {
return -1;
}
+
return 0;
}
+
return 1;
}
usort($RECORDS, "cmp_records");
diff --git a/src/News/Entry.php b/src/News/Entry.php
index 0d1ee07062..91eaa82003 100755
--- a/src/News/Entry.php
+++ b/src/News/Entry.php
@@ -33,6 +33,7 @@ class Entry {
public function setTitle(string $title): self {
$this->title = $title;
+
return $this;
}
public function setCategories(array $cats): self {
@@ -42,6 +43,7 @@ public function setCategories(array $cats): self {
}
}
$this->categories = $cats;
+
return $this;
}
public function addCategory(string $cat): self {
@@ -51,6 +53,7 @@ public function addCategory(string $cat): self {
if (!in_array($cat, $this->categories, false)) {
$this->categories[] = $cat;
}
+
return $this;
}
@@ -59,6 +62,7 @@ public function isConference(): bool {
}
public function setConfTime(int $time): self {
$this->conf_time = $time;
+
return $this;
}
public function setImage(string $path, string $title, ?string $link): self {
@@ -73,6 +77,7 @@ public function setImage(string $path, string $title, ?string $link): self {
'title' => $title,
'link' => $link,
];
+
return $this;
}
public function setContent(string $content): self {
@@ -80,6 +85,7 @@ public function setContent(string $content): self {
throw new \Exception('Content must not be empty');
}
$this->content = $content;
+
return $this;
}
public function getId(): string {
@@ -189,6 +195,7 @@ private static function ce(\DOMDocument $d, string $name, $value, array $attrs =
if ($to) {
return $to->appendChild($n);
}
+
return $n;
}
}