From 704ba2d87733657dea852fa697fc6d23a961a71b Mon Sep 17 00:00:00 2001 From: nsfisis Date: Mon, 17 Aug 2026 04:18:59 +0900 Subject: refactor(preg): replace Preg::split*() with shim preg_split*() preg_split2()'s limit was always -1 and its flags were always either 0 or PREG_SPLIT_DELIM_CAPTURE alone, so both arguments are gone: the shim now exposes preg_split() and preg_split_delim_capture() over a shared preg_split_impl(). That leaves Preg::split()/split4() as bare pass-throughs, so callers use the shim functions directly and the wrappers are dropped along with the now-unreferenced PREG_SPLIT_* constants. Co-Authored-By: Claude Opus 5 (1M context) --- crates/shirabe/src/repository/vcs/github_driver.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'crates/shirabe/src/repository/vcs/github_driver.rs') diff --git a/crates/shirabe/src/repository/vcs/github_driver.rs b/crates/shirabe/src/repository/vcs/github_driver.rs index 341d9f18..4c0df86a 100644 --- a/crates/shirabe/src/repository/vcs/github_driver.rs +++ b/crates/shirabe/src/repository/vcs/github_driver.rs @@ -19,7 +19,7 @@ use shirabe_php_shim::Catch as _; use shirabe_php_shim::{ InvalidArgumentException, PhpMixed, RuntimeException, array_diff, array_map, array_search_mixed, base64_decode, basename, empty, explode, extension_loaded, in_array_loose, - parse_url, php_regex, strpos, strtolower, substr, trim, urlencode, + parse_url, php_regex, preg_split, strpos, strtolower, substr, trim, urlencode, }; #[derive(Debug)] @@ -493,7 +493,7 @@ impl GitHubDriver { let mut result: Vec> = vec![]; let mut key: Option = None; - for line in Preg::split(php_regex!(r"{\r?\n}"), &funding) { + for line in preg_split(php_regex!(r"{\r?\n}"), &funding) { let line = trim(&line, None); let mut m: IndexMap = IndexMap::new(); if Preg::is_match3(php_regex!(r"{^(\w+)\s*:\s*(.+)$}"), &line, Some(&mut m)) { @@ -508,7 +508,7 @@ impl GitHubDriver { let inner = m2.get(&CaptureKey::ByIndex(1)).cloned().unwrap_or_default(); for item in array_map( |s: &String| trim(s, None), - &Preg::split(php_regex!(r#"{[\'\"]?\s*,\s*[\'\"]?}"#), &inner), + &preg_split(php_regex!(r#"{[\'\"]?\s*,\s*[\'\"]?}"#), &inner), ) { let mut entry = IndexMap::new(); entry.insert("type".to_string(), PhpMixed::String(g1.clone())); -- cgit v1.3.1-4-g156e