From a01330572b985007acae339817d171a6505bb16b Mon Sep 17 00:00:00 2001 From: nsfisis Date: Tue, 18 Aug 2026 01:57:02 +0900 Subject: refactor(preg): drop the Vec-returning preg_match_all The two preg_match_all variants took the same arguments and differed only in what they returned: a Vec of columns, or the named-and-numbered PregMatchesAll. The latter is the one all but two call sites already used, so preg_match_all2 takes over the plain PHP name and the Vec variant goes away. Its remaining readers only ever wanted group 0's column, which they now take through CaptureKey::ByIndex(0); in the formatter this replaces the array_shift that popped that column off the PREG_PATTERN_ORDER array. Co-Authored-By: Claude Opus 5 (1M context) --- crates/shirabe-symfony-console/src/formatter/output_formatter.rs | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'crates/shirabe-symfony-console/src/formatter') diff --git a/crates/shirabe-symfony-console/src/formatter/output_formatter.rs b/crates/shirabe-symfony-console/src/formatter/output_formatter.rs index 256fade1..f4c55573 100644 --- a/crates/shirabe-symfony-console/src/formatter/output_formatter.rs +++ b/crates/shirabe-symfony-console/src/formatter/output_formatter.rs @@ -135,12 +135,14 @@ impl OutputFormatter { let url = preg_replace(php_regex!("{\\\\([<>])}"), "$1", &r#match[1]); style.set_href(&url); } else if r#match[0] == "options" { - let mut options = preg_match_all( + let options = preg_match_all( php_regex!("([^,;]+)"), &shirabe_php_shim::strtolower(&r#match[1]), ); - let options = shirabe_php_shim::array_shift(&mut options).unwrap_or_default(); - for option in &options { + let options = options + .get(&CaptureKey::ByIndex(0)) + .expect("group 0 is always present"); + for option in options { style.set_option( option .as_deref() -- cgit v1.3.1-4-g156e