[web-php] master: List syntax (#529)
| From: | Mathias Reker ⚡️ via GitHub | Date: | Tue, 29 Aug 2023 10:34:00 +0000 |
| Subject: | [web-php] master: List syntax (#529) | ||
| Groups: | php.webmaster | ||
| Request: | Send a blank email to php-webmaster+get-30991@lists.php.net to get a copy of this message | ||
Author: Mathias Reker ⚡️ (MathiasReker)
Committer: GitHub (web-flow)
Pusher: kamil-tekiela
Date: 2023-08-29T11:20:33+01:00
Commit: https://github.com/php/web-php/commit/fd62baa267c7c38346e17a2e0d93254534b86d47
Raw diff: https://github.com/php/web-php/commit/fd62baa267c7c38346e17a2e0d93254534b86d47.diff
List syntax (#529)
List (array destructuring) assignment should be declared using the configured syntax.
Changed paths:
M cal.php
M index.php
M mod.php
Diff:
diff --git a/cal.php b/cal.php
index f3fd0c0ab..68b5ca133 100644
--- a/cal.php
+++ b/cal.php
@@ -353,13 +353,13 @@ function read_event($fp)
if (count($linearr) < 13) { return false; }
// Get components
- list(
+ [
$day, $month, $year, $country,
$sdesc, $id, $ldesc, $url, $recur, $tipo, $sdato, $edato, $category
- ) = $linearr;
+ ] = $linearr;
// Get info on recurring event
- @list($recur, $recur_day) = explode(":", $recur, 2);
+ @[$recur, $recur_day] = explode(":", $recur, 2);
// Return with SQL-resultset like array
return [
diff --git a/index.php b/index.php
index c935b2234..c6b6e6b4f 100644
--- a/index.php
+++ b/index.php
@@ -107,7 +107,7 @@
krsort($releases);
foreach ((array)$releases as $release) {
$version = $release['version'];
- list($major, $minor, $_) = explode('.', $version);
+ [$major, $minor, $_] = explode('.', $version);
$intro .= "
<li class='hero-version'><a class='hero-version-link'
href='/downloads.php#v$version'>$version</a> · <a
class='notes' href='/ChangeLog-$major.php#$version'>Changelog</a>
· <a class='notes'
href='/migration$major$minor'>Upgrading</a></li>\n";
}
diff --git a/mod.php b/mod.php
index 0011913d4..226f0d8aa 100644
--- a/mod.php
+++ b/mod.php
@@ -27,7 +27,7 @@
$sites = ["php.net", "lists.php.net"];
// Get data from the URL
-list($none, $site, $token, $sender) = explode("/", $_SERVER["PATH_INFO"]);
+[$none, $site, $token, $sender] = explode("/", $_SERVER["PATH_INFO"]);
// Error in input data
if ($sender == "" || strlen($token) < 32 || !isset($sites[$site])) {