php-cs-fixer magic

main
Jordi Boggiano 12 years ago
parent 4ea9b33a6c
commit 1bd4ccbd54

@ -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;
@ -104,6 +102,7 @@ EOF;
return false;
}
require_once \$path;
return true;
}
});
@ -278,6 +277,7 @@ EOF;
$path = substr($path, strlen($vendorPath));
$baseDir = '$vendorDir . ';
}
return $baseDir.var_export($path, true);
}

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

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

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

@ -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
{

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

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

@ -57,6 +57,7 @@ class Config
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':
@ -87,6 +88,7 @@ class Config
private function process($value)
{
$config = $this;
return preg_replace_callback('#\{\$(.+)\}#', function ($match) use ($config) {
return $config->get($match[1]);
}, $value);

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

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

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

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

@ -65,8 +65,10 @@ class Problem
if (0 === stripos($job['packageName'], 'ext-')) {
$ext = substr($job['packageName'], 4);
$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 package "'.$job['packageName'].'" '.$this->constraintToText($job['constraint']).'could not be found.';
}
}

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

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

@ -12,10 +12,8 @@
namespace Composer\DependencyResolver;
use Composer\Repository\RepositoryInterface;
use Composer\Package\PackageInterface;
use Composer\Package\AliasPackage;
use Composer\DependencyResolver\Operation;
/**
* @author Nils Adermann <naderman@naderman.de>
@ -134,7 +132,8 @@ class RuleSetGenerator
* @param int $type A TYPE_* constant defining the rule type
* @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)) {
return;
}

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Loading…
Cancel
Save