diff options
| author | nsfisis <nsfisis@gmail.com> | 2026-06-14 13:12:06 +0900 |
|---|---|---|
| committer | nsfisis <nsfisis@gmail.com> | 2026-06-14 13:12:06 +0900 |
| commit | 614616d4ceeb78dcf22df3e36a0fceb4c2d110c8 (patch) | |
| tree | dc036aca8b4b9d10fb6caf002219759bf93db58f /crates/shirabe-external-packages/src/composer | |
| parent | d7c686f6c488739fc9d061bb0f89d73e6445fade (diff) | |
| download | php-shirabe-614616d4ceeb78dcf22df3e36a0fceb4c2d110c8.tar.gz php-shirabe-614616d4ceeb78dcf22df3e36a0fceb4c2d110c8.tar.zst php-shirabe-614616d4ceeb78dcf22df3e36a0fceb4c2d110c8.zip | |
refactor(pcre): return bool/usize from preg_*2 shim helpers
preg_match2 returns bool and the preg_match_all* helpers return usize
(the match count is never negative), matching how callers use them.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Diffstat (limited to 'crates/shirabe-external-packages/src/composer')
| -rw-r--r-- | crates/shirabe-external-packages/src/composer/pcre/preg.rs | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/crates/shirabe-external-packages/src/composer/pcre/preg.rs b/crates/shirabe-external-packages/src/composer/pcre/preg.rs index d35a3aa..4034649 100644 --- a/crates/shirabe-external-packages/src/composer/pcre/preg.rs +++ b/crates/shirabe-external-packages/src/composer/pcre/preg.rs @@ -50,7 +50,7 @@ impl Preg { *out = drop_null_matches(internal); } - result == 1 + result } pub fn match_all(pattern: &str, subject: &str) -> usize { @@ -234,7 +234,7 @@ impl Preg { } } - result == 1 + result } pub fn is_match_with_indexed_captures(pattern: &str, subject: &str) -> Option<Vec<String>> { @@ -243,7 +243,7 @@ impl Preg { let mut internal: IndexMap<CaptureKey, Option<String>> = IndexMap::new(); let result = shirabe_php_shim::preg_match2(pattern, subject, Some(&mut internal), 0, 0); - if result == 0 { + if !result { return None; } |
