aboutsummaryrefslogtreecommitdiffhomepage
path: root/crates/shirabe-external-packages/src/composer/pcre/unexpected_null_match_exception.rs
diff options
context:
space:
mode:
Diffstat (limited to 'crates/shirabe-external-packages/src/composer/pcre/unexpected_null_match_exception.rs')
-rw-r--r--crates/shirabe-external-packages/src/composer/pcre/unexpected_null_match_exception.rs29
1 files changed, 29 insertions, 0 deletions
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 {}