Skip to content

Commit

Permalink
php-cs-fixer magic
Browse files Browse the repository at this point in the history
  • Loading branch information
Seldaek committed May 22, 2012
1 parent 4ea9b33 commit 1bd4ccb
Show file tree
Hide file tree
Showing 90 changed files with 396 additions and 400 deletions.
8 changes: 4 additions & 4 deletions src/Composer/Autoload/AutoloadGenerator.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,7 @@
namespace Composer\Autoload;

use Composer\Installer\InstallationManager;
use Composer\Json\JsonFile;
use Composer\Package\AliasPackage;
use Composer\Package\Loader\JsonLoader;
use Composer\Package\PackageInterface;
use Composer\Repository\RepositoryInterface;
use Composer\Util\Filesystem;
Expand Down Expand Up @@ -104,6 +102,7 @@ public function dump(RepositoryInterface $localRepo, PackageInterface $mainPacka
return false;
}
require_once \$path;
return true;
}
});
Expand Down Expand Up @@ -169,7 +168,7 @@ public function buildPackageMap(InstallationManager $installationManager, Packag
/**
* Compiles an ordered list of namespace => path mappings
*
* @param array $packageMap array of array(package, installDir-relative-to-composer.json)
* @param array $packageMap array of array(package, installDir-relative-to-composer.json)
* @return array array('psr-0' => array('Ns\\Foo' => array('installDir')))
*/
public function parseAutoloads(array $packageMap)
Expand Down Expand Up @@ -205,7 +204,7 @@ public function parseAutoloads(array $packageMap)
/**
* Registers an autoloader based on an autoload map returned by parseAutoloads
*
* @param array $autoloads see parseAutoloads return value
* @param array $autoloads see parseAutoloads return value
* @return ClassLoader
*/
public function createLoader(array $autoloads)
Expand Down Expand Up @@ -278,6 +277,7 @@ protected function getPathCode(Filesystem $filesystem, $relVendorPath, $vendorPa
$path = substr($path, strlen($vendorPath));
$baseDir = '$vendorDir . ';
}

return $baseDir.var_export($path, true);
}

Expand Down
8 changes: 5 additions & 3 deletions src/Composer/Autoload/ClassLoader.php
Original file line number Diff line number Diff line change
Expand Up @@ -77,15 +77,16 @@ public function addClassMap(array $classMap)
/**
* Registers a set of classes
*
* @param string $prefix The classes prefix
* @param array|string $paths The location(s) of the classes
* @param string $prefix The classes prefix
* @param array|string $paths The location(s) of the classes
*/
public function add($prefix, $paths)
{
if (!$prefix) {
foreach ((array) $paths as $path) {
$this->fallbackDirs[] = $path;
}

return;
}
if (isset($this->prefixes[$prefix])) {
Expand Down Expand Up @@ -140,13 +141,14 @@ public function unregister()
/**
* Loads the given class or interface.
*
* @param string $class The name of the class
* @param string $class The name of the class
* @return Boolean|null True, if loaded
*/
public function loadClass($class)
{
if ($file = $this->findFile($class)) {
require $file;

return true;
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/Composer/Autoload/ClassMapGenerator.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ class ClassMapGenerator
* Generate a class map file
*
* @param Traversable $dirs Directories or a single path to search in
* @param string $file The name of the class map file
* @param string $file The name of the class map file
*/
static public function dump($dirs, $file)
{
Expand Down
1 change: 1 addition & 0 deletions src/Composer/Command/CreateProjectCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,7 @@ public function installProject(IOInterface $io, $packageName, $directory = null,
protected function createDownloadManager(IOInterface $io)
{
$factory = new Factory();

return $factory->createDownloadManager($io);
}
}
Expand Down
9 changes: 4 additions & 5 deletions src/Composer/Command/DependsCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
namespace Composer\Command;

use Composer\Composer;
use Composer\Package\PackageInterface;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Input\InputArgument;
use Symfony\Component\Console\Input\InputOption;
Expand Down Expand Up @@ -64,9 +63,9 @@ protected function execute(InputInterface $input, OutputInterface $output)
/**
* finds a list of packages which depend on another package
*
* @param InputInterface $input
* @param OutputInterface $output
* @param Composer $composer
* @param InputInterface $input
* @param OutputInterface $output
* @param Composer $composer
* @return array
* @throws \InvalidArgumentException
*/
Expand Down Expand Up @@ -117,4 +116,4 @@ private function printPackages(InputInterface $input, OutputInterface $output, a
$output->writeln($package);
}
}
}
}
7 changes: 3 additions & 4 deletions src/Composer/Command/Helper/DialogHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
namespace Composer\Command\Helper;

use Symfony\Component\Console\Helper\DialogHelper as BaseDialogHelper;
use Symfony\Component\Console\Output\OutputInterface;

class DialogHelper extends BaseDialogHelper
{
Expand All @@ -23,8 +22,8 @@ class DialogHelper extends BaseDialogHelper
* "Do you want to continue [yes]:"
*
* @param string $question The question you want to ask
* @param mixed $default Default value to add to message, if false no default will be shown
* @param string $sep Separation char for between message and user input
* @param mixed $default Default value to add to message, if false no default will be shown
* @param string $sep Separation char for between message and user input
*
* @return string
*/
Expand All @@ -34,4 +33,4 @@ public function getQuestion($question, $default = null, $sep = ':')
sprintf('<info>%s</info> [<comment>%s</comment>]%s ', $question, $default, $sep) :
sprintf('<info>%s</info>%s ', $question, $sep);
}
}
}
3 changes: 2 additions & 1 deletion src/Composer/Command/InitCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -333,6 +333,7 @@ protected function getGitConfig()
foreach ($matches as $match) {
$this->gitConfig[$match[1]] = $match[2];
}

