[web-php] master: Enhancement: Enable `no_extra_blank_lines` fixer
| From: | Andreas Möller via GitHub | Date: | Tue, 12 Jul 2022 12:32:47 +0000 |
| Subject: | [web-php] master: Enhancement: Enable `no_extra_blank_lines` fixer | ||
| Groups: | php.webmaster | ||
| Request: | Send a blank email to php-webmaster+get-30379@lists.php.net to get a copy of this message | ||
Author: Andreas Möller (localheinz)
Committer: GitHub (web-flow)
Pusher: cmb69
Date: 2022-07-12T14:26:18+02:00
Commit: https://github.com/php/web-php/commit/b3c9551c9386c8f186ed735947089d845aaa6074
Raw diff: https://github.com/php/web-php/commit/b3c9551c9386c8f186ed735947089d845aaa6074.diff
Enhancement: Enable
no_extra_blank_lines fixer
Closes GH-646.
Changed paths:
M .php-cs-fixer.php
M cached.php
M conferences/index.php
M error.php
M images/logo.php
M index.php
M js/search-index.php
M manual/spam_challenge.php
M manual/vote-note.php
M quickref.php
M releases/index.php
M search.php
M security/index.php
M src/News/Entry.php
M src/UserNotes/Sorter.php
Diff:
diff --git a/.php-cs-fixer.php b/.php-cs-fixer.php
index 32034a825..f2ea02380 100644
--- a/.php-cs-fixer.php
+++ b/.php-cs-fixer.php
@@ -15,6 +15,7 @@
'array_indentation' => true,
'indentation_type' => true,
'line_ending' => true,
+ 'no_extra_blank_lines' => true,
'no_trailing_whitespace' => true,
'ordered_class_elements' => true,
'single_space_after_construct' => true,
diff --git a/cached.php b/cached.php
index cc0b9270a..4f731b705 100644
--- a/cached.php
+++ b/cached.php
@@ -32,7 +32,6 @@
$time = filemtime($abs);
}
-
$tsstring = gmdate("D, d M Y H:i:s ", $time) . "GMT";
if (isset($_SERVER["HTTP_IF_MODIFIED_SINCE"]) &&
($_SERVER["HTTP_IF_MODIFIED_SINCE"] == $tsstring)) {
diff --git a/conferences/index.php b/conferences/index.php
index 34ae0ed44..04fe03388 100644
--- a/conferences/index.php
+++ b/conferences/index.php
@@ -3,7 +3,6 @@
include_once __DIR__ . '/../include/prepend.inc';
include_once __DIR__ . '/../include/pregen-news.inc';
-
mirror_setcookie("LAST_NEWS", $_SERVER["REQUEST_TIME"], 60*60*24*365);
site_header("PHP Conferences around the world", array(
'headtags' => '<link rel="alternate"
type="application/atom+xml" title="PHP: Conference announcements"
href="' . $MYSITE . 'feed.atom">',
@@ -27,7 +26,6 @@
}
$panels = '<p class="prepend"><a href="https://wiki.php.net/conferences">Want to
see your conference appear here?</a></p>';
-
foreach ($frontpage as $entry) {
$link = preg_replace('~^(http://php.net/|https://www.php.net/)~', '', $entry["id"]);
$id = parse_url($entry["id"], PHP_URL_FRAGMENT);
diff --git a/error.php b/error.php
index 8de0b2d59..f3bb55053 100644
--- a/error.php
+++ b/error.php
@@ -128,7 +128,6 @@
}
}
-
// ============================================================================
// Nice URLs for download files, so wget works completely well with download links
if (preg_match("!^get/([^/]+)/from/([^/]+)(/mirror)?$!", $URI, $dlinfo)) {
@@ -678,7 +677,6 @@
}
}
-
// ============================================================================
// 404 page for manual pages (eg. not built language)
if (strpos($URI, "manual/") === 0) {
diff --git a/images/logo.php b/images/logo.php
index 394e4e973..ae4d3585c 100644
--- a/images/logo.php
+++ b/images/logo.php
@@ -41,7 +41,6 @@ function imgheader($filename) {
header("Content-Type: $hdr");
}
-
function get_accepted_encodings() {
if (isset($_SERVER['HTTP_ACCEPT_ENCODING'])) {
$encodings = explode(',', $_SERVER['HTTP_ACCEPT_ENCODING']);
@@ -52,7 +51,6 @@ function get_accepted_encodings() {
return array();
}
-
function serve_compressed_if_available($logo): void {
$encodings = get_accepted_encodings();
if (!empty($encodings)) {
diff --git a/index.php b/index.php
index cd1d1dce9..624862881 100644
--- a/index.php
+++ b/index.php
@@ -55,7 +55,6 @@
mirror_setcookie("LAST_NEWS", $_SERVER["REQUEST_TIME"], 60*60*24*365);
-
$content = "<div class='home-content'>";
$frontpage = array();
foreach ($NEWS_ENTRIES as $entry) {
diff --git a/js/search-index.php b/js/search-index.php
index 5c16dd3cc..d0d17a23e 100644
--- a/js/search-index.php
+++ b/js/search-index.php
@@ -45,8 +45,6 @@
header("Content-Type: application/javascript");
/* }}} */
-
-
$s = file_get_contents($indexfile);
$js = json_decode($s, true);
@@ -67,5 +65,4 @@
}
}
-
echo json_encode($index);
diff --git a/manual/spam_challenge.php b/manual/spam_challenge.php
index 7466d8d84..dea89dd66 100644
--- a/manual/spam_challenge.php
+++ b/manual/spam_challenge.php
@@ -47,7 +47,6 @@ function gen_challenge() {
return array($c[0], $an, $bn, $c[1]($c[0], $an, $bn));
}
-
// test an answer for validity
function test_answer($name, $an, $bn, $answer) {
foreach (CHALLENGES as $x) {
diff --git a/manual/vote-note.php b/manual/vote-note.php
index 93ddbef62..a05036387 100644
--- a/manual/vote-note.php
+++ b/manual/vote-note.php
@@ -14,7 +14,6 @@
$link = "/{$BACKpage}#{$BACKid}";
$master_url = "https://main.php.net/entry/user-notes-vote.php";
-
if ($_SERVER['REQUEST_METHOD'] == 'POST') {
if (isset($_SERVER['HTTP_X_JSON']) && $_SERVER['HTTP_X_JSON'] ==
'On' && !empty($_REQUEST['id']) &&
!empty($_REQUEST['page']) && ($N = manual_notes_load($_REQUEST['page']))
&& array_key_exists($_REQUEST['id'], $N) &&
!empty($_REQUEST['vote']) && ($_REQUEST['vote'] === 'up' ||
$_REQUEST['vote'] === 'down')) {
$response = array();
diff --git a/quickref.php b/quickref.php
index 940165521..cb4c757de 100644
--- a/quickref.php
+++ b/quickref.php
@@ -113,7 +113,6 @@ function quickref_table($functions, $sort = true): void
// Note: $notfound is defined (with htmlspecialchars) inside manual-lookup.php
$notfound_enc = urlencode($notfound);
-
if ($snippet = is_known_snippet($notfound)) {
echo "<h1>Related snippet found for '{$notfound}'</h1>";
echo "<p>{$snippet}</p>";
diff --git a/releases/index.php b/releases/index.php
index 897639035..0c928974f 100644
--- a/releases/index.php
+++ b/releases/index.php
@@ -70,8 +70,6 @@
return;
}
-
-
// Human Readable.
site_header("Releases", array(
'current' => 'downloads',
diff --git a/search.php b/search.php
index 6cb23045a..c7b2dce91 100644
--- a/search.php
+++ b/search.php
@@ -28,7 +28,6 @@
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");
diff --git a/security/index.php b/security/index.php
index 5f03aa90c..b0a76835f 100644
--- a/security/index.php
+++ b/security/index.php
@@ -28,7 +28,6 @@
</div>
EOT;
-
site_header("PHP Security center");
echo "<h1>PHP Security Center</h1>\n";
diff --git a/src/News/Entry.php b/src/News/Entry.php
index 69a66a4a6..c94cb0d9b 100755
--- a/src/News/Entry.php
+++ b/src/News/Entry.php
@@ -19,7 +19,6 @@ class Entry {
public const IMAGE_PATH_REL = 'images/news/';
public const IMAGE_PATH_ABS = self::PHPWEB . self::IMAGE_PATH_REL;
-
protected $title = '';
protected $categories = [];
diff --git a/src/UserNotes/Sorter.php b/src/UserNotes/Sorter.php
index e25bfa04b..6d4fa9be6 100644
--- a/src/UserNotes/Sorter.php
+++ b/src/UserNotes/Sorter.php
@@ -36,12 +36,10 @@ public function sort(array &$notes) {
uasort($notes, array($this, 'factorSort'));
}
-
private function calcVotePriority(array $note) {
return ($note['score'] - $this->minVote) * $this->voteFactor + .3;
}
-
private function calcRatingPriority(array $note) {
if ($note['total'] <= 2) {
return 0.5;
@@ -50,7 +48,6 @@ private function calcRatingPriority(array $note) {
return $note['rating'];
}
-
private function calcSortPriority(array &$notes) {
foreach ($notes as &$note) {
$prio = array(
@@ -62,7 +59,6 @@ private function calcSortPriority(array &$notes) {
}
}
-
/*
* Not sure why, but using $b['sort'] - $a['sort'] does not
seem to
* work properly.
@@ -79,7 +75,6 @@ private function factorSort($a, $b) {
return -1;
}
-
private function findMinMaxValues(array &$notes) {
$count = count($notes);
if ($count <= 0) {