Skip to content

Installer does not recognize Aliases #89

Description

@rieschl
Q A
Version(s) 3.5.0

Summary

In my config, I like to import the ConfigProvider classes as aliases to be more readable, i.e. use Mezzio\Router\ConfigProvider as MezzioRouterConfigProvider;
That works well in production. When running the code in CI, all packages are reinstalled and the component-installer registers all packages because that defaults to true in non-interactive sessions. Normally, injecting the ConfigProvider is skipped if it's already in the config file, but apparently the installer doesn't recognize the classes if they're imported as aliases.
Previously I didn't notice that, because its in the CI, but since Make sure config providers are unique the ConfigAggregator explodes.

Current behavior

The component installer injects ConfigProviders even tough they are already imported as aliases, and therefore the ConfigAggregator explodes.

How to reproduce

Install a package, where the component installer injects the ConfigProvider in the application config, e.g. mezzio/mezzio-session.
The ConfigProvider is being injected into the config.php file.
Replace the Mezzio\Session\ConfigProvider import with an alias use Mezzio\Session\ConfigProvider as MezzioSessionConfigProvider; and use that alias in the providers array (MezzioSessionConfigProvider::class,.
Delete the session package from the vendor directory rm -rf vendor/mezzio/mezzio-session and reinstall it (composer install). When the component-installer asks to inject the ConfigProvider, accept that.
Now the ConfigProvider is two times in the config.

Expected behavior

Recognize the alias and don't inject the ConfigProvider.

🙂

Metadata

Metadata

Assignees

No one assigned

    Labels

    BugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions