diff --git a/src/Composer/Command/Command.php b/src/Composer/Command/Command.php index dc3183ee3..227ee0479 100644 --- a/src/Composer/Command/Command.php +++ b/src/Composer/Command/Command.php @@ -12,8 +12,11 @@ namespace Composer\Command; +use Composer\Composer; +use Composer\Console\Application; +use Composer\IO\IOInterface; +use Composer\IO\NullIO; use Symfony\Component\Console\Command\Command as BaseCommand; -use Composer\Console\Application as ComposerApplication; /** * Base class for Composer commands @@ -41,43 +44,45 @@ abstract class Command extends BaseCommand { if (null === $this->composer) { $application = $this->getApplication(); - if ($application instanceof ComposerApplication) { - /* @var $application ComposerApplication */ + if ($application instanceof Application) { + /* @var $application Application */ $this->composer = $application->getComposer(); } } + return $this->composer; } /** * @param \Composer\Composer $composer */ - public function setComposer(\Composer\Composer $composer) + public function setComposer(Composer $composer) { $this->composer = $composer; } /** - * @return \Composer\IO\ConsoleIO + * @return \Composer\IO\IOInterface */ public function getIO() { if (null === $this->io) { $application = $this->getApplication(); - if ($application instanceof ComposerApplication) { - /* @var $application ComposerApplication */ + if ($application instanceof Application) { + /* @var $application Application */ $this->io = $application->getIO(); } else { - $this->io = new \Composer\IO\NullIO(); + $this->io = new NullIO(); } } + return $this->io; } /** * @param \Composer\IO\IOInterface $io */ - public function setIO(\Composer\IO\IOInterface $io) + public function setIO(IOInterface $io) { $this->io = $io; } diff --git a/src/Composer/Factory.php b/src/Composer/Factory.php index 7872b8d0c..76f68203c 100644 --- a/src/Composer/Factory.php +++ b/src/Composer/Factory.php @@ -28,7 +28,6 @@ use Composer\Util\RemoteFilesystem; class Factory { /** - * @static * @return Config */ public static function createConfig() @@ -66,9 +65,9 @@ class Factory /** * Creates a Composer instance * - * @param IOInterface $io IO instance - * @param array|null $localConfig either a configuration array or a filename to read from, if null it will - * read from the default filename + * @param IOInterface $io IO instance + * @param array|string|null $localConfig either a configuration array or a filename to read from, if null it will + * read from the default filename * @throws \InvalidArgumentException * @return Composer */ @@ -169,8 +168,8 @@ class Factory } /** - * @param Repository\RepositoryManager $rm - * @param $vendorDir + * @param Repository\RepositoryManager $rm + * @param string $vendorDir */ protected function addLocalRepository(RepositoryManager $rm, $vendorDir) { @@ -273,7 +272,7 @@ class Factory protected function purgePackages(Repository\RepositoryManager $rm, Installer\InstallationManager $im) { foreach ($rm->getLocalRepositories() as $repo) { - /* @var $repo Repository\RepositoryInterface */ + /* @var $repo Repository\WritableRepositoryInterface */ foreach ($repo->getPackages() as $package) { if (!$im->isPackageInstalled($repo, $package)) { $repo->removePackage($package); diff --git a/src/Composer/Repository/RepositoryInterface.php b/src/Composer/Repository/RepositoryInterface.php index b32872ef1..e4a79695d 100644 --- a/src/Composer/Repository/RepositoryInterface.php +++ b/src/Composer/Repository/RepositoryInterface.php @@ -57,13 +57,4 @@ interface RepositoryInterface extends \Countable * @return array */ function getPackages(); - - /** - * Removes a package from the repository. - * - * @abstract - * @param \Composer\Package\PackageInterface $package - * @return void - */ - function removePackage(PackageInterface $package); } diff --git a/src/Composer/Repository/RepositoryManager.php b/src/Composer/Repository/RepositoryManager.php index febce81a3..8c36859dc 100644 --- a/src/Composer/Repository/RepositoryManager.php +++ b/src/Composer/Repository/RepositoryManager.php @@ -165,7 +165,7 @@ class RepositoryManager /** * Returns all local repositories for the project. * - * @return array[RepositoryInterface] + * @return array[WritableRepositoryInterface] */ public function getLocalRepositories() {