aboutsummaryrefslogtreecommitdiffhomepage
path: root/crates/shirabe/src/package
diff options
context:
space:
mode:
authornsfisis <nsfisis@gmail.com>2026-08-17 04:18:59 +0900
committernsfisis <nsfisis@gmail.com>2026-08-17 04:18:59 +0900
commit704ba2d87733657dea852fa697fc6d23a961a71b (patch)
treefd96f0fb4c2fb334a6480088a4c542bd60603f65 /crates/shirabe/src/package
parentdc0cc70f6916810f326d6019a4bec90ca2915904 (diff)
downloadphp-shirabe-704ba2d87733657dea852fa697fc6d23a961a71b.tar.gz
php-shirabe-704ba2d87733657dea852fa697fc6d23a961a71b.tar.zst
php-shirabe-704ba2d87733657dea852fa697fc6d23a961a71b.zip
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) <noreply@anthropic.com>
Diffstat (limited to 'crates/shirabe/src/package')
-rw-r--r--crates/shirabe/src/package/archiver/git_exclude_filter.rs5
-rw-r--r--crates/shirabe/src/package/loader/root_package_loader.rs4
2 files changed, 4 insertions, 5 deletions
diff --git a/crates/shirabe/src/package/archiver/git_exclude_filter.rs b/crates/shirabe/src/package/archiver/git_exclude_filter.rs
index 3dd104ca..e3b35349 100644
--- a/crates/shirabe/src/package/archiver/git_exclude_filter.rs
+++ b/crates/shirabe/src/package/archiver/git_exclude_filter.rs
@@ -2,8 +2,7 @@
use crate::package::archiver::BaseExcludeFilter;
use crate::package::archiver::BaseExcludeFilterBase;
-use shirabe_pcre::Preg;
-use shirabe_php_shim::php_regex;
+use shirabe_php_shim::{php_regex, preg_split};
use std::path::Path;
pub struct GitExcludeFilter {
@@ -36,7 +35,7 @@ impl GitExcludeFilter {
}
fn parse_git_attributes_line_static(line: &str) -> Option<(String, bool, bool)> {
- let parts = Preg::split(php_regex!(r"#\s+#"), line);
+ let parts = preg_split(php_regex!(r"#\s+#"), line);
if parts.len() == 2 && parts[1] == "export-ignore" {
return Some(BaseExcludeFilterBase::generate_pattern(&parts[0]));
diff --git a/crates/shirabe/src/package/loader/root_package_loader.rs b/crates/shirabe/src/package/loader/root_package_loader.rs
index 0ee355f0..58a06ebd 100644
--- a/crates/shirabe/src/package/loader/root_package_loader.rs
+++ b/crates/shirabe/src/package/loader/root_package_loader.rs
@@ -17,7 +17,7 @@ use crate::util::ProcessExecutor;
use indexmap::IndexMap;
use shirabe_pcre::{CaptureKey, Preg};
use shirabe_php_shim::{
- PhpMixed, RuntimeException, UnexpectedValueException, php_regex, strtolower,
+ PhpMixed, RuntimeException, UnexpectedValueException, php_regex, preg_split, strtolower,
};
#[derive(Debug)]
@@ -305,7 +305,7 @@ impl RootPackageLoader {
for (req_name, req_version) in requires {
let mut constraints: Vec<String> = vec![];
- let or_split = Preg::split(php_regex!(r"{\s*\|\|?\s*}"), req_version.trim());
+ let or_split = preg_split(php_regex!(r"{\s*\|\|?\s*}"), req_version.trim());
for or_constraint in &or_split {
let and_split = shirabe_semver::split_and_constraints(or_constraint);
for and_constraint in and_split {