aboutsummaryrefslogtreecommitdiffhomepage
path: root/crates/mozart/src/commands
diff options
context:
space:
mode:
authornsfisis <nsfisis@gmail.com>2026-05-03 11:23:03 +0900
committernsfisis <nsfisis@gmail.com>2026-05-03 11:23:03 +0900
commit30ae6c869adc7f3cb87a4d63edd6d0cda89d571d (patch)
tree44914e0d8d6afc01f3344c1b4d21209477ba592f /crates/mozart/src/commands
parent489d00ca3f096f69f3b05f9564b23bb70a2475c7 (diff)
downloadphp-mozart-30ae6c869adc7f3cb87a4d63edd6d0cda89d571d.tar.gz
php-mozart-30ae6c869adc7f3cb87a4d63edd6d0cda89d571d.tar.zst
php-mozart-30ae6c869adc7f3cb87a4d63edd6d0cda89d571d.zip
feat(resolver): apply config.platform overrides on top of detected platform
Mirrors `Composer\Repository\PlatformRepository`'s `$overrides` handling: each override either replaces a detected platform package version or adds a virtual one (e.g. ext-dummy), and `false` disables the package. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Diffstat (limited to 'crates/mozart/src/commands')
-rw-r--r--crates/mozart/src/commands/update.rs11
1 files changed, 10 insertions, 1 deletions
diff --git a/crates/mozart/src/commands/update.rs b/crates/mozart/src/commands/update.rs
index 33b305a..17b7c97 100644
--- a/crates/mozart/src/commands/update.rs
+++ b/crates/mozart/src/commands/update.rs
@@ -872,6 +872,15 @@ pub async fn run(
.unwrap_or(false);
let prefer_stable = args.prefer_stable || composer_prefer_stable;
+ let mut platform = PlatformConfig::new();
+ if let Some(overrides) = composer_json
+ .extra_fields
+ .get("config")
+ .and_then(|c| c.get("platform"))
+ {
+ platform.apply_overrides(overrides);
+ }
+
let request = ResolveRequest {
root_name: composer_json.name.clone(),
require,
@@ -881,7 +890,7 @@ pub async fn run(
stability_flags: HashMap::new(),
prefer_stable,
prefer_lowest: args.prefer_lowest,
- platform: PlatformConfig::new(),
+ platform,
ignore_platform_reqs: args.ignore_platform_reqs,
ignore_platform_req_list: args.ignore_platform_req.clone(),
repositories: repositories.clone(),