aboutsummaryrefslogtreecommitdiffhomepage
path: root/crates/shirabe-external-packages/src/composer/pcre/pcre_exception.rs
diff options
context:
space:
mode:
authornsfisis <nsfisis@gmail.com>2026-06-14 04:10:38 +0900
committernsfisis <nsfisis@gmail.com>2026-06-14 04:24:37 +0900
commit4116323e9d55745c17b2d8008affa3394b726f6b (patch)
treeb829253d58d546d4c8b95ca90e9e2cc2ae6e4652 /crates/shirabe-external-packages/src/composer/pcre/pcre_exception.rs
parent78157ab3ffeca37023381a422fccda2d4a0c64af (diff)
downloadphp-shirabe-4116323e9d55745c17b2d8008affa3394b726f6b.tar.gz
php-shirabe-4116323e9d55745c17b2d8008affa3394b726f6b.tar.zst
php-shirabe-4116323e9d55745c17b2d8008affa3394b726f6b.zip
refactor(pcre): drop PcreException
Composer never feeds a pattern that fails to compile at runtime, so a preg_*() failure is a programming error rather than a recoverable condition. Replace the PcreException path with a panic. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Diffstat (limited to 'crates/shirabe-external-packages/src/composer/pcre/pcre_exception.rs')
-rw-r--r--crates/shirabe-external-packages/src/composer/pcre/pcre_exception.rs36
1 files changed, 0 insertions, 36 deletions
diff --git a/crates/shirabe-external-packages/src/composer/pcre/pcre_exception.rs b/crates/shirabe-external-packages/src/composer/pcre/pcre_exception.rs
deleted file mode 100644
index 4ebe2c3..0000000
--- a/crates/shirabe-external-packages/src/composer/pcre/pcre_exception.rs
+++ /dev/null
@@ -1,36 +0,0 @@
-//! ref: composer/vendor/composer/pcre/src/PcreException.php
-
-use super::preg::{preg_last_error, preg_last_error_msg};
-
-#[derive(Debug)]
-pub struct PcreException(pub shirabe_php_shim::RuntimeException);
-
-impl PcreException {
- pub fn from_function(function: &str, pattern: &str) -> PcreException {
- let code = preg_last_error();
-
- PcreException(shirabe_php_shim::RuntimeException {
- message: format!(
- "{}(): failed executing \"{}\": {}",
- function,
- pattern,
- Self::pcre_last_error_message(code)
- ),
- code,
- })
- }
-
- // Modern PHP always provides preg_last_error_msg(), so the legacy fallbacks
- // that scanned the pcre constants are not reproduced.
- fn pcre_last_error_message(_code: i64) -> String {
- preg_last_error_msg()
- }
-}
-
-impl std::fmt::Display for PcreException {
- fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
- write!(f, "{}", self.0)
- }
-}
-
-impl std::error::Error for PcreException {}