1
0
Fork 0

php-cs-fixer magic

pull/722/merge
Jordi Boggiano 2012-05-22 12:07:08 +02:00
parent 4ea9b33a6c
commit 1bd4ccbd54
90 changed files with 396 additions and 400 deletions

View File

@ -13,9 +13,7 @@
namespace Composer\Autoload; namespace Composer\Autoload;
use Composer\Installer\InstallationManager; use Composer\Installer\InstallationManager;
use Composer\Json\JsonFile;
use Composer\Package\AliasPackage; use Composer\Package\AliasPackage;
use Composer\Package\Loader\JsonLoader;
use Composer\Package\PackageInterface; use Composer\Package\PackageInterface;
use Composer\Repository\RepositoryInterface; use Composer\Repository\RepositoryInterface;
use Composer\Util\Filesystem; use Composer\Util\Filesystem;
@ -104,6 +102,7 @@ EOF;
return false; return false;
} }
require_once \$path; require_once \$path;
return true; return true;
} }
}); });
@ -278,6 +277,7 @@ EOF;
$path = substr($path, strlen($vendorPath)); $path = substr($path, strlen($vendorPath));
$baseDir = '$vendorDir . '; $baseDir = '$vendorDir . ';
} }
return $baseDir.var_export($path, true); return $baseDir.var_export($path, true);
} }

View File

@ -86,6 +86,7 @@ class ClassLoader
foreach ((array) $paths as $path) { foreach ((array) $paths as $path) {
$this->fallbackDirs[] = $path; $this->fallbackDirs[] = $path;
} }
return; return;
} }
if (isset($this->prefixes[$prefix])) { if (isset($this->prefixes[$prefix])) {
@ -147,6 +148,7 @@ class ClassLoader
{ {
if ($file = $this->findFile($class)) { if ($file = $this->findFile($class)) {
require $file; require $file;
return true; return true;
} }
} }

View File

@ -135,6 +135,7 @@ EOT
protected function createDownloadManager(IOInterface $io) protected function createDownloadManager(IOInterface $io)
{ {
$factory = new Factory(); $factory = new Factory();
return $factory->createDownloadManager($io); return $factory->createDownloadManager($io);
} }
} }

View File

@ -13,7 +13,6 @@
namespace Composer\Command; namespace Composer\Command;
use Composer\Composer; use Composer\Composer;
use Composer\Package\PackageInterface;
use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Input\InputArgument; use Symfony\Component\Console\Input\InputArgument;
use Symfony\Component\Console\Input\InputOption; use Symfony\Component\Console\Input\InputOption;

View File

@ -13,7 +13,6 @@
namespace Composer\Command\Helper; namespace Composer\Command\Helper;
use Symfony\Component\Console\Helper\DialogHelper as BaseDialogHelper; use Symfony\Component\Console\Helper\DialogHelper as BaseDialogHelper;
use Symfony\Component\Console\Output\OutputInterface;
class DialogHelper extends BaseDialogHelper class DialogHelper extends BaseDialogHelper
{ {

View File

@ -333,6 +333,7 @@ EOT
foreach ($matches as $match) { foreach ($matches as $match) {
$this->gitConfig[$match[1]] = $match[2]; $this->gitConfig[$match[1]] = $match[2];
} }
return $this->gitConfig; return $this->gitConfig;
} }

View File

