aboutsummaryrefslogtreecommitdiffhomepage
path: root/crates/shirabe-class-map-generator/src
diff options
context:
space:
mode:
authornsfisis <nsfisis@gmail.com>2026-08-17 06:03:41 +0900
committernsfisis <nsfisis@gmail.com>2026-08-17 06:03:41 +0900
commitc81e9f89d9e4388f36a4427bbaa95eced659d2ce (patch)
treecd35eedf6741347e791e6909ec604b89d5e0cff7 /crates/shirabe-class-map-generator/src
parentea39e2301824435d45db88f95867dbe692aaf21e (diff)
downloadphp-shirabe-c81e9f89d9e4388f36a4427bbaa95eced659d2ce.tar.gz
php-shirabe-c81e9f89d9e4388f36a4427bbaa95eced659d2ce.tar.zst
php-shirabe-c81e9f89d9e4388f36a4427bbaa95eced659d2ce.zip
refactor(preg): split the PREG_UNMATCHED_AS_NULL preg_* by flag
preg_match2() and preg_match_all_offset_capture() each become a pair over a shared private impl, and their flags arguments are gone: no caller passed anything but 0 or PREG_UNMATCHED_AS_NULL. Preg::match5()/is_match5() lose their own flags argument for the same reason -- both call sites passed 0, and the value had nowhere left to go -- so they are renumbered to match4()/is_match4(). PREG_UNMATCHED_AS_NULL itself is now unreferenced. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Diffstat (limited to 'crates/shirabe-class-map-generator/src')
-rw-r--r--crates/shirabe-class-map-generator/src/php_file_cleaner.rs5
1 files changed, 2 insertions, 3 deletions
diff --git a/crates/shirabe-class-map-generator/src/php_file_cleaner.rs b/crates/shirabe-class-map-generator/src/php_file_cleaner.rs
index eb2b84e4..c5952389 100644
--- a/crates/shirabe-class-map-generator/src/php_file_cleaner.rs
+++ b/crates/shirabe-class-map-generator/src/php_file_cleaner.rs
@@ -145,11 +145,10 @@ impl PhpFileCleaner {
if end <= self.len && self.contents[self.index..end] == entry.name {
let offset = if self.index > 0 { self.index - 1 } else { 0 };
let mut r#match: IndexMap<CaptureKey, String> = IndexMap::new();
- if Preg::is_match5(
+ if Preg::is_match4(
&entry.pattern,
&self.contents,
Some(&mut r#match),
- 0,
offset,
) {
return clean
@@ -294,6 +293,6 @@ impl PhpFileCleaner {
}
fn r#match(&self, regex: &str, r#match: Option<&mut IndexMap<CaptureKey, String>>) -> bool {
- Preg::is_match5(regex, &self.contents, r#match, 0, self.index)
+ Preg::is_match4(regex, &self.contents, r#match, self.index)
}
}