diff options
Diffstat (limited to 'crates/shirabe/src/command')
| -rw-r--r-- | crates/shirabe/src/command/archive_command.rs | 9 | ||||
| -rw-r--r-- | crates/shirabe/src/command/bump_command.rs | 4 | ||||
| -rw-r--r-- | crates/shirabe/src/command/completion_trait.rs | 7 | ||||
| -rw-r--r-- | crates/shirabe/src/command/config_command.rs | 31 | ||||
| -rw-r--r-- | crates/shirabe/src/command/create_project_command.rs | 5 | ||||
| -rw-r--r-- | crates/shirabe/src/command/diagnose_command.rs | 5 | ||||
| -rw-r--r-- | crates/shirabe/src/command/fund_command.rs | 4 | ||||
| -rw-r--r-- | crates/shirabe/src/command/init_command.rs | 18 | ||||
| -rw-r--r-- | crates/shirabe/src/command/package_discovery_trait.rs | 8 | ||||
| -rw-r--r-- | crates/shirabe/src/command/reinstall_command.rs | 4 | ||||
| -rw-r--r-- | crates/shirabe/src/command/repository_command.rs | 4 | ||||
| -rw-r--r-- | crates/shirabe/src/command/show_command.rs | 11 | ||||
| -rw-r--r-- | crates/shirabe/src/command/update_command.rs | 8 |
13 files changed, 48 insertions, 70 deletions
diff --git a/crates/shirabe/src/command/archive_command.rs b/crates/shirabe/src/command/archive_command.rs index f2f26702..e10601ac 100644 --- a/crates/shirabe/src/command/archive_command.rs +++ b/crates/shirabe/src/command/archive_command.rs @@ -26,7 +26,7 @@ use crate::util::Platform; use crate::util::ProcessExecutor; use crate::util::r#loop::Loop; use indexmap::IndexMap; -use shirabe_php_shim::{LogicException, get_debug_type, impl_php_class, php_regex, preg_match2}; +use shirabe_php_shim::{LogicException, get_debug_type, impl_php_class, php_regex, preg_match}; use shirabe_symfony_console::command::Command; use shirabe_symfony_console::input::InputInterface; use shirabe_symfony_console::output::OutputInterface; @@ -228,11 +228,8 @@ impl ArchiveCommand { } if let Some(version_str) = &version - && let Some(matches) = preg_match2( - php_regex!(r"{@(stable|RC|beta|alpha|dev)$}i"), - version_str, - 0, - ) + && let Some(matches) = + preg_match(php_regex!(r"{@(stable|RC|beta|alpha|dev)$}i"), version_str) { let m1 = matches.get(1).unwrap_or_default().to_string(); let m0 = matches.get(0).unwrap_or_default().to_string(); diff --git a/crates/shirabe/src/command/bump_command.rs b/crates/shirabe/src/command/bump_command.rs index db4888c7..3c75c937 100644 --- a/crates/shirabe/src/command/bump_command.rs +++ b/crates/shirabe/src/command/bump_command.rs @@ -18,7 +18,7 @@ use crate::util::Filesystem; use crate::util::Silencer; use shirabe_php_shim::{ PhpMixed, file_get_contents, file_put_contents, impl_php_class, is_writable, php_regex, - preg_match2, preg_replace, strtolower, + preg_match, preg_replace, strtolower, }; use shirabe_symfony_console::command::Command; use shirabe_symfony_console::input::InputInterface; @@ -186,7 +186,7 @@ impl BumpCommand { .collect(); let pattern = base_package::package_names_to_regexp(&unique_lower, "{^(?:%s)$}iD"); for (key, reqs) in tasks.iter_mut() { - reqs.retain(|pkg_name, _| preg_match2(&pattern, pkg_name, 0).is_some()); + reqs.retain(|pkg_name, _| preg_match(&pattern, pkg_name).is_some()); } packages_filter } else { diff --git a/crates/shirabe/src/command/completion_trait.rs b/crates/shirabe/src/command/completion_trait.rs index ce0aef58..eda80164 100644 --- a/crates/shirabe/src/command/completion_trait.rs +++ b/crates/shirabe/src/command/completion_trait.rs @@ -11,7 +11,7 @@ use crate::repository::RepositoryInterfaceHandle; use crate::repository::RootPackageRepository; use crate::repository::repository_interface::{SEARCH_NAME, SEARCH_VENDOR, SearchResult}; use indexmap::IndexMap; -use shirabe_php_shim::{PhpMixed, php_regex, preg_match2, preg_quote}; +use shirabe_php_shim::{PhpMixed, php_regex, preg_match, preg_quote}; /// Adds completion to arguments and options. /// @@ -256,10 +256,9 @@ pub trait CompletionTrait: BaseCommand { /// platform packages from the ones available on the currently-running PHP fn suggest_available_package_incl_platform(&self) -> SuggestedValues { SuggestedValues::Closure(Box::new(|this, input, suggestions| { - let matches = if preg_match2( + let matches = if preg_match( php_regex!(r"{^(ext|lib|php)(-|$)|^com}"), &input.get_completion_value(), - 0, ) .is_some() { @@ -297,7 +296,7 @@ pub trait CompletionTrait: BaseCommand { let mut names: Vec<String> = vec![]; for package in repos.get_packages()? { let name = package.get_name(); - if preg_match2(pattern.clone(), &name, 0).is_some() { + if preg_match(pattern.clone(), &name).is_some() { names.push(name); } } diff --git a/crates/shirabe/src/command/config_command.rs b/crates/shirabe/src/command/config_command.rs index 7bf091a1..f1eb14b0 100644 --- a/crates/shirabe/src/command/config_command.rs +++ b/crates/shirabe/src/command/config_command.rs @@ -22,7 +22,7 @@ use shirabe_php_shim::{ InvalidArgumentException, PhpMixed, RuntimeException, array_is_list, array_merge, escapeshellcmd, exec, explode, file_exists, impl_php_class, implode, in_array_loose, in_array_strict, is_array, is_bool, is_dir, is_numeric, is_object, is_string, json_encode, - php_regex, preg_match2, preg_replace, str_replace, strpos, strtolower, system, touch, + php_regex, preg_match, preg_replace, str_replace, strpos, strtolower, system, touch, var_export, }; use shirabe_semver::VersionParser; @@ -701,10 +701,9 @@ impl Command for ConfigCommand { let mut source = config.borrow_mut().get_source_of_value(&setting_key); let mut value: PhpMixed; - if let Some(matches) = preg_match2( + if let Some(matches) = preg_match( php_regex!("/^repos?(?:itories)?(?:\\.(.+))?/"), &setting_key, - 0, ) { if matches.get(1).is_none() { value = data @@ -925,9 +924,7 @@ impl Command for ConfigCommand { return Ok(0); } // handle preferred-install per-package config - if let Some(matches) = - preg_match2(php_regex!("/^preferred-install\\.(.+)/"), &setting_key, 0) - { + if let Some(matches) = preg_match(php_regex!("/^preferred-install\\.(.+)/"), &setting_key) { if input.borrow().get_option("unset")?.as_bool() == Some(true) { self.config_source .borrow_mut() @@ -960,10 +957,9 @@ impl Command for ConfigCommand { } // handle allow-plugins config setting elements true or false to add/remove - if let Some(matches) = preg_match2( + if let Some(matches) = preg_match( php_regex!("{^allow-plugins\\.([a-zA-Z0-9/*-]+)}"), &setting_key, - 0, ) { if input.borrow().get_option("unset")?.as_bool() == Some(true) { self.config_source @@ -1029,8 +1025,7 @@ impl Command for ConfigCommand { } // handle repositories - if let Some(matches) = - preg_match2(php_regex!("/^repos?(?:itories)?\\.(.+)/"), &setting_key, 0) + if let Some(matches) = preg_match(php_regex!("/^repos?(?:itories)?\\.(.+)/"), &setting_key) { if input.borrow().get_option("unset")?.as_bool() == Some(true) { self.config_source @@ -1099,7 +1094,7 @@ impl Command for ConfigCommand { } // handle extra - if let Some(matches) = preg_match2(php_regex!("/^extra\\.(.+)/"), &setting_key, 0) { + if let Some(matches) = preg_match(php_regex!("/^extra\\.(.+)/"), &setting_key) { if input.borrow().get_option("unset")?.as_bool() == Some(true) { self.config_source .borrow_mut() @@ -1171,7 +1166,7 @@ impl Command for ConfigCommand { } // handle suggest - if let Some(matches) = preg_match2(php_regex!("/^suggest\\.(.+)/"), &setting_key, 0) { + if let Some(matches) = preg_match(php_regex!("/^suggest\\.(.+)/"), &setting_key) { if input.borrow().get_option("unset")?.as_bool() == Some(true) { self.config_source .borrow_mut() @@ -1205,7 +1200,7 @@ impl Command for ConfigCommand { } // handle platform - if let Some(matches) = preg_match2(php_regex!("/^platform\\.(.+)/"), &setting_key, 0) { + if let Some(matches) = preg_match(php_regex!("/^platform\\.(.+)/"), &setting_key) { if input.borrow().get_option("unset")?.as_bool() == Some(true) { self.config_source .borrow_mut() @@ -1322,12 +1317,11 @@ impl Command for ConfigCommand { } // handle auth - if let Some(matches) = preg_match2( + if let Some(matches) = preg_match( php_regex!( "/^(bitbucket-oauth|github-oauth|gitlab-oauth|gitlab-token|http-basic|custom-headers|bearer|forgejo-token)\\.(.+)/" ), &setting_key, - 0, ) { if input.borrow().get_option("unset")?.as_bool() == Some(true) { self.auth_config_source @@ -1455,7 +1449,7 @@ impl Command for ConfigCommand { } // Check if the header is in correct "Name: Value" format - if preg_match2(php_regex!("/^[^:]+:\\s*.+$/"), header, 0).is_none() { + if preg_match(php_regex!("/^[^:]+:\\s*.+$/"), header).is_none() { return Err(RuntimeException::new(format!( "Header \"{}\" is not in \"Header-Name: Header-Value\" format", header @@ -1503,7 +1497,7 @@ impl Command for ConfigCommand { } // handle script - if let Some(matches) = preg_match2(php_regex!("/^scripts\\.(.+)/"), &setting_key, 0) { + if let Some(matches) = preg_match(php_regex!("/^scripts\\.(.+)/"), &setting_key) { if input.borrow().get_option("unset")?.as_bool() == Some(true) { self.config_source .borrow_mut() @@ -1742,10 +1736,9 @@ fn build_unique_config_values() -> IndexMap<String, (ValidatorFn, NormalizerFn)> ( Box::new(|val| { PhpMixed::Bool( - preg_match2( + preg_match( php_regex!("/^\\s*([0-9.]+)\\s*(?:([kmg])(?:i?b)?)?\\s*$/i"), val.as_string().unwrap_or(""), - 0, ) .is_some(), ) diff --git a/crates/shirabe/src/command/create_project_command.rs b/crates/shirabe/src/command/create_project_command.rs index fbdcfabb..b2842d9d 100644 --- a/crates/shirabe/src/command/create_project_command.rs +++ b/crates/shirabe/src/command/create_project_command.rs @@ -41,7 +41,7 @@ use shirabe_php_shim::Catch as _; use shirabe_php_shim::{ InvalidArgumentException, PhpMixed, RuntimeException, UnexpectedValueException, array_pop, chdir, explode_with_limit, file_exists, getcwd, impl_php_class, implode, is_dir, is_file, - mkdir, preg_match2, realpath, rtrim, strtolower, unlink, + mkdir, preg_match, realpath, rtrim, strtolower, unlink, }; use shirabe_symfony_console::command::Command; use shirabe_symfony_console::input::InputInterface; @@ -525,7 +525,7 @@ impl CreateProjectCommand { if package_version.is_none() { stability = Some("stable".to_string()); } else { - let matched = preg_match2( + let matched = preg_match( format!( "{{^[^,\\s]*?@({})$}}i", implode( @@ -537,7 +537,6 @@ impl CreateProjectCommand { ) ), package_version.as_deref().unwrap_or(""), - 0, ); if let Some(matched) = matched { stability = Some(matched.get(1).unwrap_or_default().to_string()); diff --git a/crates/shirabe/src/command/diagnose_command.rs b/crates/shirabe/src/command/diagnose_command.rs index f7f84575..860c058b 100644 --- a/crates/shirabe/src/command/diagnose_command.rs +++ b/crates/shirabe/src/command/diagnose_command.rs @@ -37,7 +37,7 @@ use shirabe_php_shim::PhpClass as _; use shirabe_php_shim::{ AnyThrowable, Catch as _, CmpOp, InvalidArgumentException, PHP_EOL, PhpMixed, RuntimeException, disk_free_space, file_exists, filter_var_boolean, hash, impl_php_class, implode, is_array, - is_string, php_regex, preg_match2, rtrim, str_replace, strpos, strstr, strstr3, strtolower, + is_string, php_regex, preg_match, rtrim, str_replace, strpos, strstr, strstr3, strtolower, trim, version_compare, }; use shirabe_symfony_console::command::Command; @@ -861,10 +861,9 @@ impl DiagnoseCommand { warnings.insert("zlib".to_string(), PhpMixed::Bool(true)); } - if let Some(phpinfo_match) = preg_match2( + if let Some(phpinfo_match) = preg_match( php_regex!("{Configure Command(?: *</td><td class=\"v\">| *=> *)(.*?)(?:</td>|$)}m"), &diagnostics.phpinfo_general, - 0, ) { let configure = phpinfo_match.get(1).unwrap_or_default().to_string(); let configure = configure.as_str(); diff --git a/crates/shirabe/src/command/fund_command.rs b/crates/shirabe/src/command/fund_command.rs index ea077ef5..089f69e8 100644 --- a/crates/shirabe/src/command/fund_command.rs +++ b/crates/shirabe/src/command/fund_command.rs @@ -10,7 +10,7 @@ use crate::package::base_package::{self}; use crate::repository::CompositeRepository; use crate::repository::RepositoryInterface; use indexmap::IndexMap; -use shirabe_php_shim::{PhpMixed, impl_php_class, php_regex, preg_match2}; +use shirabe_php_shim::{PhpMixed, impl_php_class, php_regex, preg_match}; use shirabe_semver::constraint::AnyConstraint; use shirabe_semver::constraint::MatchAllConstraint; use shirabe_symfony_console::command::Command; @@ -63,7 +63,7 @@ impl FundCommand { .unwrap_or(""); if r#type == "github" && let Some(matches) = - preg_match2(php_regex!(r"{^https://github.com/([^/]+)$}"), &url, 0) + preg_match(php_regex!(r"{^https://github.com/([^/]+)$}"), &url) && let Some(sponsor) = matches.get(1).map(str::to_string) { url = format!("https://github.com/sponsors/{}", sponsor); diff --git a/crates/shirabe/src/command/init_command.rs b/crates/shirabe/src/command/init_command.rs index b316e4fe..3ca6c0fb 100644 --- a/crates/shirabe/src/command/init_command.rs +++ b/crates/shirabe/src/command/init_command.rs @@ -24,7 +24,7 @@ use shirabe_php_shim::{ CaptureKey, FILE_IGNORE_NEW_LINES, InvalidArgumentException, PHP_EOL, PHP_SERVER, PhpMixed, array_flip_strings, array_intersect_key, array_map, basename, empty, explode, file, file_exists, file_get_contents, file_put_contents, get_current_user, impl_php_class, implode, - is_dir, is_string, php_regex, preg_match_all, preg_match2, preg_quote, preg_replace, realpath, + is_dir, is_string, php_regex, preg_match, preg_match_all, preg_quote, preg_replace, realpath, str_replace, strpos, strtolower, trim, ucwords, }; use shirabe_spdx_licenses::SpdxLicenses; @@ -89,10 +89,9 @@ impl InitCommand { &self, author: &str, ) -> anyhow::Result<IndexMap<String, Option<String>>> { - if let Some(m) = preg_match2( + if let Some(m) = preg_match( php_regex!(r#"/^(?P<name>[- .,\p{L}\p{N}\p{Mn}\'’\"()]+)(?:\s+<(?P<email>.+?)>)?$/u"#), author, - 0, ) { let email = m.name("email").map(str::to_string); if let Some(ref email) = email @@ -210,7 +209,7 @@ impl InitCommand { let lines = file(ignore_file, FILE_IGNORE_NEW_LINES).unwrap_or_default(); for line in &lines { - if preg_match2(&pattern, line, 0).is_some() { + if preg_match(&pattern, line).is_some() { return true; } } @@ -498,13 +497,12 @@ impl Command for InitCommand { }); if options.contains_key("name") - && preg_match2( + && preg_match( php_regex!(r"{^[a-z0-9]([_.-]?[a-z0-9]+)*\/[a-z0-9](([_.]|-{1,2})?[a-z0-9]+)*$}D"), options .get("name") .and_then(|v| v.as_string()) .unwrap_or(""), - 0, ) .is_none() { @@ -910,11 +908,7 @@ impl Command for InitCommand { return Ok(PhpMixed::String(name_for_validate.clone())); } - if preg_match2( - php_regex!(r"{^[a-z0-9]([_.-]?[a-z0-9]+)*\/[a-z0-9](([_.]|-{1,2})?[a-z0-9]+)*$}D"), - value.as_string().unwrap_or(""), - 0, - ) + if preg_match(php_regex!(r"{^[a-z0-9]([_.-]?[a-z0-9]+)*\/[a-z0-9](([_.]|-{1,2})?[a-z0-9]+)*$}D"), value.as_string().unwrap_or("")) .is_none() { return Err(InvalidArgumentException::new(format!( @@ -1226,7 +1220,7 @@ impl Command for InitCommand { value_str }; - if preg_match2(php_regex!(r"{^[^/][A-Za-z0-9\-_/]+/$}"), &value_or_default, 0) + if preg_match(php_regex!(r"{^[^/][A-Za-z0-9\-_/]+/$}"), &value_or_default) .is_none() { return Err(InvalidArgumentException::new(format!( diff --git a/crates/shirabe/src/command/package_discovery_trait.rs b/crates/shirabe/src/command/package_discovery_trait.rs index a5b606a8..8e25c1b9 100644 --- a/crates/shirabe/src/command/package_discovery_trait.rs +++ b/crates/shirabe/src/command/package_discovery_trait.rs @@ -23,7 +23,7 @@ use shirabe_php_shim::Catch as _; use shirabe_php_shim::{ Exception, InvalidArgumentException, LogicException, PHP_EOL, PhpMixed, array_keys, array_slice, asort, explode, file_get_contents, implode, in_array_strict, is_array, is_file, - is_numeric, json_decode_assoc, levenshtein, php_regex, preg_match2, strlen, strpos, trim, + is_numeric, json_decode_assoc, levenshtein, php_regex, preg_match, strlen, strpos, trim, }; use shirabe_symfony_console::input::InputInterface; use shirabe_symfony_console::output::OutputInterface; @@ -143,10 +143,9 @@ pub trait PackageDiscoveryTrait: BaseCommand { for mut requirement in requires_norm { if requirement.contains_key("version") - && preg_match2( + && preg_match( php_regex!(r"{^\d+(\.\d+)?$}"), requirement.get("version").map(|s| s.as_str()).unwrap_or(""), - 0, ) .is_some() { @@ -331,10 +330,9 @@ pub trait PackageDiscoveryTrait: BaseCommand { } } - if let Some(m) = preg_match2( + if let Some(m) = preg_match( php_regex!(r"{^\s*(?P<name>[\S/]+)(?:\s+(?P<version>\S+))?\s*$}"), &selection, - 0, ) { if let Some(v) = m.name("version").map(str::to_string) { // parsing `acme/example ~2.3` diff --git a/crates/shirabe/src/command/reinstall_command.rs b/crates/shirabe/src/command/reinstall_command.rs index 05c277d5..d0b36778 100644 --- a/crates/shirabe/src/command/reinstall_command.rs +++ b/crates/shirabe/src/command/reinstall_command.rs @@ -15,7 +15,7 @@ use crate::plugin::CommandEvent; use crate::plugin::PluginEvents; use crate::script::ScriptEvents; use crate::util::Platform; -use shirabe_php_shim::{InvalidArgumentException, impl_php_class, preg_match2}; +use shirabe_php_shim::{InvalidArgumentException, impl_php_class, preg_match}; use shirabe_symfony_console::command::Command; use shirabe_symfony_console::input::InputInterface; use shirabe_symfony_console::output::OutputInterface; @@ -136,7 +136,7 @@ impl Command for ReinstallCommand { let pattern_regexp = base_package::package_name_to_regexp(pattern); let mut matched = false; for package in local_repo.get_canonical_packages()? { - if preg_match2(&pattern_regexp, &package.get_name(), 0).is_some() { + if preg_match(&pattern_regexp, &package.get_name()).is_some() { matched = true; package_names_to_reinstall.push(package.get_name()); packages_to_reinstall.push(package); diff --git a/crates/shirabe/src/command/repository_command.rs b/crates/shirabe/src/command/repository_command.rs index bbd1eace..daeaaf74 100644 --- a/crates/shirabe/src/command/repository_command.rs +++ b/crates/shirabe/src/command/repository_command.rs @@ -12,7 +12,7 @@ use crate::json::JsonFile; use indexmap::IndexMap; use shirabe_php_shim::{ InvalidArgumentException, PhpMixed, RuntimeException, impl_php_class, parse_url, php_regex, - preg_match2, strtolower, + preg_match, strtolower, }; use shirabe_symfony_console::command::Command; use shirabe_symfony_console::input::InputInterface; @@ -368,7 +368,7 @@ impl Command for RepositoryCommand { .into()); } let arg1_str = arg1.as_deref().unwrap(); - let repo_config: PhpMixed = if preg_match2(php_regex!(r"{^\s*\{}"), arg1_str, 0) + let repo_config: PhpMixed = if preg_match(php_regex!(r"{^\s*\{}"), arg1_str) .is_some() { JsonFile::parse_json(Some(arg1_str), None)? diff --git a/crates/shirabe/src/command/show_command.rs b/crates/shirabe/src/command/show_command.rs index e8072ca8..acb4f5c8 100644 --- a/crates/shirabe/src/command/show_command.rs +++ b/crates/shirabe/src/command/show_command.rs @@ -39,7 +39,7 @@ use indexmap::IndexMap; use shirabe_php_shim::{ CmpOp, DATE_ATOM, InvalidArgumentException, LogicException, PhpMixed, UnexpectedValueException, array_search, date_format_to_strftime, date_local, extension_loaded, impl_php_class, - in_array_loose, in_array_strict, php_regex, preg_match2, preg_quote, preg_replace, realpath, + in_array_loose, in_array_strict, php_regex, preg_match, preg_quote, preg_replace, realpath, strtolower, version_compare, }; use shirabe_semver::Semver; @@ -1373,10 +1373,9 @@ impl ShowCommand { if target_version.is_none() { if major_only - && let Some(groups) = preg_match2( + && let Some(groups) = preg_match( php_regex!(r"{^(?P<zero_major>(?:0\.)+)?(?P<first_meaningful>\d+)\.}"), &package.get_version(), - 0, ) { let zero_major = groups.name("zero_major").unwrap_or_default().to_string(); @@ -2342,7 +2341,7 @@ impl Command for ShowCommand { } let matches_filter = match &package_filter_regex { None => true, - Some(r) => preg_match2(r, &p.get_name(), 0).is_some(), + Some(r) => preg_match(r, &p.get_name()).is_some(), }; if matches_filter { let matches_list = match &package_list_filter { @@ -2421,7 +2420,7 @@ impl Command for ShowCommand { if show_latest && *show_version { for package_or_name in type_packages.values() { if let PackageOrName::Pkg(package) = package_or_name - && preg_match2(&ignored_packages_regex, &package.get_pretty_name(), 0) + && preg_match(&ignored_packages_regex, &package.get_pretty_name()) .is_none() { let latest = self.find_latest_package( @@ -2493,7 +2492,7 @@ impl Command for ShowCommand { package_is_up_to_date = package_is_up_to_date || (latest_package.is_none() && show_major_only); let package_is_ignored = - preg_match2(&ignored_packages_regex, &package.get_pretty_name(), 0) + preg_match(&ignored_packages_regex, &package.get_pretty_name()) .is_some(); if input.borrow().get_option("outdated")?.as_bool() == Some(true) && (package_is_up_to_date || package_is_ignored) diff --git a/crates/shirabe/src/command/update_command.rs b/crates/shirabe/src/command/update_command.rs index 72d97315..dcfbc371 100644 --- a/crates/shirabe/src/command/update_command.rs +++ b/crates/shirabe/src/command/update_command.rs @@ -29,7 +29,7 @@ use crate::util::HttpDownloader; use indexmap::IndexMap; use shirabe_php_shim::{ InvalidArgumentException, PhpMixed, RuntimeException, array_filter, array_intersect, - array_keys, array_merge_map, array_search_in_vec, impl_php_class, php_regex, preg_match2, + array_keys, array_merge_map, array_search_in_vec, impl_php_class, php_regex, preg_match, preg_replace, strtolower, }; use shirabe_semver::Intervals; @@ -115,7 +115,7 @@ impl UpdateCommand { let mut version_selector = self.create_version_selector(composer)?; for package in &installed_packages { if let Some(filter) = &filter - && preg_match2(filter, &package.get_name(), 0).is_none() + && preg_match(filter, &package.get_name()).is_none() { continue; } @@ -378,7 +378,7 @@ impl Command for UpdateCommand { if !packages.is_empty() { let allowlist_packages_with_requirements: Vec<String> = array_filter(&packages, |pkg: &String| -> bool { - preg_match2(php_regex!(r"{\S+[ =:]\S+}"), pkg, 0).is_some() + preg_match(php_regex!(r"{\S+[ =:]\S+}"), pkg).is_some() }); for (package, constraint) in self.format_requirements(allowlist_packages_with_requirements.clone())? @@ -459,7 +459,7 @@ impl Command for UpdateCommand { continue; } let version = package.get_version(); - let matches = preg_match2(php_regex!(r"{^(\d+\.\d+\.\d+)}"), &version, 0); + let matches = preg_match(php_regex!(r"{^(\d+\.\d+\.\d+)}"), &version); let Some(matches) = matches else { continue; }; |
