diff options
| author | nsfisis <nsfisis@gmail.com> | 2026-06-08 04:22:49 +0900 |
|---|---|---|
| committer | nsfisis <nsfisis@gmail.com> | 2026-06-08 04:23:11 +0900 |
| commit | 632c9793927a30c4bca3c91888e66b369d732dfe (patch) | |
| tree | 5bafb9d7fa2523d5a2f8d70ff59c3173e962e389 /crates/shirabe/src/repository/composer_repository.rs | |
| parent | 243450fee9853c2fea66ae0642dabb8db5227d6f (diff) | |
| download | php-shirabe-632c9793927a30c4bca3c91888e66b369d732dfe.tar.gz php-shirabe-632c9793927a30c4bca3c91888e66b369d732dfe.tar.zst php-shirabe-632c9793927a30c4bca3c91888e66b369d732dfe.zip | |
feat(phase-c): resolve PhpMixed-conversion phase-b TODOs
Implement the foundational PhpMixed conversion infrastructure
(From<bool|i64|f64|String>, 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.
Diffstat (limited to 'crates/shirabe/src/repository/composer_repository.rs')
| -rw-r--r-- | crates/shirabe/src/repository/composer_repository.rs | 32 |
1 files changed, 22 insertions, 10 deletions
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<SearchResult>; convert to PHP-shaped map let inner_results = self.inner.search(query, mode, None)?; let converted: Vec<IndexMap<String, PhpMixed>> = inner_results .into_iter() .map(|sr| { let mut m: IndexMap<String, PhpMixed> = 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<String, PhpMixed> conversion needed let mut entry: IndexMap<String, PhpMixed> = 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); } |
