diff options
| author | nsfisis <nsfisis@gmail.com> | 2026-08-18 01:57:02 +0900 |
|---|---|---|
| committer | nsfisis <nsfisis@gmail.com> | 2026-08-18 01:57:02 +0900 |
| commit | a01330572b985007acae339817d171a6505bb16b (patch) | |
| tree | cf8e9395a8aa679e3e6c1e8e87bcfee309bc7f6d /crates/shirabe-symfony-console/src/completion/completion_input.rs | |
| parent | cb77f7c7076aa4bac3e6aaa1c164cf9c1d449ddc (diff) | |
| download | php-shirabe-a01330572b985007acae339817d171a6505bb16b.tar.gz php-shirabe-a01330572b985007acae339817d171a6505bb16b.tar.zst php-shirabe-a01330572b985007acae339817d171a6505bb16b.zip | |
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) <noreply@anthropic.com>
Diffstat (limited to 'crates/shirabe-symfony-console/src/completion/completion_input.rs')
| -rw-r--r-- | crates/shirabe-symfony-console/src/completion/completion_input.rs | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/crates/shirabe-symfony-console/src/completion/completion_input.rs b/crates/shirabe-symfony-console/src/completion/completion_input.rs index aafa7c8a..41c15ec5 100644 --- a/crates/shirabe-symfony-console/src/completion/completion_input.rs +++ b/crates/shirabe-symfony-console/src/completion/completion_input.rs @@ -3,7 +3,7 @@ use crate::input::ArgvInput; use crate::input::InputDefinition; use crate::input::InputOption; -use shirabe_php_shim::{PhpMixed, php_regex, preg_match_all}; +use shirabe_php_shim::{CaptureKey, PhpMixed, php_regex, preg_match_all}; /// An input specialized for shell completion. /// @@ -35,7 +35,9 @@ impl CompletionInput { ); Self::from_tokens( - tokens[0] + tokens + .get(&CaptureKey::ByIndex(0)) + .expect("group 0 is always present") .iter() .map(|token| { token |
