diff options
| author | nsfisis <nsfisis@gmail.com> | 2026-05-16 23:31:30 +0900 |
|---|---|---|
| committer | nsfisis <nsfisis@gmail.com> | 2026-05-16 23:31:30 +0900 |
| commit | 303811ce071865ffd1ea02a5d5ff0ca5537179bd (patch) | |
| tree | a873b240ad8e6e770200c5fc8dbf86fd3862b215 /crates/shirabe-semver | |
| parent | 7205727a446cc13274b512a9971f2ab477eff253 (diff) | |
| download | php-shirabe-303811ce071865ffd1ea02a5d5ff0ca5537179bd.tar.gz php-shirabe-303811ce071865ffd1ea02a5d5ff0ca5537179bd.tar.zst php-shirabe-303811ce071865ffd1ea02a5d5ff0ca5537179bd.zip | |
feat(port): port MatchNoneConstraint.php
Diffstat (limited to 'crates/shirabe-semver')
| -rw-r--r-- | crates/shirabe-semver/src/constraint/match_none_constraint.rs | 43 |
1 files changed, 43 insertions, 0 deletions
diff --git a/crates/shirabe-semver/src/constraint/match_none_constraint.rs b/crates/shirabe-semver/src/constraint/match_none_constraint.rs index 204b594..5bfc6ea 100644 --- a/crates/shirabe-semver/src/constraint/match_none_constraint.rs +++ b/crates/shirabe-semver/src/constraint/match_none_constraint.rs @@ -1 +1,44 @@ //! ref: composer/vendor/composer/semver/src/Constraint/MatchNoneConstraint.php + +use crate::constraint::bound::Bound; +use crate::constraint::constraint_interface::ConstraintInterface; + +#[derive(Debug)] +pub struct MatchNoneConstraint { + pub(crate) pretty_string: Option<String>, +} + +impl ConstraintInterface for MatchNoneConstraint { + fn matches(&self, _provider: &dyn ConstraintInterface) -> bool { + false + } + + fn compile(&self, _other_operator: i64) -> String { + "false".to_string() + } + + fn set_pretty_string(&mut self, pretty_string: Option<String>) { + self.pretty_string = pretty_string; + } + + fn get_pretty_string(&self) -> String { + if let Some(ref s) = self.pretty_string { + if !s.is_empty() { + return s.clone(); + } + } + self.__to_string() + } + + fn __to_string(&self) -> String { + "[]".to_string() + } + + fn get_upper_bound(&self) -> Bound { + Bound::new("0.0.0.0-dev".to_string(), false) + } + + fn get_lower_bound(&self) -> Bound { + Bound::new("0.0.0.0-dev".to_string(), false) + } +} |
