From 7f14217abbba2f89ae5845d63c8f97b606354f45 Mon Sep 17 00:00:00 2001 From: nsfisis Date: Mon, 20 Jul 2026 05:55:46 +0900 Subject: fix(io): widen IOInterface::select choices to PhpMixed for assoc arrays PHP's IOInterface::select accepts an associative choices array whose keys are the selectable values, but the port narrowed it to Vec, making key-based selection unrepresentable. Accept PhpMixed (List or Array) like PHP's array $choices; ConsoleIO already branched on both shapes internally. Also mirror PHP in the single-select array_search fallback for numeric-keyed arrays. All call sites keep their previous list-based behavior. Co-Authored-By: Claude Fable 5 --- crates/shirabe/tests/io/console_io_test.rs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'crates/shirabe/tests/io/console_io_test.rs') diff --git a/crates/shirabe/tests/io/console_io_test.rs b/crates/shirabe/tests/io/console_io_test.rs index a924f0c7..03307e51 100644 --- a/crates/shirabe/tests/io/console_io_test.rs +++ b/crates/shirabe/tests/io/console_io_test.rs @@ -236,7 +236,10 @@ fn test_select() { let (console_io, _output) = make_console_io_with_answer("item2\n"); let result = console_io.select( "Select item".to_string(), - vec!["item1".to_string(), "item2".to_string()], + PhpMixed::List(vec![ + PhpMixed::String("item1".to_string()), + PhpMixed::String("item2".to_string()), + ]), PhpMixed::String("item1".to_string()), PhpMixed::Bool(false), "Error message".to_string(), -- cgit v1.3.1