diff options
| author | nsfisis <nsfisis@gmail.com> | 2026-08-16 19:06:49 +0900 |
|---|---|---|
| committer | nsfisis <nsfisis@gmail.com> | 2026-08-16 19:07:15 +0900 |
| commit | b6604e1395f003748fe40a44e1190470632a40ce (patch) | |
| tree | 27ce3c137c860a7bd8914852ba5f851e213d448c /crates/shirabe-symfony-console/src/helper | |
| parent | c5605cc072c1880af7d70647278c6aa0de43f402 (diff) | |
| download | php-shirabe-b6604e1395f003748fe40a44e1190470632a40ce.tar.gz php-shirabe-b6604e1395f003748fe40a44e1190470632a40ce.tar.zst php-shirabe-b6604e1395f003748fe40a44e1190470632a40ce.zip | |
refactor(preg): import preg_*() instead of qualifying them
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Diffstat (limited to 'crates/shirabe-symfony-console/src/helper')
| -rw-r--r-- | crates/shirabe-symfony-console/src/helper/helper.rs | 10 | ||||
| -rw-r--r-- | crates/shirabe-symfony-console/src/helper/progress_bar.rs | 4 |
2 files changed, 7 insertions, 7 deletions
diff --git a/crates/shirabe-symfony-console/src/helper/helper.rs b/crates/shirabe-symfony-console/src/helper/helper.rs index 4f0447f3..21f20d34 100644 --- a/crates/shirabe-symfony-console/src/helper/helper.rs +++ b/crates/shirabe-symfony-console/src/helper/helper.rs @@ -2,7 +2,7 @@ use crate::formatter::OutputFormatterInterface; use crate::helper::HelperSet; -use shirabe_php_shim::php_regex; +use shirabe_php_shim::{php_regex, preg_match, preg_replace}; use shirabe_symfony_string::unicode_string::UnicodeString; /// Helper is the base class for all helper classes. @@ -40,7 +40,7 @@ impl Helper { /// Returns the width of a string, using mb_strwidth if it is available. /// The width is how many characters positions the string will use. pub fn width(string: &str) -> i64 { - if shirabe_php_shim::preg_match(php_regex!("//u"), string, &mut Vec::new()) { + if preg_match(php_regex!("//u"), string, &mut Vec::new()) { return UnicodeString::new(string).width(false); } @@ -56,7 +56,7 @@ impl Helper { /// Returns the length of a string, using mb_strlen if it is available. /// The length is related to how many bytes the string will use. pub fn length(string: &str) -> i64 { - if shirabe_php_shim::preg_match(php_regex!("//u"), string, &mut Vec::new()) { + if preg_match(php_regex!("//u"), string, &mut Vec::new()) { return UnicodeString::new(string).length(); } @@ -148,9 +148,9 @@ impl Helper { // remove <...> formatting let string = formatter.format(Some(string)).unwrap().unwrap_or_default(); // remove already formatted characters - let string = shirabe_php_shim::preg_replace(php_regex!("/\u{1b}\\[[^m]*m/"), "", &string); + let string = preg_replace(php_regex!("/\u{1b}\\[[^m]*m/"), "", &string); // remove terminal hyperlinks - let string = shirabe_php_shim::preg_replace( + let string = preg_replace( php_regex!("/\u{1b}]8;[^;]*;[^\u{1b}]*\u{1b}\\\\/"), "", &string, diff --git a/crates/shirabe-symfony-console/src/helper/progress_bar.rs b/crates/shirabe-symfony-console/src/helper/progress_bar.rs index dea1c3ad..1158c507 100644 --- a/crates/shirabe-symfony-console/src/helper/progress_bar.rs +++ b/crates/shirabe-symfony-console/src/helper/progress_bar.rs @@ -9,7 +9,7 @@ use crate::output::OutputInterface; use crate::output::output_interface; use crate::terminal::Terminal; use indexmap::IndexMap; -use shirabe_php_shim::CaptureKey; +use shirabe_php_shim::{CaptureKey, preg_replace_callback}; pub const FORMAT_VERBOSE: &str = "verbose"; pub const FORMAT_VERY_VERBOSE: &str = "very_verbose"; @@ -831,6 +831,6 @@ impl ProgressBar { }) }; - shirabe_php_shim::preg_replace_callback(regex, callback, &format) + preg_replace_callback(regex, callback, &format) } } |
