From c68e5a9e4a080695cca2087e2957e659faadfd1f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andreas=20M=C3=B6ller?= Date: Tue, 12 Jul 2022 11:44:23 +0200 Subject: [PATCH] Enhancement: Enable `single_space_after_construct` fixer Closes GH-640. --- .php-cs-fixer.php | 1 + archive/index.php | 2 +- cal.php | 4 ++-- conferences/index.php | 6 +++--- download-docs.php | 2 +- error.php | 4 ++-- git-php.php | 4 ++-- index.php | 10 +++++----- js/search-index.php | 4 ++-- manual-lookup.php | 2 +- manual/add-note.php | 2 +- manual/vote-note.php | 2 +- my.php | 2 +- releases/feed.php | 2 +- releases/index.php | 14 +++++++------- security/index.php | 36 ++++++++++++++++++------------------ src/News/Entry.php | 4 ++-- submit-event.php | 2 +- tests/run-tests.php | 2 +- 19 files changed, 53 insertions(+), 52 deletions(-) diff --git a/.php-cs-fixer.php b/.php-cs-fixer.php index f9d0db259..35d2266de 100644 --- a/.php-cs-fixer.php +++ b/.php-cs-fixer.php @@ -12,6 +12,7 @@ $finder = $config->getFinder() $config->setRules([ 'indentation_type' => true, 'no_trailing_whitespace' => true, + 'single_space_after_construct' => true, 'visibility_required' => true, 'whitespace_after_comma_in_array' => true, ]); diff --git a/archive/index.php b/archive/index.php index 7b5aab024..7f2b776bb 100644 --- a/archive/index.php +++ b/archive/index.php @@ -7,7 +7,7 @@ do { mirror_redirect("/archive/$y.php"); break; } -} while(++$i<3); +} while (++$i<3); include_once __DIR__ . '/../include/errors.inc'; error_noservice(); diff --git a/cal.php b/cal.php index 24794d70e..55599eb7e 100644 --- a/cal.php +++ b/cal.php @@ -129,7 +129,7 @@ $bom = mktime(0, 0, 1, $cm, 1, $cy); $eom = mktime(0, 0, 1, $cm+1, 0, $cy); // Link to previous month (but do not link to too early dates) -$prev_link = (function() use ($cm, $cy) { +$prev_link = (function () use ($cm, $cy) { $lm = mktime(0, 0, 1, $cm, 0, $cy); $year = date('Y', $lm); if (!valid_year($year)) { @@ -146,7 +146,7 @@ $prev_link = (function() use ($cm, $cy) { })(); // Link to next month (but do not link to too early dates) -$next_link = (function() use ($cm, $cy) { +$next_link = (function () use ($cm, $cy) { $nm = mktime(0, 0, 1, $cm+1, 1, $cy); $year = date('Y', $nm); if (!valid_year($year)) { diff --git a/conferences/index.php b/conferences/index.php index de805a194..34ae0ed44 100644 --- a/conferences/index.php +++ b/conferences/index.php @@ -13,8 +13,8 @@ site_header("PHP Conferences around the world", array( $content = "
"; $frontpage = array(); -foreach($NEWS_ENTRIES as $entry) { - foreach($entry["category"] as $category) { +foreach ($NEWS_ENTRIES as $entry) { + foreach ($entry["category"] as $category) { if ($category["term"] == "cfp") { $frontpage[] = $entry; break; @@ -28,7 +28,7 @@ foreach($NEWS_ENTRIES as $entry) { $panels = '

Want to see your conference appear here?

'; -foreach($frontpage as $entry) { +foreach ($frontpage as $entry) { $link = preg_replace('~^(http://php.net/|https://www.php.net/)~', '', $entry["id"]); $id = parse_url($entry["id"], PHP_URL_FRAGMENT); $date = date_format(date_create($entry["updated"]), 'Y-m-d'); diff --git a/download-docs.php b/download-docs.php index 0c2e36f47..bdd5d4a24 100644 --- a/download-docs.php +++ b/download-docs.php @@ -91,7 +91,7 @@ $filepath = $filename = ''; // Go through all possible manual languages foreach ($LANGUAGES as $langcode => $language) { - if(isset($INACTIVE_ONLINE_LANGUAGES[$langcode]) && $MYSITE !== 'http://docs.php.net/') { + if (isset($INACTIVE_ONLINE_LANGUAGES[$langcode]) && $MYSITE !== 'http://docs.php.net/') { continue; } diff --git a/error.php b/error.php index ebf8895b5..8de0b2d59 100644 --- a/error.php +++ b/error.php @@ -134,7 +134,7 @@ if (preg_match("!^get/([^/]+)$!", $URI, $what)) { if (preg_match("!^get/([^/]+)/from/([^/]+)(/mirror)?$!", $URI, $dlinfo)) { $df = $dlinfo[1]; - if(strpos($df, "7-LATEST") !== false) { + if (strpos($df, "7-LATEST") !== false) { include_once __DIR__ . "/include/version.inc"; [ $latest ] = release_get_latest(); $df = str_replace("7-LATEST", $latest, $df); @@ -143,7 +143,7 @@ if (preg_match("!^get/([^/]+)/from/([^/]+)(/mirror)?$!", $URI, $dlinfo)) { $mr = "https://www.php.net/"; // Check if that mirror really exists if not, bail out - if(!isset($MIRRORS[$mr])) { + if (!isset($MIRRORS[$mr])) { error_nomirror($mr); exit; } diff --git a/git-php.php b/git-php.php index 2da36b0b9..22ad1b68e 100644 --- a/git-php.php +++ b/git-php.php @@ -48,7 +48,7 @@ if (count($_POST) && (!isset($_POST['purpose']) || !is_array($_POST['purpose']) // Check for errors if (empty($_POST['id'])) { $error .= "You must supply a desired Git user id.
"; - } elseif(!preg_match('!^[a-z]\w+$!', $_POST['id']) || strlen($_POST['id']) > 16) { + } elseif (!preg_match('!^[a-z]\w+$!', $_POST['id']) || strlen($_POST['id']) > 16) { $error .= "Your user id must be from 1-16 characters long, start with ". "a letter and contain nothing but a-z, 0-9, and _
"; } @@ -398,7 +398,7 @@ foreach ($purposes as $i => $p) { ?> >
+ >
>

diff --git a/releases/feed.php b/releases/feed.php index 3967c7c8d..0cd3b6534 100644 --- a/releases/feed.php +++ b/releases/feed.php @@ -18,7 +18,7 @@ echo << "Unknown version"); } } else { - foreach($RELEASES as $major => $release) { + foreach ($RELEASES as $major => $release) { $version = key($release); $r = current($release); $r["version"] = $version; @@ -89,7 +89,7 @@ echo "

$active_majors = array_keys($RELEASES); $latest = max($active_majors); -foreach($OLDRELEASES as $major => $a) { +foreach ($OLDRELEASES as $major => $a) { echo ''; if (!in_array($major, $active_majors)) { echo "\n
\n"; @@ -99,7 +99,7 @@ foreach($OLDRELEASES as $major => $a) { } $i = 0; - foreach($a as $ver => $release) { + foreach ($a as $ver => $release) { $i++; mk_rel( $major, @@ -193,7 +193,7 @@ function mk_rel(int $major, if ($announcement) { if (is_array($announcement)) { - foreach($announcement as $ann => $url) { + foreach ($announcement as $ann => $url) { echo "$ann "; } } else { @@ -212,7 +212,7 @@ function mk_rel(int $major, echo "