From b7712d3d9db9c097b8d7d2a4b2264b92cce5c55b Mon Sep 17 00:00:00 2001 From: whwyy Date: Wed, 24 Jun 2026 20:21:29 +0800 Subject: [PATCH] eee --- HotReloadState.php | 15 +++++++-------- ScanManifest.php | 7 +++---- 2 files changed, 10 insertions(+), 12 deletions(-) diff --git a/HotReloadState.php b/HotReloadState.php index d78f4e6..75006e0 100644 --- a/HotReloadState.php +++ b/HotReloadState.php @@ -10,13 +10,12 @@ class HotReloadState public function store(array $changedFiles): void { + $normalizedFiles = array_map([$this, 'normalizePath'], array_filter($changedFiles)); + $normalizedFiles = array_values(array_unique($normalizedFiles)); + $payload = [ 'timestamp' => time(), - 'changed_files' => $changedFiles - |> array_filter(...) - |> (fn($x) => array_map([$this, 'normalizePath'], $x)) - |> array_unique(...) - |> array_values(...), + 'changed_files' => $normalizedFiles, ]; $directory = dirname($this->getFilePath()); @@ -50,9 +49,9 @@ class HotReloadState } $files = is_array($data['changed_files'] ?? null) ? $data['changed_files'] : []; - return array_map([$this, 'normalizePath'], $files) - |> array_unique(...) - |> array_values(...); + $files = array_map([$this, 'normalizePath'], $files); + $files = array_values(array_unique($files)); + return $files; } private function getFilePath(): string diff --git a/ScanManifest.php b/ScanManifest.php index 61c45d5..5376476 100644 --- a/ScanManifest.php +++ b/ScanManifest.php @@ -85,10 +85,9 @@ class ScanManifest return array_keys($this->entries); } - return $this->entries - |> array_keys(...) - |> (fn($x) => array_filter($x, fn(string $path) => str_starts_with($path, $prefix))) - |> array_values(...); + $keys = array_keys($this->entries); + $filtered = array_filter($keys, fn(string $path) => str_starts_with($path, $prefix)); + return array_values($filtered); }