diff options
| author | nsfisis <nsfisis@gmail.com> | 2026-07-24 20:23:15 +0900 |
|---|---|---|
| committer | nsfisis <nsfisis@gmail.com> | 2026-07-24 20:23:15 +0900 |
| commit | a0f4c7518ab09de8ebe166d9d3b4d15149a22439 (patch) | |
| tree | 45cd91899d75be9888e70da7cdc7df49bffcb562 | |
| parent | 76c6d132fbc8341bdf14537bba7f00b073eddbc1 (diff) | |
| download | php-shirabe-a0f4c7518ab09de8ebe166d9d3b4d15149a22439.tar.gz php-shirabe-a0f4c7518ab09de8ebe166d9d3b4d15149a22439.tar.zst php-shirabe-a0f4c7518ab09de8ebe166d9d3b4d15149a22439.zip | |
fix(array-dumper): dump source/dist mirrors as a JSON array
ArrayDumper::dump built the mirrors field as PhpMixed::Array keyed by
stringified index ("0", "1", ...), which this codebase's PhpMixed
JSON serialization renders as an object. PHP just assigns the plain,
sequentially-keyed mirrors array directly, which json_encode renders
as a JSON array. Use PhpMixed::List instead, matching the actual
shape written to composer.lock.
| -rw-r--r-- | crates/shirabe/src/package/dumper/array_dumper.rs | 16 | ||||
| -rw-r--r-- | crates/shirabe/tests/installer_test.rs | 4 |
2 files changed, 4 insertions, 16 deletions
diff --git a/crates/shirabe/src/package/dumper/array_dumper.rs b/crates/shirabe/src/package/dumper/array_dumper.rs index 6688ad5e..85021a87 100644 --- a/crates/shirabe/src/package/dumper/array_dumper.rs +++ b/crates/shirabe/src/package/dumper/array_dumper.rs @@ -71,13 +71,7 @@ impl ArrayDumper { { source.insert( "mirrors".to_string(), - PhpMixed::Array( - mirrors - .into_iter() - .enumerate() - .map(|(i, m)| (i.to_string(), mirror_to_php(m))) - .collect(), - ), + PhpMixed::List(mirrors.into_iter().map(mirror_to_php).collect()), ); } data.insert("source".to_string(), PhpMixed::Array(source)); @@ -104,13 +98,7 @@ impl ArrayDumper { { dist.insert( "mirrors".to_string(), - PhpMixed::Array( - mirrors - .into_iter() - .enumerate() - .map(|(i, m)| (i.to_string(), mirror_to_php(m))) - .collect(), - ), + PhpMixed::List(mirrors.into_iter().map(mirror_to_php).collect()), ); } data.insert("dist".to_string(), PhpMixed::Array(dist)); diff --git a/crates/shirabe/tests/installer_test.rs b/crates/shirabe/tests/installer_test.rs index 2a0c4872..7a581a00 100644 --- a/crates/shirabe/tests/installer_test.rs +++ b/crates/shirabe/tests/installer_test.rs @@ -1515,7 +1515,7 @@ pool_optimizer_test! { pool_optimizer_update_installed_alias => "update-installed-alias.test"; pool_optimizer_update_installed_reference_dry_run => "update-installed-reference-dry-run.test"; pool_optimizer_update_installed_reference => "update-installed-reference.test"; - pool_optimizer_update_mirrors_changes_url => "update-mirrors-changes-url.test", ignore = "TODO(phase-d): known-failing fixture under COMPOSER_POOL_OPTIMIZER=1"; + pool_optimizer_update_mirrors_changes_url => "update-mirrors-changes-url.test"; pool_optimizer_update_mirrors_fails_with_new_req => "update-mirrors-fails-with-new-req.test"; pool_optimizer_update_no_dev_still_resolves_dev => "update-no-dev-still-resolves-dev.test"; pool_optimizer_update_no_install => "update-no-install.test"; @@ -1705,7 +1705,7 @@ raw_pool_test! { raw_pool_update_installed_alias => "update-installed-alias.test"; raw_pool_update_installed_reference_dry_run => "update-installed-reference-dry-run.test"; raw_pool_update_installed_reference => "update-installed-reference.test"; - raw_pool_update_mirrors_changes_url => "update-mirrors-changes-url.test", ignore = "TODO(phase-d): known-failing fixture under COMPOSER_POOL_OPTIMIZER=0"; + raw_pool_update_mirrors_changes_url => "update-mirrors-changes-url.test"; raw_pool_update_mirrors_fails_with_new_req => "update-mirrors-fails-with-new-req.test"; raw_pool_update_no_dev_still_resolves_dev => "update-no-dev-still-resolves-dev.test"; raw_pool_update_no_install => "update-no-install.test"; |
