Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow a single installer path to be declared as a string #449

Merged
merged 1 commit into from
Apr 7, 2020

Conversation

tstoeckler
Copy link
Contributor

@tstoeckler tstoeckler commented Mar 6, 2020

Currently when you declare an installer path as a string versus an array, i.e. something like:

        "installer-paths": {
            "web/modules/{$name}": "type:drupal-module",
        }

you get an error:

in_array() expects parameter 2 to be array, string given
/home/tobias/Projekte/installers/src/Composer/Installers/BaseInstaller.php:130
/home/tobias/Projekte/installers/src/Composer/Installers/BaseInstaller.php:58
/home/tobias/Projekte/installers/src/Composer/Installers/Installer.php:158

I would like this to be possible. Not because I have a problem with the array structure in general, but because I would like to be able to configure the installer paths via the composer config command-line and that only allows 3 levels of nesting. I.e. I would like to be able to run

composer config extra.installer-paths.web/modules/{\$name} type:drupal-module

without that breaking the configuration.

Because a very common configuration is to have only a single path anyway, it seems like it is not a huge divergence from the status quo.

And it seemed easy enough to implement without adding much complexity. Also added a test and verified locally that it triggers the notice above without the fix.

Thoughts?

@effulgentsia
Copy link
Contributor

It would definitely be great to be able to add installer paths via composer config.

If for some reason, this project's maintainers don't want the complexity of values that can be either strings or arrays, another option I suggested in composer/composer#8353 (comment) is to add a --json option to composer config, which would allow:
composer config --json extra.installer-paths.your/custom/path/{\$name}/ '["vendor:my_organization"]'

Personally, I'd be happy with either or both, or any other solution that allows installer paths to be added via composer config.

@Seldaek Seldaek merged commit aef869a into composer:master Apr 7, 2020
@Seldaek
Copy link
Member

Seldaek commented Apr 7, 2020

Seems reasonable enough, thanks

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.

3 participants