BrianHenryIE / strauss

Prefix PHP namespaces and classnames to allow multiple versions of libraries to exist without conflict.
https://brianhenryie.github.io/strauss/
MIT License
143 stars 23 forks source link

fix: check input options presence when updating config from CLI #109

Closed Dartui closed 5 months ago

Dartui commented 5 months ago

This PR fixes issue with config options being overwritten when parsing CLI options.

$input->hasOption method returns true for every input option that is configured (see Console/Commands/Compose@configure), even when input option is not passed from CLI.

Because of that when you are not setting deleteVendorPackages option from CLI, the composer.json extra config is overwritten before doing cleanup action. All input options are optional, so to preserve extra config we should not change values of the config when input option values equals to null.

BrianHenryIE commented 5 months ago

Thank you. I wrote a test for it too https://github.com/BrianHenryIE/strauss/commit/75933852651e7b5fb7e256d4ca251d3727dff87d