浏览代码

Clean up RepositoryInterface, fixes #5464

Jordi Boggiano 6 年之前
父节点
当前提交
ab945a6ec1
共有 2 个文件被更改,包括 3 次插入8 次删除
  1. 2 1
      src/Composer/Repository/RepositoryInterface.php
  2. 1 7
      src/Composer/Repository/RepositoryManager.php

+ 2 - 1
src/Composer/Repository/RepositoryInterface.php

@@ -78,8 +78,9 @@ interface RepositoryInterface extends \Countable
      *
      * @param string $query search query
      * @param int    $mode  a set of SEARCH_* constants to search on, implementations should do a best effort only
+     * @param string $type  The type of package to search for. Defaults to all types of packages
      *
      * @return array[] an array of array('name' => '...', 'description' => '...')
      */
-    public function search($query, $mode = 0);
+    public function search($query, $mode = 0, $type = null);
 }

+ 1 - 7
src/Composer/Repository/RepositoryManager.php

@@ -125,13 +125,7 @@ class RepositoryManager
 
         $class = $this->repositoryClasses[$type];
 
-        $reflMethod = new \ReflectionMethod($class, '__construct');
-        $params = $reflMethod->getParameters();
-        if (isset($params[3]) && $params[3]->getClass() && $params[3]->getClass()->getName() === 'Composer\Util\HttpDownloader') {
-            return new $class($config, $this->io, $this->config, $this->httpDownloader, $this->eventDispatcher);
-        }
-
-        return new $class($config, $this->io, $this->config, $this->eventDispatcher);
+        return new $class($config, $this->io, $this->config, $this->httpDownloader, $this->eventDispatcher);
     }
 
     /**