return $this->gitConfig;
}

Expand Down Expand Up @@ -389,4 +390,4 @@ protected function addVendorIgnore($ignoreFile, $vendor = 'vendor')

file_put_contents($ignoreFile, $contents . $vendor. "\n");
}
}
}
4 changes: 2 additions & 2 deletions src/Composer/Command/SearchCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -118,8 +118,8 @@ protected function execute(InputInterface $input, OutputInterface $output)
/**
* tries to find a token within the name/keywords/description
*
* @param PackageInterface $package
* @param string $token
* @param PackageInterface $package
* @param string $token
* @return boolean
*/
private function matchPackage(PackageInterface $package, $token)
Expand Down
4 changes: 3 additions & 1 deletion src/Composer/Command/ShowCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@ protected function execute(InputInterface $input, OutputInterface $output)
$this->printLinks($input, $output, $package, 'provides');
$this->printLinks($input, $output, $package, 'conflicts');
$this->printLinks($input, $output, $package, 'replaces');

return;
}

Expand Down Expand Up @@ -125,7 +126,7 @@ protected function execute(InputInterface $input, OutputInterface $output)
/**
* finds a package by name and version if provided
*
* @param InputInterface $input
* @param InputInterface $input
* @return PackageInterface
* @throws \InvalidArgumentException
*/
Expand Down Expand Up @@ -192,6 +193,7 @@ protected function printVersions(InputInterface $input, OutputInterface $output,
{
if ($input->getArgument('version')) {
$output->writeln('<info>version</info> : ' . $package->getPrettyVersion());

return;
}

Expand Down
2 changes: 1 addition & 1 deletion src/Composer/Command/ValidateCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ protected function configure()
}

/**
* @param InputInterface $input
* @param InputInterface $input
* @param OutputInterface $output
*
* @return int
Expand Down
4 changes: 2 additions & 2 deletions src/Composer/Compiler.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ class Compiler
* Compiles composer into a single phar file
*
* @throws \RuntimeException
* @param string $pharFile The full path to the file to create
* @param string $pharFile The full path to the file to create
*/
public function compile($pharFile = 'composer.phar')
{
Expand Down Expand Up @@ -135,7 +135,7 @@ private function addComposerBin($phar)
/**
* Removes whitespace from a PHP source string while preserving line numbers.
*
* @param string $source A PHP string
* @param string $source A PHP string
* @return string The PHP string with the whitespace removed
*/
private function stripWhitespace($source)
Expand Down
6 changes: 4 additions & 2 deletions src/Composer/Config.php
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ public function merge(array $config)
/**
* Returns a setting
*
* @param string $key
* @param string $key
* @return mixed
*/
public function get($key)
Expand All @@ -57,6 +57,7 @@ public function get($key)
case 'process-timeout':
// convert foo-bar to COMPOSER_FOO_BAR and check if it exists since it overrides the local config
$env = 'COMPOSER_' . strtoupper(strtr($key, '-', '_'));

return $this->process(getenv($env) ?: $this->config[$key]);

case 'home':
Expand All @@ -70,7 +71,7 @@ public function get($key)
/**
* Checks whether a setting exists
*
* @param string $key
* @param string $key
* @return Boolean
*/
public function has($key)
Expand All @@ -87,6 +88,7 @@ public function has($key)
private function process($value)
{
$config = $this;

return preg_replace_callback('#\{\$(.+)\}#', function ($match) use ($config) {
return $config->get($match[1]);
}, $value);
Expand Down
5 changes: 2 additions & 3 deletions src/Composer/DependencyResolver/DefaultPolicy.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@

namespace Composer\DependencyResolver;

use Composer\Repository\RepositoryInterface;
use Composer\Package\PackageInterface;
use Composer\Package\AliasPackage;
use Composer\Package\LinkConstraint\VersionConstraint;
Expand Down Expand Up @@ -179,7 +178,7 @@ protected function pruneToBestVersion(Pool $pool, $literals)
if ($this->versionCompare($package, $bestPackage, '>')) {
$bestPackage = $package;
$bestLiterals = array($literal);
} else if ($this->versionCompare($package, $bestPackage, '==')) {
} elseif ($this->versionCompare($package, $bestPackage, '==')) {
$bestLiterals[] = $literal;
}
}
Expand All @@ -199,7 +198,7 @@ protected function selectNewestPackages(array $installedMap, array $literals)
if ($this->versionCompare($literal->getPackage(), $maxPackage, '>')) {
$maxPackage = $literal->getPackage();
$maxLiterals = array($literal);
} else if ($this->versionCompare($literal->getPackage(), $maxPackage, '==')) {
} elseif ($this->versionCompare($literal->getPackage(), $maxPackage, '==')) {
$maxLiterals[] = $literal;
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@ class InstallOperation extends SolverOperation
/**
* Initializes operation.
*
* @param PackageInterface $package package instance
* @param string $reason operation reason
* @param PackageInterface $package package instance
* @param string $reason operation reason
*/
public function __construct(PackageInterface $package, $reason = null)
{
Expand All @@ -39,7 +39,7 @@ public function __construct(PackageInterface $package, $reason = null)
/**
* Returns package instance.
*
* @return PackageInterface
* @return PackageInterface
*/
public function getPackage()
{
Expand All @@ -49,7 +49,7 @@ public function getPackage()
/**
* Returns job type.
*
* @return string
* @return string
*/
public function getJobType()
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@ class MarkAliasInstalledOperation extends SolverOperation
/**
* Initializes operation.
*
* @param PackageInterface $package package instance
* @param string $reason operation reason
* @param PackageInterface $package package instance
* @param string $reason operation reason
*/
public function __construct(AliasPackage $package, $reason = null)
{
Expand All @@ -39,7 +39,7 @@ public function __construct(AliasPackage $package, $reason = null)
/**
* Returns package instance.
*
* @return PackageInterface
* @return PackageInterface
*/
public function getPackage()
{
Expand All @@ -49,7 +49,7 @@ public function getPackage()
/**
* Returns job type.
*
* @return string
* @return string
*/
public function getJobType()
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@ class MarkAliasUninstalledOperation extends SolverOperation
/**
* Initializes operation.
*
* @param PackageInterface $package package instance
* @param string $reason operation reason
* @param PackageInterface $package package instance
* @param string $reason operation reason
*/
public function __construct(AliasPackage $package, $reason = null)
{
Expand All @@ -39,7 +39,7 @@ public function __construct(AliasPackage $package, $reason = null)
/**
* Returns package instance.
*
* @return PackageInterface
* @return PackageInterface
*/
public function getPackage()
{
Expand All @@ -49,7 +49,7 @@ public function getPackage()
/**
* Returns job type.
*
* @return string
* @return string
*/
public function getJobType()
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@

namespace Composer\DependencyResolver\Operation;

use Composer\Package\PackageInterface;

/**
* Solver operation interface.
Expand All @@ -24,14 +23,14 @@ interface OperationInterface
/**
* Returns job type.
*
* @return string
* @return string
*/
function getJobType();

/**
* Returns operation reason.
*
* @return string
* @return string
*/
function getReason();

Expand Down
Loading

0 comments on commit 1bd4ccb

Please sign in to comment.