aboutsummaryrefslogtreecommitdiffhomepage
path: root/crates/shirabe-symfony-console/src/output
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-symfony-console/src/output
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-symfony-console/src/output')
-rw-r--r--crates/shirabe-symfony-console/src/output/stream_output.rs5
1 files changed, 2 insertions, 3 deletions
diff --git a/crates/shirabe-symfony-console/src/output/stream_output.rs b/crates/shirabe-symfony-console/src/output/stream_output.rs
index 14565012..0d59fe2c 100644
--- a/crates/shirabe-symfony-console/src/output/stream_output.rs
+++ b/crates/shirabe-symfony-console/src/output/stream_output.rs
@@ -5,7 +5,7 @@ use crate::formatter::OutputFormatterInterface;
use crate::output::OutputInterface;
use crate::output::VERBOSITY_NORMAL;
use crate::output::{DoWrite, Output};
-use shirabe_php_shim::{php_regex, preg_match};
+use shirabe_php_shim::{php_regex, preg_is_match};
/// StreamOutput writes the output to a given stream.
///
@@ -120,13 +120,12 @@ impl StreamOutput {
}
// See https://github.com/chalk/supports-color/blob/d4f413efaf8da045c5ab440ed418ef02dbb28bf1/index.js#L157
- preg_match(
+ preg_is_match(
php_regex!(
"/^((screen|xterm|vt100|vt220|putty|rxvt|ansi|cygwin|linux).*)|(.*-256(color)?(-bce)?)$/"
),
&term,
)
- .is_some()
}
}