aboutsummaryrefslogtreecommitdiffhomepage
path: root/scripts/linters
diff options
context:
space:
mode:
authornsfisis <nsfisis@gmail.com>2026-08-18 01:57:02 +0900
committernsfisis <nsfisis@gmail.com>2026-08-18 01:57:02 +0900
commit403671544a046f17439e1be8a56931c1904f86cd (patch)
tree51d4bad5fc86da15ce7ce0f876f3c2b09ec6507d /scripts/linters
parent90e4f59961a3bfacc37ae4e1a6a6c2b86720bde4 (diff)
downloadphp-shirabe-403671544a046f17439e1be8a56931c1904f86cd.tar.gz
php-shirabe-403671544a046f17439e1be8a56931c1904f86cd.tar.zst
php-shirabe-403671544a046f17439e1be8a56931c1904f86cd.zip
fix(linters): treat array-of-table headers as section boundaries
The Cargo.toml section-header pattern only matched single-bracket headers, so a `[[bench]]` / `[[bin]]` / `[[test]]` table left the previous section active and its keys were attributed to whatever `[dependencies]` block preceded it. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Diffstat (limited to 'scripts/linters')
-rw-r--r--scripts/linters/src/Linters/CargoWorkspaceDependencies.php2
-rw-r--r--scripts/linters/src/Linters/SortedDependencies.php2
2 files changed, 2 insertions, 2 deletions
diff --git a/scripts/linters/src/Linters/CargoWorkspaceDependencies.php b/scripts/linters/src/Linters/CargoWorkspaceDependencies.php
index 3ad86b6f..d50b5f42 100644
--- a/scripts/linters/src/Linters/CargoWorkspaceDependencies.php
+++ b/scripts/linters/src/Linters/CargoWorkspaceDependencies.php
@@ -48,7 +48,7 @@ final class CargoWorkspaceDependencies implements Linter
foreach (file($path) as $idx => $rawLine) {
$stripped = trim($rawLine);
- if (preg_match('/\A\[([^\]]+)\]\z/', $stripped, $m)) {
+ if (preg_match('/\A\[\[?([^\[\]]+)\]\]?\z/', $stripped, $m)) {
$currentSection = $m[1];
continue;
}
diff --git a/scripts/linters/src/Linters/SortedDependencies.php b/scripts/linters/src/Linters/SortedDependencies.php
index 78ea0eb2..7a9fe20c 100644
--- a/scripts/linters/src/Linters/SortedDependencies.php
+++ b/scripts/linters/src/Linters/SortedDependencies.php
@@ -62,7 +62,7 @@ final class SortedDependencies implements Linter
foreach (explode("\n", $content) as $line) {
$stripped = rtrim($line, "\r\n");
- if (preg_match('/\A\s*\[([^\]]+)\]\s*\z/', $stripped, $m)) {
+ if (preg_match('/\A\s*\[\[?([^\[\]]+)\]\]?\s*\z/', $stripped, $m)) {
$current = $m[1];
$sections[$current] ??= [];
continue;