From 1378a4818fe5933867328fd4e5972ff9db240dd1 Mon Sep 17 00:00:00 2001 From: nsfisis Date: Sun, 14 Jun 2026 03:00:27 +0900 Subject: feat(pcre): implement Preg class Co-Authored-By: Claude Opus 4.8 (1M context) --- .../pcre/unexpected_null_match_exception.rs | 29 ++++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 crates/shirabe-external-packages/src/composer/pcre/unexpected_null_match_exception.rs (limited to 'crates/shirabe-external-packages/src/composer/pcre/unexpected_null_match_exception.rs') diff --git a/crates/shirabe-external-packages/src/composer/pcre/unexpected_null_match_exception.rs b/crates/shirabe-external-packages/src/composer/pcre/unexpected_null_match_exception.rs new file mode 100644 index 0000000..513870c --- /dev/null +++ b/crates/shirabe-external-packages/src/composer/pcre/unexpected_null_match_exception.rs @@ -0,0 +1,29 @@ +//! ref: composer/vendor/composer/pcre/src/UnexpectedNullMatchException.php + +use super::pcre_exception::PcreException; + +#[derive(Debug)] +pub struct UnexpectedNullMatchException(pub PcreException); + +impl UnexpectedNullMatchException { + pub fn new(message: String) -> UnexpectedNullMatchException { + UnexpectedNullMatchException(PcreException(shirabe_php_shim::RuntimeException { + message, + code: 0, + })) + } + + pub fn from_function(_function: &str, _pattern: &str) -> UnexpectedNullMatchException { + panic!( + "fromFunction should not be called on UnexpectedNullMatchException, use PcreException" + ); + } +} + +impl std::fmt::Display for UnexpectedNullMatchException { + fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + write!(f, "{}", self.0) + } +} + +impl std::error::Error for UnexpectedNullMatchException {} -- cgit v1.3.1