diff --git a/src/Composer/Repository/RepositoryFactory.php b/src/Composer/Repository/RepositoryFactory.php index bbf866b9e..79e9d1aa9 100644 --- a/src/Composer/Repository/RepositoryFactory.php +++ b/src/Composer/Repository/RepositoryFactory.php @@ -153,7 +153,7 @@ class RepositoryFactory if ($repo['type'] === 'filesystem') { $repos[$name] = new FilesystemRepository($repo['json']); } else { - $repos[$name] = $rm->createRepository($repo['type'], $repo); + $repos[$name] = $rm->createRepository($repo['type'], $repo, $index); } } diff --git a/src/Composer/Repository/RepositoryManager.php b/src/Composer/Repository/RepositoryManager.php index 9038d1c94..7a7fc0a9b 100644 --- a/src/Composer/Repository/RepositoryManager.php +++ b/src/Composer/Repository/RepositoryManager.php @@ -108,15 +108,20 @@ class RepositoryManager * * @param string $type repository type * @param array $config repository configuration + * @param string $name repository name * @throws \InvalidArgumentException if repository for provided type is not registered * @return RepositoryInterface */ - public function createRepository($type, $config) + public function createRepository($type, $config, $name = null) { if (!isset($this->repositoryClasses[$type])) { throw new \InvalidArgumentException('Repository type is not registered: '.$type); } + if (isset($config['packagist']) && false === $config['packagist']) { + $this->io->writeError('Repository "'.$name.'" ('.json_encode($config).') has a packagist key which should be in its own repository definition'); + } + $class = $this->repositoryClasses[$type]; $reflMethod = new \ReflectionMethod($class, '__construct');