1
0
Fork 0

Coding standards and Cosmetics

Processing feedback given by @stof and @Seldaek.
pull/665/head
Paul Seiffert 2012-05-09 09:50:08 +02:00
parent e4a0de5df4
commit 1713acf011
4 changed files with 21 additions and 26 deletions

View File

@ -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;
}

View File

@ -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);

View File

@ -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);
}

View File

@ -165,7 +165,7 @@ class RepositoryManager
/**
* Returns all local repositories for the project.
*
* @return array[RepositoryInterface]
* @return array[WritableRepositoryInterface]
*/
public function getLocalRepositories()
{