Skip to content

Conversation

@Crovitche-1623
Copy link

@Crovitche-1623 Crovitche-1623 commented Oct 8, 2025

The current command composer config "extra.symfony/flex.synchronize_package.json" false write a string containing "false":

e.g.

{
    {
        "symfony/flex": {
            "synchronize_package_json": "false",
        }
    }
}

It does not skip the package.json as expected so I suggest to add the filter_var, so for all those who use thed previous "wrong" command, it'll work as expected now.

ping @smnandre and @Kocal

related: symfony/ux#3091

@Crovitche-1623
Copy link
Author

Note: the CI step for CS fails on code that I didn't wrote.

@nicolas-grekas
Copy link
Member

This doesn't make sense to my. json is a typed language that allows differentiating booleans from strings.

@stof
Copy link
Member

stof commented Oct 15, 2025

@nicolas-grekas JSON is typed. But the composer config command allowing to change the composer config from the CLI (rather than through manual edition of a JSON file) receives string as input (as any CLI script). And for extra, the config command of Composer does not have any type conversion rule implemented as it cannot know the expected type of each extra key (as they are precisely not known to Composer)

@Crovitche-1623
Copy link
Author

@nicolas-grekas and @stof

The following command with the --json argument would also solve the problem :

composer config --json extra.symfony/flex.synchronize_package_json false

But I wanted to add this PR for those who already have the "false" value and do not want to run the above command one more time.

@stof
Copy link
Member

stof commented Oct 15, 2025

I forgot that composer config has this --json flag.

then I would rather be in favor of reporting an error when they use a string value, instead of adding support for "false"

@nicolas-grekas
Copy link
Member

Yep
Let's close this then, new PR welcome of course.

Kocal added a commit to symfony/ux that referenced this pull request Oct 16, 2025
This PR was merged into the 2.x branch.

Discussion
----------

 Add --json flag to composer config command

| Q              | A
| -------------- | ---
| Bug fix?       | no
| New feature?   | no <!-- please update src/**/CHANGELOG.md files -->
| Deprecations?  | no <!-- if yes, also update UPGRADE-*.md and src/**/CHANGELOG.md -->
| Documentation? | yes <!-- required for new features, or documentation updates -->
| Issues         | Fix #... <!-- prefix each issue number with "Fix #", no need to create an issue if none exist, explain below instead -->
| License        | MIT

<!--
Replace this notice by a description of your feature/bugfix.
This will help reviewers and should be a good start for the documentation.

Additionally (see https://symfony.com/releases):
 - Always add tests and ensure they pass.
 - For new features, provide some code snippets to help understand usage.
 - Features and deprecations must be submitted against branch main.
 - Update/add documentation as required (we can help!)
 - Changelog entry should follow https://symfony.com/doc/current/contributing/code/conventions.html#writing-a-changelog-entry
 - Never break backward compatibility (see https://symfony.com/bc).
-->

Follows #3091 and symfony/flex#1064

Commits
-------

92f37a9 Add --json flag to composer config command
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants