aboutsummaryrefslogtreecommitdiffhomepage
path: root/crates/shirabe/src/plugin/plugin_manager.rs
diff options
context:
space:
mode:
authornsfisis <nsfisis@gmail.com>2026-08-18 01:57:02 +0900
committernsfisis <nsfisis@gmail.com>2026-08-18 01:57:02 +0900
commitfed0a6e7ac361af9b963c1f62411b1a85478230c (patch)
tree5cde64a24845c761890fbcbe05e0d702f1ec8df7 /crates/shirabe/src/plugin/plugin_manager.rs
parente093b2be1c333e67c96aebb0a5291bea9ae3d6db (diff)
downloadphp-shirabe-fed0a6e7ac361af9b963c1f62411b1a85478230c.tar.gz
php-shirabe-fed0a6e7ac361af9b963c1f62411b1a85478230c.tar.zst
php-shirabe-fed0a6e7ac361af9b963c1f62411b1a85478230c.zip
refactor(preg): add preg_is_match for existence-only call sites
The capture groups were discarded at 162 of the preg_match call sites, which only tested the Option. They now call preg_is_match, which lets the regex engine skip capture tracking. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Diffstat (limited to 'crates/shirabe/src/plugin/plugin_manager.rs')
-rw-r--r--crates/shirabe/src/plugin/plugin_manager.rs8
1 files changed, 4 insertions, 4 deletions
diff --git a/crates/shirabe/src/plugin/plugin_manager.rs b/crates/shirabe/src/plugin/plugin_manager.rs
index 28616903..2fff2d74 100644
--- a/crates/shirabe/src/plugin/plugin_manager.rs
+++ b/crates/shirabe/src/plugin/plugin_manager.rs
@@ -28,8 +28,8 @@ use indexmap::IndexMap;
use shirabe_php_rpc::{PluginValue, call_function_with_dispatcher};
use shirabe_php_shim::{
CmpOp, E_USER_DEPRECATED, PhpMixed, RuntimeException, UnexpectedValueException, dirname, empty,
- file_get_contents, implode, ksort, php_regex, preg_match, preg_quote, preg_replace2, strrpos,
- strtr_array, substr, trigger_error, trim, var_export, var_export_str, version_compare,
+ file_get_contents, implode, ksort, php_regex, preg_is_match, preg_quote, preg_replace2,
+ strrpos, strtr_array, substr, trigger_error, trim, var_export, var_export_str, version_compare,
};
use shirabe_semver::constraint::SimpleConstraint;
@@ -259,7 +259,7 @@ impl PluginManager {
}
if package.get_name() == "symfony/flex"
- && preg_match(php_regex!("{^[0-9.]+$}"), &package.get_version()).is_some()
+ && preg_is_match(php_regex!("{^[0-9.]+$}"), &package.get_version())
&& version_compare(&package.get_version(), "1.9.8", CmpOp::Lt)
{
self.io.write_error(&format!("<warning>The \"{}\" plugin {}was skipped because it is not compatible with Composer 2+. Make sure to update it to version 1.9.8 or greater.</warning>",
@@ -1242,7 +1242,7 @@ impl PluginManager {
.map(|(k, v)| (k.clone(), *v))
.collect();
for (pattern, allow) in &rules_snapshot {
- if preg_match(pattern, package).is_some() {
+ if preg_is_match(pattern, package) {
return Ok(*allow);
}
}