From 1a98d2c35ae9236770cf6b0e98b3177a064b8ca8 Mon Sep 17 00:00:00 2001 From: DualFroz Date: Wed, 7 Oct 2026 19:38:14 +0200 Subject: [PATCH] Clarify which config keys support --json and --merge the config docs said --json and --merge only apply to extra.*, but they also work for policy.*.ignore, policy.advisories.ignore-id and audit.ignore[-abandoned] (plus --json for policy.ignore-unreachable), where --merge does not need --json. listed the supported keys in the docs and option help, and noted the flags are ignored for other keys. Closes #11873 --- doc/03-cli.md | 10 ++++++++-- src/Composer/Command/ConfigCommand.php | 4 ++-- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/doc/03-cli.md b/doc/03-cli.md index e2e072f..6e4d610 100644 --- a/doc/03-cli.md +++ b/doc/03-cli.md @@ -881,8 +881,14 @@ See the [Config](06-config.md) chapter for valid configuration options. that this cannot be used in conjunction with the `--global` option. * **--absolute:** Returns absolute paths when fetching `*-dir` config values instead of relative. -* **--json:** JSON decode the setting value, to be used with `extra.*` keys. -* **--merge:** Merge the setting value with the current value, to be used with `extra.*` keys in combination with `--json`. +* **--json:** JSON decode the setting value. Only supported for `extra.*`, + `policy.*.ignore`, `policy.advisories.ignore-id`, `policy.ignore-unreachable`, + `audit.ignore` and `audit.ignore-abandoned` keys, it is ignored for all other keys. +* **--merge:** Merge the setting value with the current value instead of replacing + it. Only supported for `extra.*` keys in combination with `--json`, and for + `policy.*.ignore`, `policy.advisories.ignore-id`, `audit.ignore` and + `audit.ignore-abandoned` keys with or without `--json`. It is ignored for all + other keys. * **--append:** When adding a repository, append it (lowest priority) to the existing ones instead of prepending it (highest priority). * **--source:** Display where the config value is loaded from. diff --git a/src/Composer/Command/ConfigCommand.php b/src/Composer/Command/ConfigCommand.php index 49d7d8f..40dd1ce 100644 --- a/src/Composer/Command/ConfigCommand.php +++ b/src/Composer/Command/ConfigCommand.php @@ -82,8 +82,8 @@ class ConfigCommand extends BaseConfigCommand new InputOption('list', 'l', InputOption::VALUE_NONE, 'List configuration settings'), new InputOption('file', 'f', InputOption::VALUE_REQUIRED, 'If you want to choose a different composer.json or config.json'), new InputOption('absolute', null, InputOption::VALUE_NONE, 'Returns absolute paths when fetching *-dir config values instead of relative'), - new InputOption('json', 'j', InputOption::VALUE_NONE, 'JSON decode the setting value, to be used with extra.* keys'), - new InputOption('merge', 'm', InputOption::VALUE_NONE, 'Merge the setting value with the current value, to be used with extra.* or audit.ignore[-abandoned] keys in combination with --json'), + new InputOption('json', 'j', InputOption::VALUE_NONE, 'JSON decode the setting value, only supported for extra.*, policy.*.ignore, policy.advisories.ignore-id, policy.ignore-unreachable and audit.ignore[-abandoned] keys'), + new InputOption('merge', 'm', InputOption::VALUE_NONE, 'Merge the setting value with the current value, only supported for extra.* keys in combination with --json, and for policy.*.ignore, policy.advisories.ignore-id and audit.ignore[-abandoned] keys'), new InputOption('append', null, InputOption::VALUE_NONE, 'When adding a repository, append it (lowest priority) to the existing ones instead of prepending it (highest priority)'), new InputOption('source', null, InputOption::VALUE_NONE, 'Display where the config value is loaded from'), new InputArgument('setting-key', null, 'Setting key', null, $this->suggestSettingKeys()),