aboutsummaryrefslogtreecommitdiffhomepage
path: root/crates/shirabe-external-packages/src/composer
diff options
context:
space:
mode:
authornsfisis <nsfisis@gmail.com>2026-05-23 23:14:52 +0900
committernsfisis <nsfisis@gmail.com>2026-05-23 23:15:14 +0900
commitdbdecaf5a1c54a876b7ee0153d58dd39b1080f97 (patch)
treef13f2ced03c803dcbc42a5672458b3cb19ff0f30 /crates/shirabe-external-packages/src/composer
parentf5b987a00712211b7ce56300851182bda904e97b (diff)
downloadphp-shirabe-dbdecaf5a1c54a876b7ee0153d58dd39b1080f97.tar.gz
php-shirabe-dbdecaf5a1c54a876b7ee0153d58dd39b1080f97.tar.zst
php-shirabe-dbdecaf5a1c54a876b7ee0153d58dd39b1080f97.zip
refactor(semver): change ConstraintInterface to a closed enum
Replace the dyn ConstraintInterface trait objects with an AnyConstraint enum closing over its four implementors (Simple, Multi, MatchAll, MatchNone), mirroring the earlier Rule enum conversion. Rename constraint.rs to simple_constraint.rs to match the renamed Constraint type. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Diffstat (limited to 'crates/shirabe-external-packages/src/composer')
-rw-r--r--crates/shirabe-external-packages/src/composer/semver/compiling_matcher.rs8
-rw-r--r--crates/shirabe-external-packages/src/composer/semver/intervals.rs14
2 files changed, 10 insertions, 12 deletions
diff --git a/crates/shirabe-external-packages/src/composer/semver/compiling_matcher.rs b/crates/shirabe-external-packages/src/composer/semver/compiling_matcher.rs
index 246c4e5..b075ba7 100644
--- a/crates/shirabe-external-packages/src/composer/semver/compiling_matcher.rs
+++ b/crates/shirabe-external-packages/src/composer/semver/compiling_matcher.rs
@@ -1,18 +1,18 @@
-use shirabe_semver::constraint::ConstraintInterface;
+use shirabe_semver::constraint::AnyConstraint;
#[derive(Debug)]
pub struct CompilingMatcher;
impl CompilingMatcher {
- pub fn r#match(_constraint: &dyn ConstraintInterface, _package: &dyn std::any::Any) -> bool {
+ pub fn r#match(_constraint: &AnyConstraint, _package: &dyn std::any::Any) -> bool {
todo!()
}
- pub fn matches(_constraint: &dyn ConstraintInterface, _operator: i64, _version: &str) -> bool {
+ pub fn matches(_constraint: &AnyConstraint, _operator: i64, _version: &str) -> bool {
todo!()
}
- pub fn match_(_constraint: &dyn ConstraintInterface, _operator: i64, _version: &str) -> bool {
+ pub fn match_(_constraint: &AnyConstraint, _operator: i64, _version: &str) -> bool {
todo!()
}
diff --git a/crates/shirabe-external-packages/src/composer/semver/intervals.rs b/crates/shirabe-external-packages/src/composer/semver/intervals.rs
index ff04cd8..bf8a74f 100644
--- a/crates/shirabe-external-packages/src/composer/semver/intervals.rs
+++ b/crates/shirabe-external-packages/src/composer/semver/intervals.rs
@@ -1,28 +1,26 @@
use shirabe_php_shim::PhpMixed;
-use shirabe_semver::constraint::ConstraintInterface;
+use shirabe_semver::constraint::AnyConstraint;
#[derive(Debug)]
pub struct Intervals;
impl Intervals {
pub fn is_subset_of(
- _constraint_a: &dyn ConstraintInterface,
- _constraint_b: &dyn ConstraintInterface,
+ _constraint_a: &AnyConstraint,
+ _constraint_b: &AnyConstraint,
) -> anyhow::Result<bool> {
todo!()
}
- pub fn compact_constraint(
- _constraint: Box<dyn ConstraintInterface>,
- ) -> Box<dyn ConstraintInterface> {
+ pub fn compact_constraint(_constraint: AnyConstraint) -> AnyConstraint {
todo!()
}
- pub fn compact(_constraint: &dyn ConstraintInterface) -> Box<dyn ConstraintInterface> {
+ pub fn compact(_constraint: &AnyConstraint) -> AnyConstraint {
todo!()
}
- pub fn get(_constraint: &dyn ConstraintInterface) -> anyhow::Result<PhpMixed> {
+ pub fn get(_constraint: &AnyConstraint) -> anyhow::Result<PhpMixed> {
todo!()
}