aboutsummaryrefslogtreecommitdiffhomepage
path: root/crates/shirabe/src/package
diff options
context:
space:
mode:
authornsfisis <nsfisis@gmail.com>2026-08-06 06:25:10 +0900
committernsfisis <nsfisis@gmail.com>2026-08-06 06:25:30 +0900
commit791ef1cd465597ff43dab4216c4b00e9e4160da8 (patch)
treeec6c3bc45f81576146325350faa6dcea638987b4 /crates/shirabe/src/package
parenta86bbd67954f7bbc38bb09138edb335d82666526 (diff)
downloadphp-shirabe-791ef1cd465597ff43dab4216c4b00e9e4160da8.tar.gz
php-shirabe-791ef1cd465597ff43dab4216c4b00e9e4160da8.tar.zst
php-shirabe-791ef1cd465597ff43dab4216c4b00e9e4160da8.zip
refactor(php-shim): split in_array into strict and loose variants
Diffstat (limited to 'crates/shirabe/src/package')
-rw-r--r--crates/shirabe/src/package/alias_package.rs11
-rw-r--r--crates/shirabe/src/package/locker.rs22
2 files changed, 15 insertions, 18 deletions
diff --git a/crates/shirabe/src/package/alias_package.rs b/crates/shirabe/src/package/alias_package.rs
index 8073f3ff..fb775130 100644
--- a/crates/shirabe/src/package/alias_package.rs
+++ b/crates/shirabe/src/package/alias_package.rs
@@ -11,7 +11,7 @@ use crate::repository::RepositoryInterfaceWeakHandle;
use chrono::{DateTime, Utc};
use indexmap::IndexMap;
use indexmap::IndexSet;
-use shirabe_php_shim::{LogicException, PhpMixed, in_array};
+use shirabe_php_shim::{LogicException, PhpMixed, in_array_strict};
use shirabe_semver::constraint::SimpleConstraint;
#[derive(Debug, Clone)]
@@ -131,14 +131,13 @@ impl AliasPackage {
pretty_version = self.alias_of.get_pretty_version();
}
- if in_array(
- PhpMixed::String(link_type.to_string()),
- &PhpMixed::List(vec![
+ if in_array_strict(
+ link_type.to_string(),
+ &[
PhpMixed::String(Link::TYPE_CONFLICT.to_string()),
PhpMixed::String(Link::TYPE_PROVIDE.to_string()),
PhpMixed::String(Link::TYPE_REPLACE.to_string()),
- ]),
- true,
+ ],
) {
let mut new_links: Vec<Link> = vec![];
for link in links.values() {
diff --git a/crates/shirabe/src/package/locker.rs b/crates/shirabe/src/package/locker.rs
index f06f2bdc..10350d78 100644
--- a/crates/shirabe/src/package/locker.rs
+++ b/crates/shirabe/src/package/locker.rs
@@ -28,8 +28,8 @@ use shirabe_external_packages::composer::pcre::{CaptureKey, Preg};
use shirabe_external_packages::seld::json_lint::ParsingException;
use shirabe_php_shim::{
DATE_RFC3339, LogicException, PhpMixed, RuntimeException, array_intersect, array_keys,
- array_map, array_merge, file_get_contents, filemtime, function_exists, hash, in_array, is_int,
- ksort, php_regex, realpath, strcmp, strtolower, touch2, trim, usort,
+ array_map, array_merge, file_get_contents, filemtime, function_exists, hash, in_array_loose,
+ in_array_strict, is_int, ksort, php_regex, realpath, strcmp, strtolower, touch2, trim, usort,
};
/// Reads/writes project lockfile (composer.lock).
@@ -481,14 +481,13 @@ impl Locker {
.and_then(|v| v.as_string())
.unwrap_or("")
.to_string();
- if in_array(
- PhpMixed::String(version),
- &PhpMixed::List(vec![
+ if in_array_strict(
+ version,
+ &[
PhpMixed::String("dev-master".to_string()),
PhpMixed::String("dev-trunk".to_string()),
PhpMixed::String("dev-default".to_string()),
- ]),
- true,
+ ],
) {
alias.insert(
"version".to_string(),
@@ -807,13 +806,12 @@ impl Locker {
let mut datetime: Option<chrono::DateTime<chrono::Utc>> = None;
if path.is_some()
- && in_array(
- PhpMixed::String(source_type.clone().unwrap_or_default()),
- &PhpMixed::List(vec![
+ && in_array_loose(
+ source_type.clone().unwrap_or_default(),
+ &[
PhpMixed::String("git".to_string()),
PhpMixed::String("hg".to_string()),
- ]),
- false,
+ ],
)
{
let source_ref = package