From 632c9793927a30c4bca3c91888e66b369d732dfe Mon Sep 17 00:00:00 2001 From: nsfisis Date: Mon, 8 Jun 2026 04:22:49 +0900 Subject: feat(phase-c): resolve PhpMixed-conversion phase-b TODOs Implement the foundational PhpMixed conversion infrastructure (From, order-sensitive PartialEq matching PHP ===) and resolve the category-G phase-b TODOs that depend on it: - Fix VCS driver cache paths that discarded parsed JSON or diverged on null caches (svn/forgejo/gitlab/git-bitbucket/github). - Wire up real conversions previously stubbed or dropped: suggests platform config, audit ignore-severities, composer_repository search and ProviderInfo, class_loader prefix/classmap merges, locker lock diff comparison, advisory JSON serialization, SPDX license fields. - Make GenericRule take a typed ReasonData; populate RULE_ROOT_REQUIRE with the constraint and convert PhpMixed at the call sites. --- .../shirabe/src/repository/composer_repository.rs | 32 +++++++++++++++------- 1 file changed, 22 insertions(+), 10 deletions(-) (limited to 'crates/shirabe/src/repository/composer_repository.rs') diff --git a/crates/shirabe/src/repository/composer_repository.rs b/crates/shirabe/src/repository/composer_repository.rs index 644ece7..3dbca7d 100644 --- a/crates/shirabe/src/repository/composer_repository.rs +++ b/crates/shirabe/src/repository/composer_repository.rs @@ -854,18 +854,27 @@ impl ComposerRepository { return Ok(results); } - // TODO(phase-b): inner.search returns Vec; convert to PHP-shaped map let inner_results = self.inner.search(query, mode, None)?; let converted: Vec> = inner_results .into_iter() .map(|sr| { let mut m: IndexMap = IndexMap::new(); m.insert("name".to_string(), PhpMixed::String(sr.name)); - if let Some(d) = sr.description { - m.insert("description".to_string(), PhpMixed::String(d)); - } - if let Some(u) = sr.url { - m.insert("url".to_string(), PhpMixed::String(u)); + m.insert( + "description".to_string(), + match sr.description { + Some(d) => PhpMixed::String(d), + None => PhpMixed::Null, + }, + ); + if let Some(ab) = sr.abandoned { + m.insert( + "abandoned".to_string(), + match ab { + crate::repository::AbandonedInfo::Replacement(r) => PhpMixed::String(r), + crate::repository::AbandonedInfo::Abandoned => PhpMixed::Bool(true), + }, + ); } m }) @@ -1205,12 +1214,15 @@ impl ComposerRepository { if Countable::count(&self.inner) > 0 { for (k, v) in self.inner.get_providers(package_name.to_string())? { - // TODO(phase-b): ProviderInfo -> IndexMap conversion needed let mut entry: IndexMap = IndexMap::new(); entry.insert("name".to_string(), PhpMixed::String(v.name)); - if let Some(d) = v.description { - entry.insert("description".to_string(), PhpMixed::String(d)); - } + entry.insert( + "description".to_string(), + match v.description { + Some(d) => PhpMixed::String(d), + None => PhpMixed::Null, + }, + ); entry.insert("type".to_string(), PhpMixed::String(v.r#type)); result.insert(k, entry); } -- cgit v1.3.1