@ -89,6 +89,7 @@ EOT
$this->printLinks($input, $output, $package, 'provides'); $this->printLinks($input, $output, $package, 'provides');
$this->printLinks($input, $output, $package, 'conflicts'); $this->printLinks($input, $output, $package, 'conflicts');
$this->printLinks($input, $output, $package, 'replaces'); $this->printLinks($input, $output, $package, 'replaces');
return; return;
} }
@ -192,6 +193,7 @@ EOT
{ {
if ($input->getArgument('version')) { if ($input->getArgument('version')) {
$output->writeln('<info>version</info> : ' . $package->getPrettyVersion()); $output->writeln('<info>version</info> : ' . $package->getPrettyVersion());
return; return;
} }

View File

@ -57,6 +57,7 @@ class Config
case 'process-timeout': case 'process-timeout':
// convert foo-bar to COMPOSER_FOO_BAR and check if it exists since it overrides the local config // convert foo-bar to COMPOSER_FOO_BAR and check if it exists since it overrides the local config
$env = 'COMPOSER_' . strtoupper(strtr($key, '-', '_')); $env = 'COMPOSER_' . strtoupper(strtr($key, '-', '_'));
return $this->process(getenv($env) ?: $this->config[$key]); return $this->process(getenv($env) ?: $this->config[$key]);
case 'home': case 'home':
@ -87,6 +88,7 @@ class Config
private function process($value) private function process($value)
{ {
$config = $this; $config = $this;
return preg_replace_callback('#\{\$(.+)\}#', function ($match) use ($config) { return preg_replace_callback('#\{\$(.+)\}#', function ($match) use ($config) {
return $config->get($match[1]); return $config->get($match[1]);
}, $value); }, $value);

View File

@ -12,7 +12,6 @@
namespace Composer\DependencyResolver; namespace Composer\DependencyResolver;
use Composer\Repository\RepositoryInterface;
use Composer\Package\PackageInterface; use Composer\Package\PackageInterface;
use Composer\Package\AliasPackage; use Composer\Package\AliasPackage;
use Composer\Package\LinkConstraint\VersionConstraint; use Composer\Package\LinkConstraint\VersionConstraint;

View File

@ -12,7 +12,6 @@
namespace Composer\DependencyResolver\Operation; namespace Composer\DependencyResolver\Operation;
use Composer\Package\PackageInterface;
/** /**
* Solver operation interface. * Solver operation interface.

View File

@ -12,7 +12,6 @@
namespace Composer\DependencyResolver; namespace Composer\DependencyResolver;
use Composer\Repository\RepositoryInterface;
use Composer\Package\PackageInterface; use Composer\Package\PackageInterface;
/** /**

View File

@ -155,6 +155,7 @@ class Pool
public function literalToPackage($literal) public function literalToPackage($literal)
{ {
$packageId = abs($literal); $packageId = abs($literal);
return $this->packageById($packageId); return $this->packageById($packageId);
} }

View File

@ -65,8 +65,10 @@ class Problem
if (0 === stripos($job['packageName'], 'ext-')) { if (0 === stripos($job['packageName'], 'ext-')) {
$ext = substr($job['packageName'], 4); $ext = substr($job['packageName'], 4);
$error = extension_loaded($ext) ? 'has the wrong version ('.phpversion($ext).') installed' : 'is missing from your system'; $error = extension_loaded($ext) ? 'has the wrong version ('.phpversion($ext).') installed' : 'is missing from your system';
return 'The requested PHP extension "'.$job['packageName'].'" '.$this->constraintToText($job['constraint']).$error.'.'; return 'The requested PHP extension "'.$job['packageName'].'" '.$this->constraintToText($job['constraint']).$error.'.';
} }
return 'The requested package "'.$job['packageName'].'" '.$this->constraintToText($job['constraint']).'could not be found.'; return 'The requested package "'.$job['packageName'].'" '.$this->constraintToText($job['constraint']).'could not be found.';
} }
} }

View File

@ -170,6 +170,7 @@ class Rule
case self::RULE_PACKAGE_CONFLICT: case self::RULE_PACKAGE_CONFLICT:
$package1 = $this->pool->literalToPackage($this->literals[0]); $package1 = $this->pool->literalToPackage($this->literals[0]);
$package2 = $this->pool->literalToPackage($this->literals[1]); $package2 = $this->pool->literalToPackage($this->literals[1]);
return 'Package "'.$package1.'" conflicts with "'.$package2.'"'; return 'Package "'.$package1.'" conflicts with "'.$package2.'"';
case self::RULE_PACKAGE_REQUIRES: case self::RULE_PACKAGE_REQUIRES:
@ -188,6 +189,7 @@ class Rule
} else { } else {
$text .= 'No package satisfies this dependency.'; $text .= 'No package satisfies this dependency.';
} }
return $text; return $text;
case self::RULE_PACKAGE_OBSOLETES: case self::RULE_PACKAGE_OBSOLETES:

View File

@ -93,16 +93,14 @@ class RuleSet implements \IteratorAggregate, \Countable
public function getIteratorFor($types) public function getIteratorFor($types)
{ {
if (!is_array($types)) if (!is_array($types)) {
{
$types = array($types); $types = array($types);
} }
$allRules = $this->getRules(); $allRules = $this->getRules();
$rules = array(); $rules = array();
foreach ($types as $type) foreach ($types as $type) {
{
$rules[$type] = $allRules[$type]; $rules[$type] = $allRules[$type];
} }
@ -112,15 +110,13 @@ class RuleSet implements \IteratorAggregate, \Countable
public function getIteratorWithout($types) public function getIteratorWithout($types)
{ {
if (!is_array($types)) if (!is_array($types)) {
{
$types = array($types); $types = array($types);
} }
$rules = $this->getRules(); $rules = $this->getRules();
foreach ($types as $type) foreach ($types as $type) {
{
unset($rules[$type]); unset($rules[$type]);
} }
@ -131,6 +127,7 @@ class RuleSet implements \IteratorAggregate, \Countable
{ {
$types = self::$types; $types = self::$types;
unset($types[-1]); unset($types[-1]);
return array_keys($types); return array_keys($types);
} }

View File

@ -12,10 +12,8 @@
namespace Composer\DependencyResolver; namespace Composer\DependencyResolver;
use Composer\Repository\RepositoryInterface;
use Composer\Package\PackageInterface; use Composer\Package\PackageInterface;
use Composer\Package\AliasPackage; use Composer\Package\AliasPackage;
use Composer\DependencyResolver\Operation;
/** /**
* @author Nils Adermann <naderman@naderman.de> * @author Nils Adermann <naderman@naderman.de>
@ -134,7 +132,8 @@ class RuleSetGenerator
* @param int $type A TYPE_* constant defining the rule type * @param int $type A TYPE_* constant defining the rule type
* @param Rule $newRule The rule about to be added * @param Rule $newRule The rule about to be added
*/ */
private function addRule($type, Rule $newRule = null) { private function addRule($type, Rule $newRule = null)
{
if ($this->rules->containsEqual($newRule)) { if ($this->rules->containsEqual($newRule)) {
return; return;
} }

View File

@ -13,8 +13,6 @@
namespace Composer\DependencyResolver; namespace Composer\DependencyResolver;
use Composer\Repository\RepositoryInterface; use Composer\Repository\RepositoryInterface;
use Composer\Package\AliasPackage;
use Composer\DependencyResolver\Operation;
/** /**
* @author Nils Adermann <naderman@naderman.de> * @author Nils Adermann <naderman@naderman.de>
@ -202,12 +200,14 @@ class Solver
} }
$transaction = new Transaction($this->policy, $this->pool, $this->installedMap, $this->decisionMap, $this->decisionQueue, $this->decisionQueueWhy); $transaction = new Transaction($this->policy, $this->pool, $this->installedMap, $this->decisionMap, $this->decisionQueue, $this->decisionQueueWhy);
return $transaction->getOperations(); return $transaction->getOperations();
} }
protected function literalFromId($id) protected function literalFromId($id)
{ {
$package = $this->pool->packageById(abs($id)); $package = $this->pool->packageById(abs($id));
return new Literal($package, $id > 0); return new Literal($package, $id > 0);
} }
@ -241,6 +241,7 @@ class Solver
public function decisionsContain($literal) public function decisionsContain($literal)
{ {
$packageId = abs($literal); $packageId = abs($literal);
return ( return (
$this->decisionMap[$packageId] > 0 && $literal > 0 || $this->decisionMap[$packageId] > 0 && $literal > 0 ||
$this->decisionMap[$packageId] < 0 && $literal < 0 $this->decisionMap[$packageId] < 0 && $literal < 0
@ -250,6 +251,7 @@ class Solver
protected function decisionsSatisfy($literal) protected function decisionsSatisfy($literal)
{ {
$packageId = abs($literal); $packageId = abs($literal);
return ( return (
$literal > 0 && $this->decisionMap[$packageId] > 0 || $literal > 0 && $this->decisionMap[$packageId] > 0 ||
$literal < 0 && $this->decisionMap[$packageId] < 0 $literal < 0 && $this->decisionMap[$packageId] < 0
@ -259,6 +261,7 @@ class Solver
public function decisionsConflict($literal) public function decisionsConflict($literal)
{ {
$packageId = abs($literal); $packageId = abs($literal);
return ( return (
($this->decisionMap[$packageId] > 0 && $literal < 0) || ($this->decisionMap[$packageId] > 0 && $literal < 0) ||
($this->decisionMap[$packageId] < 0 && $literal > 0) ($this->decisionMap[$packageId] < 0 && $literal > 0)
@ -274,7 +277,8 @@ class Solver
return $this->decisionMap[$packageId] == 0; return $this->decisionMap[$packageId] == 0;
} }
protected function decidedInstall($packageId) { protected function decidedInstall($packageId)
{
return $this->decisionMap[$packageId] > 0; return $this->decisionMap[$packageId] > 0;
} }
@ -535,6 +539,7 @@ class Solver
foreach ($problemRules as $problemRule) { foreach ($problemRules as $problemRule) {
$this->analyzeUnsolvableRule($problem, $problemRule); $this->analyzeUnsolvableRule($problem, $problemRule);
} }
return; return;
} }
@ -600,6 +605,7 @@ class Solver
} }
$this->resetSolver(); $this->resetSolver();
return 1; return 1;
} }

View File

@ -12,7 +12,6 @@
namespace Composer\Downloader; namespace Composer\Downloader;
use Composer\IO\IOInterface;
use Composer\Package\PackageInterface; use Composer\Package\PackageInterface;
/** /**

View File

@ -175,6 +175,7 @@ class DownloadManager
if ($target->isDev() && 'dist' === $installationSource) { if ($target->isDev() && 'dist' === $installationSource) {
$downloader->remove($initial, $targetDir); $downloader->remove($initial, $targetDir);
$this->download($target, $targetDir); $this->download($target, $targetDir);
return; return;
} }

View File

@ -13,7 +13,6 @@
namespace Composer\Downloader; namespace Composer\Downloader;
use Composer\Package\PackageInterface; use Composer\Package\PackageInterface;
use Composer\Util\ProcessExecutor;
/** /**
* @author Jordi Boggiano <j.boggiano@seld.be> * @author Jordi Boggiano <j.boggiano@seld.be>

View File

@ -13,7 +13,6 @@
namespace Composer\Downloader; namespace Composer\Downloader;
use Composer\Package\PackageInterface; use Composer\Package\PackageInterface;
use Composer\Util\ProcessExecutor;
/** /**
* @author Per Bernhardt <plb@webfactory.de> * @author Per Bernhardt <plb@webfactory.de>

View File

@ -12,7 +12,6 @@
namespace Composer\Downloader; namespace Composer\Downloader;
use Composer\Package\PackageInterface;
/** /**
* Downloader for pear packages * Downloader for pear packages

View File

@ -12,7 +12,6 @@
namespace Composer\Downloader; namespace Composer\Downloader;
use Composer\Package\PackageInterface;
/** /**
* Downloader for phar files * Downloader for phar files

View File

@ -13,7 +13,6 @@
namespace Composer\Downloader; namespace Composer\Downloader;
use Composer\Package\PackageInterface; use Composer\Package\PackageInterface;
use Composer\Util\ProcessExecutor;
use Composer\Util\Svn as SvnUtil; use Composer\Util\Svn as SvnUtil;
/** /**

View File

@ -12,7 +12,6 @@
namespace Composer\Downloader; namespace Composer\Downloader;
use Composer\Package\PackageInterface;
/** /**
* Downloader for tar files: tar, tar.gz or tar.bz2 * Downloader for tar files: tar, tar.gz or tar.bz2

View File

@ -12,7 +12,6 @@
namespace Composer\Downloader; namespace Composer\Downloader;
use Composer\Package\PackageInterface;
use Composer\Util\ProcessExecutor; use Composer\Util\ProcessExecutor;
use Composer\IO\IOInterface; use Composer\IO\IOInterface;
use ZipArchive; use ZipArchive;

View File

@ -13,9 +13,7 @@
namespace Composer\IO; namespace Composer\IO;
use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Input\InputDefinition;
use Symfony\Component\Console\Output\OutputInterface; use Symfony\Component\Console\Output\OutputInterface;
use Symfony\Component\Console\Formatter\OutputFormatterInterface;
use Symfony\Component\Console\Helper\HelperSet; use Symfony\Component\Console\Helper\HelperSet;
/** /**

View File

@ -27,7 +27,6 @@ use Composer\Package\Link;
use Composer\Package\LinkConstraint\VersionConstraint; use Composer\Package\LinkConstraint\VersionConstraint;
use Composer\Package\Locker; use Composer\Package\Locker;
use Composer\Package\PackageInterface; use Composer\Package\PackageInterface;
use Composer\Repository\ArrayRepository;
use Composer\Repository\CompositeRepository; use Composer\Repository\CompositeRepository;
use Composer\Repository\InstalledArrayRepository; use Composer\Repository\InstalledArrayRepository;
use Composer\Repository\PlatformRepository; use Composer\Repository\PlatformRepository;

View File

@ -213,6 +213,7 @@ class InstallationManager
public function getInstallPath(PackageInterface $package) public function getInstallPath(PackageInterface $package)
{ {
$installer = $this->getInstaller($package->getType()); $installer = $this->getInstaller($package->getType());
return $installer->getInstallPath($package); return $installer->getInstallPath($package);
} }

View File

@ -16,7 +16,6 @@ use Composer\IO\IOInterface;
use Composer\Autoload\AutoloadGenerator; use Composer\Autoload\AutoloadGenerator;
use Composer\Downloader\DownloadManager; use Composer\Downloader\DownloadManager;
use Composer\Repository\InstalledRepositoryInterface; use Composer\Repository\InstalledRepositoryInterface;
use Composer\DependencyResolver\Operation\OperationInterface;
use Composer\Package\PackageInterface; use Composer\Package\PackageInterface;
/** /**

View File

@ -12,7 +12,6 @@
namespace Composer\Installer; namespace Composer\Installer;
use Composer\DependencyResolver\Operation\OperationInterface;
use Composer\Package\PackageInterface; use Composer\Package\PackageInterface;
use Composer\Repository\InstalledRepositoryInterface; use Composer\Repository\InstalledRepositoryInterface;

View File

@ -15,7 +15,6 @@ namespace Composer\Installer;
use Composer\IO\IOInterface; use Composer\IO\IOInterface;
use Composer\Downloader\DownloadManager; use Composer\Downloader\DownloadManager;
use Composer\Repository\InstalledRepositoryInterface; use Composer\Repository\InstalledRepositoryInterface;
use Composer\DependencyResolver\Operation\OperationInterface;
use Composer\Package\PackageInterface; use Composer\Package\PackageInterface;
use Composer\Util\Filesystem; use Composer\Util\Filesystem;

View File

@ -12,7 +12,6 @@
namespace Composer\Installer; namespace Composer\Installer;
use Composer\DependencyResolver\Operation\OperationInterface;
use Composer\Package\PackageInterface; use Composer\Package\PackageInterface;
use Composer\Downloader\DownloadManager; use Composer\Downloader\DownloadManager;
use Composer\Repository\InstalledRepositoryInterface; use Composer\Repository\InstalledRepositoryInterface;

View File

@ -12,11 +12,9 @@
namespace Composer\Json; namespace Composer\Json;
use Composer\Repository\RepositoryManager;
use Composer\Composer; use Composer\Composer;
use JsonSchema\Validator; use JsonSchema\Validator;
use Seld\JsonLint\JsonParser; use Seld\JsonLint\JsonParser;
use Composer\Util\StreamContextFactory;
use Composer\Util\RemoteFilesystem; use Composer\Util\RemoteFilesystem;
use Composer\Downloader\TransportException; use Composer\Downloader\TransportException;

View File

@ -12,10 +12,7 @@
namespace Composer\Package; namespace Composer\Package;
use Composer\Package\LinkConstraint\LinkConstraintInterface;
use Composer\Package\LinkConstraint\VersionConstraint; use Composer\Package\LinkConstraint\VersionConstraint;
use Composer\Repository\RepositoryInterface;
use Composer\Repository\PlatformRepository;
use Composer\Package\Version\VersionParser; use Composer\Package\Version\VersionParser;
/** /**

View File

@ -187,6 +187,7 @@ abstract class BasePackage implements PackageInterface
if ($package instanceof AliasPackage) { if ($package instanceof AliasPackage) {
$package = $package->getAliasOf(); $package = $package->getAliasOf();
} }
return $package === $self; return $package === $self;
} }

View File

@ -48,6 +48,7 @@ class MultiConstraint implements LinkConstraintInterface
foreach ($this->constraints as $constraint) { foreach ($this->constraints as $constraint) {
$constraints[] = $constraint->__toString(); $constraints[] = $constraint->__toString();
} }
return '['.implode(', ', $constraints).']'; return '['.implode(', ', $constraints).']';
} }
} }

View File

@ -14,7 +14,6 @@ namespace Composer\Package\Loader;
use Composer\Package; use Composer\Package;
use Composer\Package\Version\VersionParser; use Composer\Package\Version\VersionParser;
use Composer\Repository\RepositoryManager;
/** /**
* @author Konstantin Kudryashiv <ever.zet@gmail.com> * @author Konstantin Kudryashiv <ever.zet@gmail.com>

View File

@ -16,7 +16,6 @@ use Composer\Package\BasePackage;
use Composer\Package\Version\VersionParser; use Composer\Package\Version\VersionParser;
use Composer\Repository\RepositoryManager; use Composer\Repository\RepositoryManager;
use Composer\Util\ProcessExecutor; use Composer\Util\ProcessExecutor;
use Composer\Package\AliasPackage;
/** /**
* ArrayLoader built for the sole purpose of loading the root package * ArrayLoader built for the sole purpose of loading the root package

View File

@ -139,6 +139,7 @@ class VersionParser
for ($i = 1; $i < 5; $i++) { for ($i = 1; $i < 5; $i++) {
$version .= isset($matches[$i]) ? str_replace('*', 'x', $matches[$i]) : '.x'; $version .= isset($matches[$i]) ? str_replace('*', 'x', $matches[$i]) : '.x';
} }
return str_replace('x', '9999999', $version).'-dev'; return str_replace('x', '9999999', $version).'-dev';
} }
@ -220,6 +221,7 @@ class VersionParser
if (preg_match('{^(>=?|<=?|==?)?\s*(.*)}', $constraint, $matches)) { if (preg_match('{^(>=?|<=?|==?)?\s*(.*)}', $constraint, $matches)) {
try { try {
$version = $this->normalize($matches[2]); $version = $this->normalize($matches[2]);
return array(new VersionConstraint($matches[1] ?: '=', $version)); return array(new VersionConstraint($matches[1] ?: '=', $version));
} catch (\Exception $e) {} } catch (\Exception $e) {}
} }

View File

@ -140,6 +140,7 @@ class ArrayRepository implements RepositoryInterface
if (null === $this->packages) { if (null === $this->packages) {
$this->initialize(); $this->initialize();
} }
return $this->packages; return $this->packages;
} }

View File

@ -13,7 +13,6 @@
namespace Composer\Repository; namespace Composer\Repository;
use Composer\Package\Loader\ArrayLoader; use Composer\Package\Loader\ArrayLoader;
use Composer\Package\LinkConstraint\VersionConstraint;
use Composer\Package\PackageInterface; use Composer\Package\PackageInterface;
use Composer\Json\JsonFile; use Composer\Json\JsonFile;
use Composer\Cache; use Composer\Cache;

View File

@ -57,6 +57,7 @@ class CompositeRepository implements RepositoryInterface
return true; return true;
} }
} }
return false; return false;
} }
@ -72,6 +73,7 @@ class CompositeRepository implements RepositoryInterface
return $package; return $package;
} }
} }
return null; return null;
} }
@ -85,6 +87,7 @@ class CompositeRepository implements RepositoryInterface
/* @var $repository RepositoryInterface */ /* @var $repository RepositoryInterface */
$packages[] = $repository->findPackages($name, $version); $packages[] = $repository->findPackages($name, $version);
} }
return call_user_func_array('array_merge', $packages); return call_user_func_array('array_merge', $packages);
} }
@ -98,6 +101,7 @@ class CompositeRepository implements RepositoryInterface
/* @var $repository RepositoryInterface */ /* @var $repository RepositoryInterface */
$packages[] = $repository->getPackages(); $packages[] = $repository->getPackages();
} }
return call_user_func_array('array_merge', $packages); return call_user_func_array('array_merge', $packages);
} }
@ -111,6 +115,7 @@ class CompositeRepository implements RepositoryInterface
/* @var $repository RepositoryInterface */ /* @var $repository RepositoryInterface */
$total += $repository->count(); $total += $repository->count();
} }
return $total; return $total;
} }

