aboutsummaryrefslogtreecommitdiffhomepage
path: root/crates/shirabe-external-packages/src/composer/pcre/unexpected_null_match_exception.rs
blob: 513870c59398417a271f592fac60f153fec42712 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
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 {}