aboutsummaryrefslogtreecommitdiffhomepage
path: root/crates/shirabe/src/package/locker.rs
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/locker.rs
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/locker.rs')
-rw-r--r--crates/shirabe/src/package/locker.rs22
1 files changed, 10 insertions, 12 deletions
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