[web-php] master: Enhancement: Enable `blank_line_after_opening_tag` fixer (#875)
| From: | Andreas Möller via GitHub | Date: | Thu, 07 Dec 2023 16:10:59 +0000 |
| Subject: | [web-php] master: Enhancement: Enable `blank_line_after_opening_tag` fixer (#875) | ||
| Groups: | php.webmaster | ||
| Request: | Send a blank email to php-webmaster+get-31261@lists.php.net to get a copy of this message | ||
Author: Andreas Möller (localheinz)
Committer: GitHub (web-flow)
Pusher: kamil-tekiela
Date: 2023-12-07T16:57:19+01:00
Commit: https://github.com/php/web-php/commit/59c070f5570e4c31337557ddeea21c254c77907d
Raw diff: https://github.com/php/web-php/commit/59c070f5570e4c31337557ddeea21c254c77907d.diff
Enhancement: Enable
blank_line_after_opening_tag fixer (#875)
Changed paths:
M .php-cs-fixer.php
M .router.php
M archive/index.php
M backend/index.php
M bin/index.php
M conferences/index.php
M credits.php
M images/elephpants.php
M images/index.php
M include/branches.inc
M include/changelogs.inc
M include/countries.inc
M include/historical_mirrors.inc
M include/index.php
M include/results.inc
M index.php
M js/search-index.php
M manual-lookup.php
M manual/change.php
M manual/index.php
M manual/spam_challenge.php
M mirror-info.php
M mirrors.php
M pear/index.php
M releases/8.0/common.php
M releases/8.0/index.php
M releases/8.1/common.php
M releases/8.1/index.php
M releases/8.2/common.php
M releases/8.2/index.php
M releases/8.3/common.php
M releases/8.3/index.php
M releases/active.php
M releases/feed.php
M releases/index.php
M releases/states.php
M results.php
M search.php
M styles/index.php
Diff:
diff --git a/.php-cs-fixer.php b/.php-cs-fixer.php
index 8cc5bf1f98..67d241ec5e 100644
--- a/.php-cs-fixer.php
+++ b/.php-cs-fixer.php
@@ -24,6 +24,7 @@
'array_syntax' => true,
'binary_operator_spaces' => true,
'blank_line_after_namespace' => true,
+ 'blank_line_after_opening_tag' => true,
'class_attributes_separation' => true,
'class_definition' => true,
'concat_space' => [
diff --git a/.router.php b/.router.php
index ba89a399cb..c204ce635e 100644
--- a/.router.php
+++ b/.router.php
@@ -1,4 +1,5 @@
<?php
+
$_SERVER["SERVER_ADDR"] = $_SERVER["HTTP_HOST"];
$filename = $_SERVER["PATH_INFO"] ?? $_SERVER["SCRIPT_NAME"];
diff --git a/archive/index.php b/archive/index.php
index d3be5d1327..340b121666 100644
--- a/archive/index.php
+++ b/archive/index.php
@@ -1,4 +1,5 @@
<?php
+
include_once __DIR__ . '/../include/prepend.inc';
$i = 0;
do {
diff --git a/backend/index.php b/backend/index.php
index 0a246aefda..b65a57f3f8 100644
--- a/backend/index.php
+++ b/backend/index.php
@@ -1,4 +1,5 @@
<?php
+
// Simulate a /backend shortcut call (which will lead to a manual page)
$_SERVER['REQUEST_URI'] = '/backend';
include_once __DIR__ . '/../include/prepend.inc';
diff --git a/bin/index.php b/bin/index.php
index f3e722c023..50d73f66f6 100644
--- a/bin/index.php
+++ b/bin/index.php
@@ -1,4 +1,5 @@
<?php
+
// Simulate a /bin shortcut call (which will lead to a manual page)
$_SERVER['REQUEST_URI'] = '/bin';
include_once __DIR__ . '/../include/prepend.inc';
diff --git a/conferences/index.php b/conferences/index.php
index a24f52db6d..4ed6dd0627 100644
--- a/conferences/index.php
+++ b/conferences/index.php
@@ -1,4 +1,5 @@
<?php
+
$_SERVER['BASE_PAGE'] = 'conferences/index.php';
include_once __DIR__ . '/../include/prepend.inc';
include_once __DIR__ . '/../include/pregen-news.inc';
diff --git a/credits.php b/credits.php
index 759c00ff52..b652bd652f 100644
--- a/credits.php
+++ b/credits.php
@@ -1,4 +1,5 @@
<?php
+
$_SERVER['BASE_PAGE'] = 'credits.php';
include_once __DIR__ . '/include/prepend.inc';
diff --git a/images/elephpants.php b/images/elephpants.php
index e40835a097..b950c92386 100644
--- a/images/elephpants.php
+++ b/images/elephpants.php
@@ -1,4 +1,5 @@
<?php
+
include_once __DIR__ . '/../include/prepend.inc';
$now = $_SERVER["REQUEST_TIME"];
diff --git a/images/index.php b/images/index.php
index 9e64d3ff53..3c8f520d95 100644
--- a/images/index.php
+++ b/images/index.php
@@ -1,4 +1,5 @@
<?php
+
// Simulate a /images shortcut call (which will lead to a manual page)
$_SERVER['REQUEST_URI'] = '/images';
include_once __DIR__ . '/../include/prepend.inc';
diff --git a/include/branches.inc b/include/branches.inc
index 0cd6b6480c..f141e3ef0e 100644
--- a/include/branches.inc
+++ b/include/branches.inc
@@ -1,4 +1,5 @@
<?php
+
include_once __DIR__ . '/releases.inc';
include_once __DIR__ . '/version.inc';
diff --git a/include/changelogs.inc b/include/changelogs.inc
index a3317ab03d..1a63631438 100644
--- a/include/changelogs.inc
+++ b/include/changelogs.inc
@@ -1,4 +1,5 @@
<?php
+
function bugfix($number): void {
echo "Fixed bug "; bugl($number);
}
diff --git a/include/countries.inc b/include/countries.inc
index 2fc7de63ca..0cb4fe45c6 100644
--- a/include/countries.inc
+++ b/include/countries.inc
@@ -1,4 +1,5 @@
<?php
+
return [
'AFG' => 'Afghanistan',
'ALB' => 'Albania',
diff --git a/include/historical_mirrors.inc b/include/historical_mirrors.inc
index b01c79d6ba..12dca14e54 100644
--- a/include/historical_mirrors.inc
+++ b/include/historical_mirrors.inc
@@ -1,4 +1,5 @@
<?php
+
$historical_mirrors = [
["ARG", "ar2.php.net", "XMundo Hosting Solutions", "http://www.xmundo.net"],
["ARM", "am1.php.net", "ARMINCO Global Telecommunications",
"http://www.arminco.com/"],
diff --git a/include/index.php b/include/index.php
index 793ccc741c..0ca6be8197 100644
--- a/include/index.php
+++ b/include/index.php
@@ -1,4 +1,5 @@
<?php
+
// Simulate a /include shortcut call (which will lead to a manual page)
$_SERVER['REQUEST_URI'] = '/include';
include_once __DIR__ . '/prepend.inc';
diff --git a/include/results.inc b/include/results.inc
index 73ef7f34e8..0181a04ff6 100644
--- a/include/results.inc
+++ b/include/results.inc
@@ -1,4 +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): void {
$start_result = $s;
$end_result = $s + $res['ResultSet']['totalResultsReturned'] - 1;
diff --git a/index.php b/index.php
index 6d0f708c44..3f27c1f734 100644
--- a/index.php
+++ b/index.php
@@ -1,4 +1,5 @@
<?php
+
(function ($uri): void {
// Special redirect cases not able to be captured in error.php
$shortcuts = [
diff --git a/js/search-index.php b/js/search-index.php
index 805f203f42..6fb15b3cb3 100644
--- a/js/search-index.php
+++ b/js/search-index.php
@@ -1,4 +1,5 @@
<?php
+
$_GET["lang"] = "en";
if (!isset($_GET["lang"])) {
header("Location: http://php.net");
diff --git a/manual-lookup.php b/manual-lookup.php
index f07f4f4b06..855267ba23 100644
--- a/manual-lookup.php
+++ b/manual-lookup.php
@@ -1,4 +1,5 @@
<?php
+
$_SERVER['BASE_PAGE'] = 'manual-lookup.php';
include __DIR__ . '/include/prepend.inc';
include __DIR__ . '/include/manual-lookup.inc';
diff --git a/manual/change.php b/manual/change.php
index 71217093ca..f1d376eec7 100644
--- a/manual/change.php
+++ b/manual/change.php
@@ -1,4 +1,5 @@
<?php
+
include_once __DIR__ . '/../include/prepend.inc';
$page = isset($_GET['page']) ? htmlspecialchars($_GET['page'], ENT_QUOTES,
'UTF-8') : '';
diff --git a/manual/index.php b/manual/index.php
index b749d8a628..1a3a03c3ac 100644
--- a/manual/index.php
+++ b/manual/index.php
@@ -1,3 +1,4 @@
<?php
+
include_once __DIR__ . '/../include/prepend.inc';
mirror_redirect("/manual/$LANG/index.php");
diff --git a/manual/spam_challenge.php b/manual/spam_challenge.php
index c19bbbe909..15bf6a5dd7 100644
--- a/manual/spam_challenge.php
+++ b/manual/spam_challenge.php
@@ -1,4 +1,5 @@
<?php
+
// simple and stupid SPAM protection (using little challenges)
const NUMS = ['zero', 'one', 'two', 'three',
'four', 'five', 'six', 'seven', 'eight',
'nine'];
diff --git a/mirror-info.php b/mirror-info.php
index 57273c3b30..d70f72eed1 100644
--- a/mirror-info.php
+++ b/mirror-info.php
@@ -1,4 +1,5 @@
<?php
+
// Define $MYSITE and $LAST_UPDATED variables
include_once __DIR__ . '/include/prepend.inc';
diff --git a/mirrors.php b/mirrors.php
index 61c8b25fee..f43220fd9e 100644
--- a/mirrors.php
+++ b/mirrors.php
@@ -1,4 +1,5 @@
<?php
+
include_once __DIR__ . '/include/prepend.inc';
header("HTTP/1.1 301 Moved Permanently");
diff --git a/pear/index.php b/pear/index.php
index 7b2cb896e4..8022e4c89b 100644
--- a/pear/index.php
+++ b/pear/index.php
@@ -1,4 +1,5 @@
<?php
+
// Simulate a /pear shortcut call (which will lead to a manual page)
$_SERVER['REQUEST_URI'] = '/pear';
include_once __DIR__ . '/../include/prepend.inc';
diff --git a/releases/8.0/common.php b/releases/8.0/common.php
index e24566f300..fd44ea02db 100644
--- a/releases/8.0/common.php
+++ b/releases/8.0/common.php
@@ -1,4 +1,6 @@
-<?php declare(strict_types=1);
+<?php
+
+declare(strict_types=1);
namespace releases\php80;
diff --git a/releases/8.0/index.php b/releases/8.0/index.php
index 08a72b721c..6dc7567c99 100644
--- a/releases/8.0/index.php
+++ b/releases/8.0/index.php
@@ -1,4 +1,5 @@
<?php
+
$_SERVER['BASE_PAGE'] = 'releases/8.0/index.php';
include __DIR__ . '/../../include/site.inc';
diff --git a/releases/8.1/common.php b/releases/8.1/common.php
index 1426de3cf3..ac4a1ad5c1 100644
--- a/releases/8.1/common.php
+++ b/releases/8.1/common.php
@@ -1,4 +1,6 @@
-<?php declare(strict_types=1);
+<?php
+
+declare(strict_types=1);
namespace releases\php81;
diff --git a/releases/8.1/index.php b/releases/8.1/index.php
index 90736f5349..6119a964c4 100644
--- a/releases/8.1/index.php
+++ b/releases/8.1/index.php
@@ -1,4 +1,5 @@
<?php
+
$_SERVER['BASE_PAGE'] = 'releases/8.1/index.php';
include __DIR__ . '/../../include/site.inc';
diff --git a/releases/8.2/common.php b/releases/8.2/common.php
index 829f2df248..beac612b6b 100644
--- a/releases/8.2/common.php
+++ b/releases/8.2/common.php
@@ -1,4 +1,6 @@
-<?php declare(strict_types=1);
+<?php
+
+declare(strict_types=1);
namespace releases\php82;
diff --git a/releases/8.2/index.php b/releases/8.2/index.php
index dc663215f0..4c6a52ae1d 100644
--- a/releases/8.2/index.php
+++ b/releases/8.2/index.php
@@ -1,4 +1,5 @@
<?php
+
$_SERVER['BASE_PAGE'] = 'releases/8.2/index.php';
include __DIR__ . '/../../include/site.inc';
diff --git a/releases/8.3/common.php b/releases/8.3/common.php
index f32f69b730..42af993599 100644
--- a/releases/8.3/common.php
+++ b/releases/8.3/common.php
@@ -1,4 +1,6 @@
-<?php declare(strict_types=1);
+<?php
+
+declare(strict_types=1);
namespace releases\php83;
diff --git a/releases/8.3/index.php b/releases/8.3/index.php
index 3035c038b6..3b56a21417 100644
--- a/releases/8.3/index.php
+++ b/releases/8.3/index.php
@@ -1,4 +1,5 @@
<?php
+
$_SERVER['BASE_PAGE'] = 'releases/8.3/index.php';
include __DIR__ . '/../../include/site.inc';
diff --git a/releases/active.php b/releases/active.php
index 8b0158064f..ca51a637bd 100644
--- a/releases/active.php
+++ b/releases/active.php
@@ -1,4 +1,5 @@
<?php
+
$_SERVER['BASE_PAGE'] = 'releases/active.php';
include_once __DIR__ . '/../include/prepend.inc';
diff --git a/releases/feed.php b/releases/feed.php
index ab72547d9d..709bad633d 100644
--- a/releases/feed.php
+++ b/releases/feed.php
@@ -1,4 +1,5 @@
<?php
+
header("Content-Type: application/atom+xml");
include __DIR__ . "/../include/version.inc";
diff --git a/releases/index.php b/releases/index.php
index 8f7f7c83ed..19babea341 100644
--- a/releases/index.php
+++ b/releases/index.php
@@ -1,4 +1,5 @@
<?php
+
$_SERVER['BASE_PAGE'] = 'releases/index.php';
include_once __DIR__ . '/../include/prepend.inc';
include_once __DIR__ . "/../include/branches.inc";
diff --git a/releases/states.php b/releases/states.php
index 2fc972f6bd..435d7dd2db 100644
--- a/releases/states.php
+++ b/releases/states.php
@@ -1,4 +1,5 @@
<?php
+
$_SERVER['BASE_PAGE'] = 'releases/active.php';
include_once __DIR__ . '/../include/prepend.inc';
diff --git a/results.php b/results.php
index 25c54ca370..7b4893279e 100644
--- a/results.php
+++ b/results.php
@@ -1,4 +1,5 @@
<?php
+
$_SERVER['BASE_PAGE'] = 'results.php';
include __DIR__ . '/include/prepend.inc';
include __DIR__ . '/include/results.inc';
diff --git a/search.php b/search.php
index fb963474c4..45f719fef1 100644
--- a/search.php
+++ b/search.php
@@ -1,4 +1,5 @@
<?php
+
$_SERVER['BASE_PAGE'] = 'search.php';
include_once __DIR__ . '/include/prepend.inc';
diff --git a/styles/index.php b/styles/index.php
index 960d9a9642..c7f1a320c3 100644
--- a/styles/index.php
+++ b/styles/index.php
@@ -1,4 +1,5 @@
<?php
+
// Simulate a /styles shortcut call (which will lead to a manual page)
$_SERVER['REQUEST_URI'] = '/styles';
include_once __DIR__ . '/../include/prepend.inc';