aboutsummaryrefslogtreecommitdiffhomepage
path: root/crates/shirabe/src/repository/filesystem_repository.rs
diff options
context:
space:
mode:
authornsfisis <nsfisis@gmail.com>2026-06-07 11:03:13 +0900
committernsfisis <nsfisis@gmail.com>2026-06-07 11:03:13 +0900
commit3a6e69596d4f45ba1c50c6e932004e2160799d0c (patch)
tree1f7175962e5c043b362fe3e82a46beb8fa2fbb40 /crates/shirabe/src/repository/filesystem_repository.rs
parente1053c6881da1bba409a16783e01a89248507a66 (diff)
downloadphp-shirabe-3a6e69596d4f45ba1c50c6e932004e2160799d0c.tar.gz
php-shirabe-3a6e69596d4f45ba1c50c6e932004e2160799d0c.tar.zst
php-shirabe-3a6e69596d4f45ba1c50c6e932004e2160799d0c.zip
feat(shirabe): resolve phase-b PhpMixed conversion TODOs
Implement self-contained call sites that wrap/unwrap PhpMixed without touching shim bodies: platform-override and authentication IndexMap to PhpMixed conversions, and dev-package-name / version-alias sorts via usort with strcmp/strnatcmp. Drop stale TODO comments where the PhpMixed unwrap was already inlined. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Diffstat (limited to 'crates/shirabe/src/repository/filesystem_repository.rs')
-rw-r--r--crates/shirabe/src/repository/filesystem_repository.rs15
1 files changed, 11 insertions, 4 deletions
diff --git a/crates/shirabe/src/repository/filesystem_repository.rs b/crates/shirabe/src/repository/filesystem_repository.rs
index d9d3289..4e752d9 100644
--- a/crates/shirabe/src/repository/filesystem_repository.rs
+++ b/crates/shirabe/src/repository/filesystem_repository.rs
@@ -284,8 +284,10 @@ impl FilesystemRepository {
}
// PHP: sort($data['dev-package-names']);
- if let Some(PhpMixed::List(_list)) = data.get_mut("dev-package-names") {
- // TODO(phase-b): sort PhpMixed::List in-place using string comparison; PhpMixed: !Ord.
+ if let Some(PhpMixed::List(list)) = data.get_mut("dev-package-names") {
+ usort(list, |a: &Box<PhpMixed>, b: &Box<PhpMixed>| -> i64 {
+ shirabe_php_shim::strcmp(a.as_string().unwrap_or(""), b.as_string().unwrap_or(""))
+ });
}
// PHP: usort($data['packages'], static function ($a, $b): int { return strcmp($a['name'], $b['name']); });
if let Some(PhpMixed::List(list)) = data.get_mut("packages") {
@@ -611,9 +613,14 @@ impl FilesystemRepository {
if let PhpMixed::Array(version_map) = version.as_mut() {
for key in ["aliases", "replaced", "provided"] {
if let Some(boxed) = version_map.get_mut(key) {
- if let PhpMixed::List(_list) = boxed.as_mut() {
+ if let PhpMixed::List(list) = boxed.as_mut() {
// PHP: sort($versions['versions'][$name][$key], SORT_NATURAL);
- // TODO(phase-b): PhpMixed lacks Ord; needs custom comparator.
+ usort(list, |a: &Box<PhpMixed>, b: &Box<PhpMixed>| -> i64 {
+ shirabe_php_shim::strnatcmp(
+ a.as_string().unwrap_or(""),
+ b.as_string().unwrap_or(""),
+ )
+ });
}
}
}