aboutsummaryrefslogtreecommitdiffhomepage
path: root/crates/shirabe-semver
diff options
context:
space:
mode:
authornsfisis <nsfisis@gmail.com>2026-05-20 08:33:49 +0900
committernsfisis <nsfisis@gmail.com>2026-05-20 08:33:57 +0900
commitf31b101ce1e921a026ba234b1f0a83b0392bc118 (patch)
treeb7ac2aa84d71ebd162cc21aeab0240e7e0544988 /crates/shirabe-semver
parent5e31fa33c3b5cf726a57a063b8e7a070869250fe (diff)
downloadphp-shirabe-f31b101ce1e921a026ba234b1f0a83b0392bc118.tar.gz
php-shirabe-f31b101ce1e921a026ba234b1f0a83b0392bc118.tar.zst
php-shirabe-f31b101ce1e921a026ba234b1f0a83b0392bc118.zip
fix(compile): fix all remaining compile errors
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Diffstat (limited to 'crates/shirabe-semver')
-rw-r--r--crates/shirabe-semver/src/constraint/constraint.rs12
-rw-r--r--crates/shirabe-semver/src/constraint/constraint_interface.rs15
-rw-r--r--crates/shirabe-semver/src/version_parser.rs2
3 files changed, 28 insertions, 1 deletions
diff --git a/crates/shirabe-semver/src/constraint/constraint.rs b/crates/shirabe-semver/src/constraint/constraint.rs
index d64c0a0..4ac4cda 100644
--- a/crates/shirabe-semver/src/constraint/constraint.rs
+++ b/crates/shirabe-semver/src/constraint/constraint.rs
@@ -387,6 +387,18 @@ impl ConstraintInterface for Constraint {
fn as_any(&self) -> &dyn std::any::Any {
self
}
+
+ fn is_constraint(&self) -> bool {
+ true
+ }
+
+ fn get_operator(&self) -> &'static str {
+ Self::trans_op_int(self.operator)
+ }
+
+ fn get_version(&self) -> &str {
+ &self.version
+ }
}
impl std::fmt::Display for Constraint {
diff --git a/crates/shirabe-semver/src/constraint/constraint_interface.rs b/crates/shirabe-semver/src/constraint/constraint_interface.rs
index 09536e6..f4bd905 100644
--- a/crates/shirabe-semver/src/constraint/constraint_interface.rs
+++ b/crates/shirabe-semver/src/constraint/constraint_interface.rs
@@ -22,6 +22,21 @@ pub trait ConstraintInterface: std::fmt::Debug {
false
}
+ /// Rust-specific helper: PHP `$c instanceof Constraint` check.
+ fn is_constraint(&self) -> bool {
+ false
+ }
+
+ /// Rust-specific helper: PHP `$c->getOperator()`. Only meaningful when `is_constraint()` is true.
+ fn get_operator(&self) -> &'static str {
+ ""
+ }
+
+ /// Rust-specific helper: PHP `$c->getVersion()`. Only meaningful when `is_constraint()` is true.
+ fn get_version(&self) -> &str {
+ ""
+ }
+
fn clone_box(&self) -> Box<dyn ConstraintInterface>;
fn as_any(&self) -> &dyn std::any::Any;
diff --git a/crates/shirabe-semver/src/version_parser.rs b/crates/shirabe-semver/src/version_parser.rs
index 359beec..39000e7 100644
--- a/crates/shirabe-semver/src/version_parser.rs
+++ b/crates/shirabe-semver/src/version_parser.rs
@@ -20,7 +20,7 @@ const MODIFIER_REGEX: &str =
const STABILITIES_REGEX: &str = "stable|RC|beta|alpha|dev";
-#[derive(Debug)]
+#[derive(Debug, Clone)]
pub struct VersionParser;
impl VersionParser {