View File

@ -13,7 +13,6 @@
namespace Composer\Repository; namespace Composer\Repository;
use Composer\Json\JsonFile; use Composer\Json\JsonFile;
use Composer\Package\PackageInterface;
use Composer\Package\AliasPackage; use Composer\Package\AliasPackage;
use Composer\Package\Loader\ArrayLoader; use Composer\Package\Loader\ArrayLoader;
use Composer\Package\Dumper\ArrayDumper; use Composer\Package\Dumper\ArrayDumper;

View File

@ -12,10 +12,6 @@
namespace Composer\Repository; namespace Composer\Repository;
use Composer\Json\JsonFile;
use Composer\Package\PackageInterface;
use Composer\Package\Loader\ArrayLoader;
use Composer\Package\Dumper\ArrayDumper;
/** /**
* Installed array repository. * Installed array repository.

View File

@ -12,10 +12,6 @@
namespace Composer\Repository; namespace Composer\Repository;
use Composer\Json\JsonFile;
use Composer\Package\PackageInterface;
use Composer\Package\Loader\ArrayLoader;
use Composer\Package\Dumper\ArrayDumper;
/** /**
* Installed filesystem repository. * Installed filesystem repository.

View File

@ -12,7 +12,6 @@
namespace Composer\Repository; namespace Composer\Repository;
use Composer\Package\PackageInterface;
/** /**
* Installable repository interface. * Installable repository interface.

View File

@ -12,10 +12,7 @@
namespace Composer\Repository; namespace Composer\Repository;
use Composer\Json\JsonFile;
use Composer\Package\PackageInterface;
use Composer\Package\Loader\ArrayLoader; use Composer\Package\Loader\ArrayLoader;
use Composer\Package\Dumper\ArrayDumper;
/** /**
* Package repository. * Package repository.

View File

@ -207,6 +207,7 @@ class PearRepository extends ArrayRepository
if (isset($data['max'])) { if (isset($data['max'])) {
$versions[] = '<=' . $data['max']; $versions[] = '<=' . $data['max'];
} }
return implode(',', $versions); return implode(',', $versions);
} }
@ -251,6 +252,7 @@ class PearRepository extends ArrayRepository
} }
} }
} }
return $data; return $data;
} }

View File

@ -98,6 +98,7 @@ class RepositoryManager
} }
$class = $this->repositoryClasses[$type]; $class = $this->repositoryClasses[$type];
return new $class($config, $this->io, $this->config); return new $class($config, $this->io, $this->config);
} }

View File

@ -148,6 +148,7 @@ class GitBitbucketDriver extends VcsDriver implements VcsDriverInterface
if ($io->isVerbose()) { if ($io->isVerbose()) {
$io->write('Skipping Bitbucket git driver for '.$url.' because the OpenSSL PHP extension is missing.'); $io->write('Skipping Bitbucket git driver for '.$url.' because the OpenSSL PHP extension is missing.');
} }
return false; return false;
} }

View File

@ -16,7 +16,6 @@ use Composer\Downloader\TransportException;
use Composer\Json\JsonFile; use Composer\Json\JsonFile;
use Composer\Cache; use Composer\Cache;
use Composer\IO\IOInterface; use Composer\IO\IOInterface;
use Composer\Util\ProcessExecutor;
use Composer\Util\RemoteFilesystem; use Composer\Util\RemoteFilesystem;
/** /**
@ -62,6 +61,7 @@ class GitHubDriver extends VcsDriver
if ($this->gitDriver) { if ($this->gitDriver) {
return $this->gitDriver->getRootIdentifier(); return $this->gitDriver->getRootIdentifier();
} }
return $this->rootIdentifier; return $this->rootIdentifier;
} }
@ -73,6 +73,7 @@ class GitHubDriver extends VcsDriver
if ($this->gitDriver) { if ($this->gitDriver) {
return $this->gitDriver->getUrl(); return $this->gitDriver->getUrl();
} }
return $this->url; return $this->url;
} }
@ -206,6 +207,7 @@ class GitHubDriver extends VcsDriver
if ($io->isVerbose()) { if ($io->isVerbose()) {
$io->write('Skipping GitHub driver for '.$url.' because the OpenSSL PHP extension is missing.'); $io->write('Skipping GitHub driver for '.$url.' because the OpenSSL PHP extension is missing.');
} }
return false; return false;
} }
@ -262,6 +264,7 @@ class GitHubDriver extends VcsDriver
$this->remoteFilesystem $this->remoteFilesystem
); );
$this->gitDriver->initialize(); $this->gitDriver->initialize();
return; return;
} }
$this->io->write('Authentication required (<info>'.$this->url.'</info>):'); $this->io->write('Authentication required (<info>'.$this->url.'</info>):');

View File

@ -148,6 +148,7 @@ class HgBitbucketDriver extends VcsDriver
if ($io->isVerbose()) { if ($io->isVerbose()) {
$io->write('Skipping Bitbucket hg driver for '.$url.' because the OpenSSL PHP extension is missing.'); $io->write('Skipping Bitbucket hg driver for '.$url.' because the OpenSSL PHP extension is missing.');
} }
return false; return false;
} }

View File

@ -171,6 +171,7 @@ class HgDriver extends VcsDriver
$processExecutor = new ProcessExecutor(); $processExecutor = new ProcessExecutor();
$exit = $processExecutor->execute(sprintf('cd %s && hg identify %s', escapeshellarg(sys_get_temp_dir()), escapeshellarg($url)), $ignored); $exit = $processExecutor->execute(sprintf('cd %s && hg identify %s', escapeshellarg(sys_get_temp_dir()), escapeshellarg($url)), $ignored);
return $exit === 0; return $exit === 0;
} }
} }

View File

@ -76,6 +76,7 @@ abstract class VcsDriver implements VcsDriverInterface
if (extension_loaded('openssl')) { if (extension_loaded('openssl')) {
return 'https'; return 'https';
} }
return 'http'; return 'http';
} }

View File

@ -15,8 +15,6 @@ namespace Composer\Repository;
use Composer\Downloader\TransportException; use Composer\Downloader\TransportException;
use Composer\Repository\Vcs\VcsDriverInterface; use Composer\Repository\Vcs\VcsDriverInterface;
use Composer\Package\Version\VersionParser; use Composer\Package\Version\VersionParser;
use Composer\Package\PackageInterface;
use Composer\Package\AliasPackage;
use Composer\Package\Loader\ArrayLoader; use Composer\Package\Loader\ArrayLoader;
use Composer\IO\IOInterface; use Composer\IO\IOInterface;
use Composer\Config; use Composer\Config;
@ -58,6 +56,7 @@ class VcsRepository extends ArrayRepository
$class = $this->drivers[$this->type]; $class = $this->drivers[$this->type];
$driver = new $class($this->url, $this->io, $this->config); $driver = new $class($this->url, $this->io, $this->config);
$driver->initialize(); $driver->initialize();
return $driver; return $driver;
} }
@ -65,6 +64,7 @@ class VcsRepository extends ArrayRepository
if ($driver::supports($this->io, $this->url)) { if ($driver::supports($this->io, $this->url)) {
$driver = new $driver($this->url, $this->io, $this->config); $driver = new $driver($this->url, $this->io, $this->config);
$driver->initialize(); $driver->initialize();
return $driver; return $driver;
} }
} }
@ -73,6 +73,7 @@ class VcsRepository extends ArrayRepository
if ($driver::supports($this->io, $this->url, true)) { if ($driver::supports($this->io, $this->url, true)) {
$driver = new $driver($this->url, $this->io, $this->config); $driver = new $driver($this->url, $this->io, $this->config);
$driver->initialize(); $driver->initialize();
return $driver; return $driver;
} }
} }

View File

@ -13,8 +13,6 @@
namespace Composer\Script; namespace Composer\Script;
use Composer\Composer; use Composer\Composer;
use Composer\IO\IOInterface;
use Composer\Package\PackageInterface;
/** /**
* The Command Event. * The Command Event.

View File

@ -12,10 +12,7 @@
namespace Composer\Script; namespace Composer\Script;
use Composer\Json\JsonFile;
use Composer\Repository\FilesystemRepository;
use Composer\Autoload\AutoloadGenerator; use Composer\Autoload\AutoloadGenerator;
use Composer\Package\PackageInterface;
use Composer\IO\IOInterface; use Composer\IO\IOInterface;
use Composer\Composer; use Composer\Composer;
use Composer\DependencyResolver\Operation\OperationInterface; use Composer\DependencyResolver\Operation\OperationInterface;

View File

@ -90,6 +90,7 @@ class Filesystem
$commonPath = rtrim($commonPath, '/') . '/'; $commonPath = rtrim($commonPath, '/') . '/';
$sourcePathDepth = substr_count(substr($from, strlen($commonPath)), '/'); $sourcePathDepth = substr_count(substr($from, strlen($commonPath)), '/');
$commonPathCode = str_repeat('../', $sourcePathDepth); $commonPathCode = str_repeat('../', $sourcePathDepth);
return ($commonPathCode . substr($to, strlen($commonPath))) ?: './'; return ($commonPathCode . substr($to, strlen($commonPath))) ?: './';
} }
@ -130,6 +131,7 @@ class Filesystem
$sourcePathDepth = substr_count(substr($from, strlen($commonPath)), '/') + $directories; $sourcePathDepth = substr_count(substr($from, strlen($commonPath)), '/') + $directories;
$commonPathCode = str_repeat('dirname(', $sourcePathDepth).'__DIR__'.str_repeat(')', $sourcePathDepth); $commonPathCode = str_repeat('dirname(', $sourcePathDepth).'__DIR__'.str_repeat(')', $sourcePathDepth);
$relTarget = substr($to, strlen($commonPath)); $relTarget = substr($to, strlen($commonPath));
return $commonPathCode . (strlen($relTarget) ? '.' . var_export('/' . $relTarget, true) : ''); return $commonPathCode . (strlen($relTarget) ? '.' . var_export('/' . $relTarget, true) : '');
} }

View File

@ -10,7 +10,8 @@
* file that was distributed with this source code. * file that was distributed with this source code.
*/ */
function includeIfExists($file) { function includeIfExists($file)
{
if (file_exists($file)) { if (file_exists($file)) {
return include $file; return include $file;
} }

View File

@ -31,6 +31,7 @@ return call_user_func(function() {
return false; return false;
} }
require_once $path; require_once $path;
return true; return true;
} }
}); });