Skip to content

Enhancement: Enable blank_line_before_statement fixer #668

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .php-cs-fixer.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
->setRiskyAllowed(true)
->setRules([
'array_indentation' => true,
'blank_line_before_statement' => true,
'constant_case' => true,
'indentation_type' => true,
'line_ending' => true,
Expand Down
1 change: 1 addition & 0 deletions archive/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
$y = date("Y")-$i;
if (file_exists("./$y.php")) {
mirror_redirect("/archive/$y.php");

break;
}
} while (++$i<3);
Expand Down
8 changes: 8 additions & 0 deletions cal.php
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,7 @@

$month = date('m', $lm);
$monthName = date('F', $lm);

return sprintf('<a href="/cal.php?cm=%s&amp;cy=%s">%s, %s</a>',
urlencode($month),
urlencode($year),
Expand All @@ -155,6 +156,7 @@

$month = date('m', $nm);
$monthName = date('F', $nm);

return sprintf('<a href="/cal.php?cm=%s&amp;cy=%s">%s, %s</a>',
urlencode($month),
urlencode($year),
Expand Down Expand Up @@ -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));
}

Expand Down Expand Up @@ -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;
}

Expand Down Expand Up @@ -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
Expand All @@ -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;
}

Expand Down
2 changes: 2 additions & 0 deletions conferences/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,12 @@
foreach ($entry["category"] as $category) {
if ($category["term"] == "cfp") {
$frontpage[] = $entry;

break;
}
if ($category["term"] == "conferences") {
$frontpage[] = $entry;

break;
}
}
Expand Down
8 changes: 6 additions & 2 deletions error.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
}

Expand Down
8 changes: 8 additions & 0 deletions images/logo.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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();
}

Expand All @@ -60,6 +66,7 @@ function serve_compressed_if_available($logo): void {
if (file_exists($encoded_file)) {
header("Content-Encoding: $encoding");
readfile($encoded_file);

return;
}
}
Expand All @@ -74,6 +81,7 @@ function serve_compressed_if_available($logo): void {
case 'QA':
case 'qa':
$logo = './logos/qa.jpg';

break;
}
}
Expand Down
4 changes: 4 additions & 0 deletions images/supported-versions.php
Original file line number Diff line number Diff line change
Expand Up @@ -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'));
}

Expand All @@ -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']));
}

Expand Down
4 changes: 4 additions & 0 deletions include/branches.inc
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,7 @@ function get_active_branches($include_recent_eols = true) {
}

ksort($branches);

return $branches;
}

Expand Down Expand Up @@ -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;
}

Expand Down Expand Up @@ -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;
}

Expand Down Expand Up @@ -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;
}

Expand Down
1 change: 1 addition & 0 deletions include/do-download.inc
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
}
Expand Down
1 change: 1 addition & 0 deletions include/email-validation.inc
Original file line number Diff line number Diff line change
Expand Up @@ -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));
}

Expand Down
2 changes: 2 additions & 0 deletions include/errors.inc
Original file line number Diff line number Diff line change
Expand Up @@ -498,6 +498,7 @@ function is_known_snippet(string $term): ?string {
];

$term = ltrim(strtolower(trim($term)), '$');

return $snippets[$term] ?? null;
}

Expand All @@ -513,6 +514,7 @@ function get_legacy_manual_urls(string $uri): array
if (count($matches) < 2) {
return '';
}

return $matches[1] ;
}, $uri);

Expand Down
1 change: 1 addition & 0 deletions include/get-download.inc
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ $file = false;
foreach ($possible_files as $name) {
if (@file_exists($_SERVER['DOCUMENT_ROOT'] . '/distributions/' . $name)) {
$file = $name;

break;
}
}
Expand Down
2 changes: 2 additions & 0 deletions include/gpg-keys.inc
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down
10 changes: 8 additions & 2 deletions include/ip-to-country.inc
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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]));
}

Expand Down Expand Up @@ -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;
}
}
Expand Down
17 changes: 13 additions & 4 deletions include/langchooser.inc
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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;
}

Expand Down
Loading