1
0
Fork 0

Output warning for invalid-looking packagist config, fixes #5404

pull/5435/head
Jordi Boggiano 2016-06-11 15:48:44 +01:00
parent 73d9a4717d
commit 5a3d60c0cf
2 changed files with 7 additions and 2 deletions

View File

@ -153,7 +153,7 @@ class RepositoryFactory
if ($repo['type'] === 'filesystem') { if ($repo['type'] === 'filesystem') {
$repos[$name] = new FilesystemRepository($repo['json']); $repos[$name] = new FilesystemRepository($repo['json']);
} else { } else {
$repos[$name] = $rm->createRepository($repo['type'], $repo); $repos[$name] = $rm->createRepository($repo['type'], $repo, $index);
} }
} }

View File

@ -108,15 +108,20 @@ class RepositoryManager
* *
* @param string $type repository type * @param string $type repository type
* @param array $config repository configuration * @param array $config repository configuration
* @param string $name repository name
* @throws \InvalidArgumentException if repository for provided type is not registered * @throws \InvalidArgumentException if repository for provided type is not registered
* @return RepositoryInterface * @return RepositoryInterface
*/ */
public function createRepository($type, $config) public function createRepository($type, $config, $name = null)
{ {
if (!isset($this->repositoryClasses[$type])) { if (!isset($this->repositoryClasses[$type])) {
throw new \InvalidArgumentException('Repository type is not registered: '.$type); throw new \InvalidArgumentException('Repository type is not registered: '.$type);
} }
if (isset($config['packagist']) && false === $config['packagist']) {
$this->io->writeError('<warning>Repository "'.$name.'" ('.json_encode($config).') has a packagist key which should be in its own repository definition</warning>');
}
$class = $this->repositoryClasses[$type]; $class = $this->repositoryClasses[$type];
$reflMethod = new \ReflectionMethod($class, '__construct'); $reflMethod = new \ReflectionMethod($class, '__construct');