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 /crates/shirabe/src | |
| 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.
Diffstat (limited to 'crates/shirabe/src')
| -rw-r--r-- | crates/shirabe/src/package/dumper/array_dumper.rs | 16 |
1 files changed, 2 insertions, 14 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)); |
