aboutsummaryrefslogtreecommitdiffhomepage
path: root/crates/shirabe/src/package
diff options
context:
space:
mode:
Diffstat (limited to 'crates/shirabe/src/package')
-rw-r--r--crates/shirabe/src/package/loader/validating_array_loader.rs10
-rw-r--r--crates/shirabe/src/package/version/version_selector.rs6
2 files changed, 8 insertions, 8 deletions
diff --git a/crates/shirabe/src/package/loader/validating_array_loader.rs b/crates/shirabe/src/package/loader/validating_array_loader.rs
index a28df595..a050f2d7 100644
--- a/crates/shirabe/src/package/loader/validating_array_loader.rs
+++ b/crates/shirabe/src/package/loader/validating_array_loader.rs
@@ -9,10 +9,10 @@ use crate::repository::PlatformRepository;
use indexmap::IndexMap;
use shirabe_external_packages::composer::pcre::Preg;
use shirabe_php_shim::{
- E_USER_DEPRECATED, PHP_EOL, PhpMixed, array_intersect_key, array_values, filter_var_email,
- get_debug_type, is_array, is_bool, is_int, is_numeric, is_scalar, is_string, json_encode,
- parse_url_all, php_regex, php_to_string, str_replace, strcasecmp, strtolower, strtotime,
- substr, trigger_error, trim, var_export,
+ CmpOp, E_USER_DEPRECATED, PHP_EOL, PhpMixed, array_intersect_key, array_values,
+ filter_var_email, get_debug_type, is_array, is_bool, is_int, is_numeric, is_scalar, is_string,
+ json_encode, parse_url_all, php_regex, php_to_string, str_replace, strcasecmp, strtolower,
+ strtotime, substr, trigger_error, trim, var_export,
};
use shirabe_semver::Intervals;
use shirabe_semver::constraint::AnyConstraint;
@@ -1242,7 +1242,7 @@ impl LoaderInterface for ValidatingArrayLoader {
&& link_type == "require"
&& link_constraint
.as_constraint()
- .is_some_and(|c| ["==", "="].contains(&c.get_operator()))
+ .is_some_and(|c| c.get_operator() == CmpOp::Eq)
&& AnyConstraint::from(SimpleConstraint::new(
">=".to_string(),
"1.0.0.0-dev".to_string(),
diff --git a/crates/shirabe/src/package/version/version_selector.rs b/crates/shirabe/src/package/version/version_selector.rs
index bf5514a5..84f2beef 100644
--- a/crates/shirabe/src/package/version/version_selector.rs
+++ b/crates/shirabe/src/package/version/version_selector.rs
@@ -18,7 +18,7 @@ use crate::repository::RepositorySetInterface;
use indexmap::IndexMap;
use shirabe_external_packages::composer::pcre::Preg;
use shirabe_php_shim::{
- PHP_MAJOR_VERSION, PHP_MINOR_VERSION, PHP_RELEASE_VERSION, php_regex, strtolower,
+ CmpOp, PHP_MAJOR_VERSION, PHP_MINOR_VERSION, PHP_RELEASE_VERSION, php_regex, strtolower,
version_compare,
};
use shirabe_semver::constraint::AnyConstraint;
@@ -123,9 +123,9 @@ impl VersionSelector {
return std::cmp::Ordering::Less;
}
- if version_compare(&b.get_version(), &a.get_version(), ">") {
+ if version_compare(&b.get_version(), &a.get_version(), CmpOp::Gt) {
std::cmp::Ordering::Greater
- } else if version_compare(&b.get_version(), &a.get_version(), "<") {
+ } else if version_compare(&b.get_version(), &a.get_version(), CmpOp::Lt) {
std::cmp::Ordering::Less
} else {
std::cmp::Ordering::Equal