aboutsummaryrefslogtreecommitdiffhomepage
path: root/crates/shirabe/src/util/filesystem.rs
diff options
context:
space:
mode:
authornsfisis <nsfisis@gmail.com>2026-06-21 20:23:04 +0900
committernsfisis <nsfisis@gmail.com>2026-06-21 20:23:04 +0900
commite4402e52c08b8b28497151302c994793ce885cc3 (patch)
treeb1a12dd3941c95d1b64ed4f38a38902eecf2ff18 /crates/shirabe/src/util/filesystem.rs
parentaa270b53045cc1ce779447f4f19448236e9c4c67 (diff)
downloadphp-shirabe-e4402e52c08b8b28497151302c994793ce885cc3.tar.gz
php-shirabe-e4402e52c08b8b28497151302c994793ce885cc3.tar.zst
php-shirabe-e4402e52c08b8b28497151302c994793ce885cc3.zip
refactor(php-shim): drop current()/key()/end() array helpers
PHP's internal array pointer (current/key/end) has no clean Rust equivalent. Remove these todo!() shim stubs and replace each call site with direct first/last element access matching Composer's original behavior. Unblocks Config::merge of anonymous {name: false} disable entries, re-enabling test_add_packagist_repository. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Diffstat (limited to 'crates/shirabe/src/util/filesystem.rs')
-rw-r--r--crates/shirabe/src/util/filesystem.rs4
1 files changed, 2 insertions, 2 deletions
diff --git a/crates/shirabe/src/util/filesystem.rs b/crates/shirabe/src/util/filesystem.rs
index 7a4885a..37ffabb 100644
--- a/crates/shirabe/src/util/filesystem.rs
+++ b/crates/shirabe/src/util/filesystem.rs
@@ -6,7 +6,7 @@ use shirabe_external_packages::symfony::finder::Finder;
use shirabe_php_shim::{
DIRECTORY_SEPARATOR, ErrorException, InvalidArgumentException, LogicException, PhpMixed,
RuntimeException, UnexpectedValueException, array_pop, basename, chdir, clearstatcache,
- clearstatcache2, copy, count, dirname, end, error_get_last, explode, fclose, feof, file_exists,
+ clearstatcache2, copy, count, dirname, error_get_last, explode, fclose, feof, file_exists,
file_get_contents, file_put_contents, fileatime, filemtime, filesize, fopen, fread,
function_exists, fwrite, implode, is_array, is_dir, is_file, is_link, is_readable, lstat,
mkdir, react_promise_resolve, rename, rmdir, rtrim, sprintf, str_contains, str_repeat,
@@ -739,7 +739,7 @@ impl Filesystem {
for chunk in explode("/", &path) {
if ".." == chunk && (strlen(&absolute) > 0 || up) {
array_pop(&mut parts);
- up = !(parts.is_empty() || ".." == end(&parts).unwrap_or_default());
+ up = !(parts.is_empty() || ".." == parts.last().cloned().unwrap_or_default());
} else if "." != chunk && !chunk.is_empty() {
parts.push(chunk.clone());
up = ".." != chunk;