From 1bd4ccbd54eaf0c6e44c538e649261909a0c9f6a Mon Sep 17 00:00:00 2001 From: Jordi Boggiano Date: Tue, 22 May 2012 12:07:08 +0200 Subject: [PATCH] php-cs-fixer magic --- src/Composer/Autoload/AutoloadGenerator.php | 8 +-- src/Composer/Autoload/ClassLoader.php | 8 +-- src/Composer/Autoload/ClassMapGenerator.php | 2 +- src/Composer/Command/CreateProjectCommand.php | 1 + src/Composer/Command/DependsCommand.php | 9 ++-- src/Composer/Command/Helper/DialogHelper.php | 7 ++- src/Composer/Command/InitCommand.php | 3 +- src/Composer/Command/SearchCommand.php | 4 +- src/Composer/Command/ShowCommand.php | 4 +- src/Composer/Command/ValidateCommand.php | 2 +- src/Composer/Compiler.php | 4 +- src/Composer/Config.php | 6 ++- .../DependencyResolver/DefaultPolicy.php | 5 +- .../Operation/InstallOperation.php | 8 +-- .../Operation/MarkAliasInstalledOperation.php | 8 +-- .../MarkAliasUninstalledOperation.php | 8 +-- .../Operation/OperationInterface.php | 5 +- .../Operation/SolverOperation.php | 4 +- .../Operation/UninstallOperation.php | 8 +-- .../Operation/UpdateOperation.php | 12 ++--- .../DependencyResolver/PolicyInterface.php | 1 - src/Composer/DependencyResolver/Pool.php | 3 +- src/Composer/DependencyResolver/Problem.php | 18 ++++--- src/Composer/DependencyResolver/Rule.php | 4 +- src/Composer/DependencyResolver/RuleSet.php | 13 ++--- .../DependencyResolver/RuleSetGenerator.php | 45 ++++++++-------- .../DependencyResolver/RuleWatchGraph.php | 2 +- .../DependencyResolver/RuleWatchNode.php | 2 +- src/Composer/DependencyResolver/Solver.php | 16 ++++-- .../DependencyResolver/Transaction.php | 2 +- src/Composer/Downloader/ArchiveDownloader.php | 1 - src/Composer/Downloader/DownloadManager.php | 43 ++++++++-------- .../Downloader/DownloaderInterface.php | 16 +++--- src/Composer/Downloader/FileDownloader.php | 10 ++-- src/Composer/Downloader/GitDownloader.php | 7 ++- src/Composer/Downloader/HgDownloader.php | 1 - src/Composer/Downloader/PearDownloader.php | 1 - src/Composer/Downloader/PharDownloader.php | 1 - src/Composer/Downloader/SvnDownloader.php | 1 - src/Composer/Downloader/TarDownloader.php | 1 - src/Composer/Downloader/VcsDownloader.php | 10 ++-- src/Composer/Downloader/ZipDownloader.php | 5 +- src/Composer/Factory.php | 8 +-- src/Composer/IO/ConsoleIO.php | 2 - src/Composer/IO/IOInterface.php | 16 +++--- src/Composer/Installer.php | 33 ++++++------ .../Installer/InstallationManager.php | 51 ++++++++++--------- src/Composer/Installer/InstallerInstaller.php | 13 +++-- src/Composer/Installer/InstallerInterface.php | 31 ++++++----- src/Composer/Installer/LibraryInstaller.php | 11 ++-- src/Composer/Installer/ProjectInstaller.php | 9 ++-- src/Composer/Json/JsonFile.php | 28 +++++----- src/Composer/Package/AliasPackage.php | 9 ++-- src/Composer/Package/BasePackage.php | 7 +-- .../LinkConstraint/MultiConstraint.php | 1 + src/Composer/Package/Loader/ArrayLoader.php | 1 - .../Package/Loader/RootPackageLoader.php | 1 - src/Composer/Package/Locker.php | 12 ++--- src/Composer/Package/MemoryPackage.php | 4 +- src/Composer/Package/PackageInterface.php | 10 ++-- .../Package/Version/VersionParser.php | 10 ++-- src/Composer/Repository/ArrayRepository.php | 3 +- .../Repository/ComposerRepository.php | 1 - .../Repository/CompositeRepository.php | 7 ++- .../Repository/FilesystemRepository.php | 3 +- .../Repository/InstalledArrayRepository.php | 4 -- .../InstalledFilesystemRepository.php | 4 -- .../InstalledRepositoryInterface.php | 1 - src/Composer/Repository/PackageRepository.php | 3 -- src/Composer/Repository/PearRepository.php | 30 ++++++----- .../Repository/RepositoryInterface.php | 18 +++---- src/Composer/Repository/RepositoryManager.php | 39 +++++++------- .../Repository/Vcs/GitBitbucketDriver.php | 1 + src/Composer/Repository/Vcs/GitHubDriver.php | 7 ++- .../Repository/Vcs/HgBitbucketDriver.php | 1 + src/Composer/Repository/Vcs/HgDriver.php | 1 + src/Composer/Repository/Vcs/VcsDriver.php | 11 ++-- .../Repository/Vcs/VcsDriverInterface.php | 20 ++++---- src/Composer/Repository/VcsRepository.php | 5 +- .../WritableRepositoryInterface.php | 4 +- src/Composer/Script/CommandEvent.php | 2 - src/Composer/Script/EventDispatcher.php | 7 +-- src/Composer/Script/PackageEvent.php | 6 +-- src/Composer/Util/Filesystem.php | 16 +++--- src/Composer/Util/ProcessExecutor.php | 4 +- src/Composer/Util/RemoteFilesystem.php | 2 +- src/Composer/Util/StreamContextFactory.php | 6 +-- src/Composer/Util/Svn.php | 10 ++-- src/bootstrap.php | 3 +- .../Autoload/Fixtures/autoload_target_dir.php | 1 + 90 files changed, 396 insertions(+), 400 deletions(-) diff --git a/src/Composer/Autoload/AutoloadGenerator.php b/src/Composer/Autoload/AutoloadGenerator.php index 103ed9189..4ae8bd9a7 100644 --- a/src/Composer/Autoload/AutoloadGenerator.php +++ b/src/Composer/Autoload/AutoloadGenerator.php @@ -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; } }); @@ -169,7 +168,7 @@ EOF; /** * 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) @@ -205,7 +204,7 @@ EOF; /** * 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) @@ -278,6 +277,7 @@ EOF; $path = substr($path, strlen($vendorPath)); $baseDir = '$vendorDir . '; } + return $baseDir.var_export($path, true); } diff --git a/src/Composer/Autoload/ClassLoader.php b/src/Composer/Autoload/ClassLoader.php index 2bd60bbab..146276eb6 100644 --- a/src/Composer/Autoload/ClassLoader.php +++ b/src/Composer/Autoload/ClassLoader.php @@ -77,8 +77,8 @@ class ClassLoader /** * 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) { @@ -86,6 +86,7 @@ class ClassLoader foreach ((array) $paths as $path) { $this->fallbackDirs[] = $path; } + return; } if (isset($this->prefixes[$prefix])) { @@ -140,13 +141,14 @@ class ClassLoader /** * 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; } } diff --git a/src/Composer/Autoload/ClassMapGenerator.php b/src/Composer/Autoload/ClassMapGenerator.php index 233be38fe..2fed7eb67 100644 --- a/src/Composer/Autoload/ClassMapGenerator.php +++ b/src/Composer/Autoload/ClassMapGenerator.php @@ -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) { diff --git a/src/Composer/Command/CreateProjectCommand.php b/src/Composer/Command/CreateProjectCommand.php index 4d2a3fe10..3759262ee 100644 --- a/src/Composer/Command/CreateProjectCommand.php +++ b/src/Composer/Command/CreateProjectCommand.php @@ -135,6 +135,7 @@ EOT protected function createDownloadManager(IOInterface $io) { $factory = new Factory(); + return $factory->createDownloadManager($io); } } diff --git a/src/Composer/Command/DependsCommand.php b/src/Composer/Command/DependsCommand.php index 5c06e96f5..46f6a9b5f 100644 --- a/src/Composer/Command/DependsCommand.php +++ b/src/Composer/Command/DependsCommand.php @@ -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; @@ -64,9 +63,9 @@ EOT /** * 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 */ @@ -117,4 +116,4 @@ EOT $output->writeln($package); } } -} \ No newline at end of file +} diff --git a/src/Composer/Command/Helper/DialogHelper.php b/src/Composer/Command/Helper/DialogHelper.php index d08ac1946..6fb64f27e 100644 --- a/src/Composer/Command/Helper/DialogHelper.php +++ b/src/Composer/Command/Helper/DialogHelper.php @@ -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 { @@ -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 */ @@ -34,4 +33,4 @@ class DialogHelper extends BaseDialogHelper sprintf('%s [%s]%s ', $question, $default, $sep) : sprintf('%s%s ', $question, $sep); } -} \ No newline at end of file +} diff --git a/src/Composer/Command/InitCommand.php b/src/Composer/Command/InitCommand.php index 02902adf7..f363ddb1b 100644 --- a/src/Composer/Command/InitCommand.php +++ b/src/Composer/Command/InitCommand.php @@ -333,6 +333,7 @@ EOT foreach ($matches as $match) { $this->gitConfig[$match[1]] = $match[2]; } + return $this->gitConfig; } @@ -389,4 +390,4 @@ EOT file_put_contents($ignoreFile, $contents . $vendor. "\n"); } -} \ No newline at end of file +} diff --git a/src/Composer/Command/SearchCommand.php b/src/Composer/Command/SearchCommand.php index b68776373..10ec64cd2 100644 --- a/src/Composer/Command/SearchCommand.php +++ b/src/Composer/Command/SearchCommand.php @@ -118,8 +118,8 @@ EOT /** * 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) diff --git a/src/Composer/Command/ShowCommand.php b/src/Composer/Command/ShowCommand.php index f9f211e46..aaaca2031 100644 --- a/src/Composer/Command/ShowCommand.php +++ b/src/Composer/Command/ShowCommand.php @@ -89,6 +89,7 @@ EOT $this->printLinks($input, $output, $package, 'provides'); $this->printLinks($input, $output, $package, 'conflicts'); $this->printLinks($input, $output, $package, 'replaces'); + return; } @@ -125,7 +126,7 @@ EOT /** * finds a package by name and version if provided * - * @param InputInterface $input + * @param InputInterface $input * @return PackageInterface * @throws \InvalidArgumentException */ @@ -192,6 +193,7 @@ EOT { if ($input->getArgument('version')) { $output->writeln('version : ' . $package->getPrettyVersion()); + return; } diff --git a/src/Composer/Command/ValidateCommand.php b/src/Composer/Command/ValidateCommand.php index 623304bfa..dc2693564 100644 --- a/src/Composer/Command/ValidateCommand.php +++ b/src/Composer/Command/ValidateCommand.php @@ -47,7 +47,7 @@ EOT } /** - * @param InputInterface $input + * @param InputInterface $input * @param OutputInterface $output * * @return int diff --git a/src/Composer/Compiler.php b/src/Composer/Compiler.php index 30fa1d1d3..d0d11d800 100644 --- a/src/Composer/Compiler.php +++ b/src/Composer/Compiler.php @@ -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') { @@ -135,7 +135,7 @@ class Compiler /** * 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) diff --git a/src/Composer/Config.php b/src/Composer/Config.php index 7b1ab4d21..090227340 100644 --- a/src/Composer/Config.php +++ b/src/Composer/Config.php @@ -46,7 +46,7 @@ class Config /** * Returns a setting * - * @param string $key + * @param string $key * @return mixed */ public function get($key) @@ -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': @@ -70,7 +71,7 @@ class Config /** * Checks whether a setting exists * - * @param string $key + * @param string $key * @return Boolean */ public function has($key) @@ -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); diff --git a/src/Composer/DependencyResolver/DefaultPolicy.php b/src/Composer/DependencyResolver/DefaultPolicy.php index 181993e8e..108a8d44e 100644 --- a/src/Composer/DependencyResolver/DefaultPolicy.php +++ b/src/Composer/DependencyResolver/DefaultPolicy.php @@ -12,7 +12,6 @@ namespace Composer\DependencyResolver; -use Composer\Repository\RepositoryInterface; use Composer\Package\PackageInterface; use Composer\Package\AliasPackage; use Composer\Package\LinkConstraint\VersionConstraint; @@ -179,7 +178,7 @@ class DefaultPolicy implements PolicyInterface if ($this->versionCompare($package, $bestPackage, '>')) { $bestPackage = $package; $bestLiterals = array($literal); - } else if ($this->versionCompare($package, $bestPackage, '==')) { + } elseif ($this->versionCompare($package, $bestPackage, '==')) { $bestLiterals[] = $literal; } } @@ -199,7 +198,7 @@ class DefaultPolicy implements PolicyInterface 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; } } diff --git a/src/Composer/DependencyResolver/Operation/InstallOperation.php b/src/Composer/DependencyResolver/Operation/InstallOperation.php index 4fd3bcba1..08c659c49 100644 --- a/src/Composer/DependencyResolver/Operation/InstallOperation.php +++ b/src/Composer/DependencyResolver/Operation/InstallOperation.php @@ -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) { @@ -39,7 +39,7 @@ class InstallOperation extends SolverOperation /** * Returns package instance. * - * @return PackageInterface + * @return PackageInterface */ public function getPackage() { @@ -49,7 +49,7 @@ class InstallOperation extends SolverOperation /** * Returns job type. * - * @return string + * @return string */ public function getJobType() { diff --git a/src/Composer/DependencyResolver/Operation/MarkAliasInstalledOperation.php b/src/Composer/DependencyResolver/Operation/MarkAliasInstalledOperation.php index 072ac702a..4e8c81874 100644 --- a/src/Composer/DependencyResolver/Operation/MarkAliasInstalledOperation.php +++ b/src/Composer/DependencyResolver/Operation/MarkAliasInstalledOperation.php @@ -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) { @@ -39,7 +39,7 @@ class MarkAliasInstalledOperation extends SolverOperation /** * Returns package instance. * - * @return PackageInterface + * @return PackageInterface */ public function getPackage() { @@ -49,7 +49,7 @@ class MarkAliasInstalledOperation extends SolverOperation /** * Returns job type. * - * @return string + * @return string */ public function getJobType() { diff --git a/src/Composer/DependencyResolver/Operation/MarkAliasUninstalledOperation.php b/src/Composer/DependencyResolver/Operation/MarkAliasUninstalledOperation.php index f1cd6c040..5585011b3 100644 --- a/src/Composer/DependencyResolver/Operation/MarkAliasUninstalledOperation.php +++ b/src/Composer/DependencyResolver/Operation/MarkAliasUninstalledOperation.php @@ -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) { @@ -39,7 +39,7 @@ class MarkAliasUninstalledOperation extends SolverOperation /** * Returns package instance. * - * @return PackageInterface + * @return PackageInterface */ public function getPackage() { @@ -49,7 +49,7 @@ class MarkAliasUninstalledOperation extends SolverOperation /** * Returns job type. * - * @return string + * @return string */ public function getJobType() { diff --git a/src/Composer/DependencyResolver/Operation/OperationInterface.php b/src/Composer/DependencyResolver/Operation/OperationInterface.php index 5c819cab8..f940c342c 100644 --- a/src/Composer/DependencyResolver/Operation/OperationInterface.php +++ b/src/Composer/DependencyResolver/Operation/OperationInterface.php @@ -12,7 +12,6 @@ namespace Composer\DependencyResolver\Operation; -use Composer\Package\PackageInterface; /** * Solver operation interface. @@ -24,14 +23,14 @@ interface OperationInterface /** * Returns job type. * - * @return string + * @return string */ function getJobType(); /** * Returns operation reason. * - * @return string + * @return string */ function getReason(); diff --git a/src/Composer/DependencyResolver/Operation/SolverOperation.php b/src/Composer/DependencyResolver/Operation/SolverOperation.php index 5fb796d17..ddad58aea 100644 --- a/src/Composer/DependencyResolver/Operation/SolverOperation.php +++ b/src/Composer/DependencyResolver/Operation/SolverOperation.php @@ -26,7 +26,7 @@ abstract class SolverOperation implements OperationInterface /** * Initializes operation. * - * @param string $reason operation reason + * @param string $reason operation reason */ public function __construct($reason = null) { @@ -36,7 +36,7 @@ abstract class SolverOperation implements OperationInterface /** * Returns operation reason. * - * @return string + * @return string */ public function getReason() { diff --git a/src/Composer/DependencyResolver/Operation/UninstallOperation.php b/src/Composer/DependencyResolver/Operation/UninstallOperation.php index 1412d2f85..b4a73811e 100644 --- a/src/Composer/DependencyResolver/Operation/UninstallOperation.php +++ b/src/Composer/DependencyResolver/Operation/UninstallOperation.php @@ -26,8 +26,8 @@ class UninstallOperation 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) { @@ -39,7 +39,7 @@ class UninstallOperation extends SolverOperation /** * Returns package instance. * - * @return PackageInterface + * @return PackageInterface */ public function getPackage() { @@ -49,7 +49,7 @@ class UninstallOperation extends SolverOperation /** * Returns job type. * - * @return string + * @return string */ public function getJobType() { diff --git a/src/Composer/DependencyResolver/Operation/UpdateOperation.php b/src/Composer/DependencyResolver/Operation/UpdateOperation.php index 96b12d35e..a99fe6125 100644 --- a/src/Composer/DependencyResolver/Operation/UpdateOperation.php +++ b/src/Composer/DependencyResolver/Operation/UpdateOperation.php @@ -27,9 +27,9 @@ class UpdateOperation extends SolverOperation /** * Initializes update operation. * - * @param PackageInterface $initial initial package - * @param PackageInterface $target target package (updated) - * @param string $reason update reason + * @param PackageInterface $initial initial package + * @param PackageInterface $target target package (updated) + * @param string $reason update reason */ public function __construct(PackageInterface $initial, PackageInterface $target, $reason = null) { @@ -42,7 +42,7 @@ class UpdateOperation extends SolverOperation /** * Returns initial package. * - * @return PackageInterface + * @return PackageInterface */ public function getInitialPackage() { @@ -52,7 +52,7 @@ class UpdateOperation extends SolverOperation /** * Returns target package. * - * @return PackageInterface + * @return PackageInterface */ public function getTargetPackage() { @@ -62,7 +62,7 @@ class UpdateOperation extends SolverOperation /** * Returns job type. * - * @return string + * @return string */ public function getJobType() { diff --git a/src/Composer/DependencyResolver/PolicyInterface.php b/src/Composer/DependencyResolver/PolicyInterface.php index f00f857d4..ae4559d0a 100644 --- a/src/Composer/DependencyResolver/PolicyInterface.php +++ b/src/Composer/DependencyResolver/PolicyInterface.php @@ -12,7 +12,6 @@ namespace Composer\DependencyResolver; -use Composer\Repository\RepositoryInterface; use Composer\Package\PackageInterface; /** diff --git a/src/Composer/DependencyResolver/Pool.php b/src/Composer/DependencyResolver/Pool.php index e56d906ef..7c5c4ed81 100644 --- a/src/Composer/DependencyResolver/Pool.php +++ b/src/Composer/DependencyResolver/Pool.php @@ -127,7 +127,7 @@ class Pool * @param string $name The package name to be searched for * @param LinkConstraintInterface $constraint A constraint that all returned * packages must match or null to return all - * @return array A set of packages + * @return array A set of packages */ public function whatProvides($name, LinkConstraintInterface $constraint = null) { @@ -155,6 +155,7 @@ class Pool public function literalToPackage($literal) { $packageId = abs($literal); + return $this->packageById($packageId); } diff --git a/src/Composer/DependencyResolver/Problem.php b/src/Composer/DependencyResolver/Problem.php index b9266bae2..012ebab2f 100644 --- a/src/Composer/DependencyResolver/Problem.php +++ b/src/Composer/DependencyResolver/Problem.php @@ -28,7 +28,7 @@ class Problem /** * Add a rule as a reason * - * @param Rule $rule A rule which is a reason for this problem + * @param Rule $rule A rule which is a reason for this problem */ public function addRule(Rule $rule) { @@ -41,7 +41,7 @@ class Problem /** * Retrieve all reasons for this problem * - * @return array The problem's reasons + * @return array The problem's reasons */ public function getReasons() { @@ -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.'; } } @@ -93,8 +95,8 @@ class Problem /** * Store a reason descriptor but ignore duplicates * - * @param string $id A canonical identifier for the reason - * @param string $reason The reason descriptor + * @param string $id A canonical identifier for the reason + * @param string $reason The reason descriptor */ protected function addReason($id, $reason) { @@ -106,8 +108,8 @@ class Problem /** * Turns a job into a human readable description * - * @param array $job - * @return string + * @param array $job + * @return string */ protected function jobToText($job) { @@ -126,8 +128,8 @@ class Problem /** * Turns a constraint into text usable in a sentence describing a job * - * @param LinkConstraint $constraint - * @return string + * @param LinkConstraint $constraint + * @return string */ protected function constraintToText($constraint) { diff --git a/src/Composer/DependencyResolver/Rule.php b/src/Composer/DependencyResolver/Rule.php index c0ba0de76..a5414ebd9 100644 --- a/src/Composer/DependencyResolver/Rule.php +++ b/src/Composer/DependencyResolver/Rule.php @@ -86,7 +86,7 @@ class Rule * Ignores whether either of the rules is disabled. * * @param Rule $rule The rule to check against - * @return bool Whether the rules are equal + * @return bool Whether the rules are equal */ public function equals(Rule $rule) { @@ -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: diff --git a/src/Composer/DependencyResolver/RuleSet.php b/src/Composer/DependencyResolver/RuleSet.php index 9e8ecf29b..a9309dda0 100644 --- a/src/Composer/DependencyResolver/RuleSet.php +++ b/src/Composer/DependencyResolver/RuleSet.php @@ -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); } diff --git a/src/Composer/DependencyResolver/RuleSetGenerator.php b/src/Composer/DependencyResolver/RuleSetGenerator.php index 67bf2fb8b..e32294edc 100644 --- a/src/Composer/DependencyResolver/RuleSetGenerator.php +++ b/src/Composer/DependencyResolver/RuleSetGenerator.php @@ -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 @@ -40,13 +38,13 @@ class RuleSetGenerator * This rule is of the form (-A|B|C), where B and C are the providers of * one requirement of the package A. * - * @param PackageInterface $package The package with a requirement - * @param array $providers The providers of the requirement - * @param int $reason A RULE_* constant describing the + * @param PackageInterface $package The package with a requirement + * @param array $providers The providers of the requirement + * @param int $reason A RULE_* constant describing the * reason for generating this rule - * @param mixed $reasonData Any data, e.g. the requirement name, + * @param mixed $reasonData Any data, e.g. the requirement name, * that goes with the reason - * @return Rule The generated rule or null if tautological + * @return Rule The generated rule or null if tautological */ protected function createRequireRule(PackageInterface $package, array $providers, $reason, $reasonData = null) { @@ -69,11 +67,11 @@ class RuleSetGenerator * The rule is (A|B|C) with A, B and C different packages. If the given * set of packages is empty an impossible rule is generated. * - * @param array $packages The set of packages to choose from - * @param int $reason A RULE_* constant describing the reason for + * @param array $packages The set of packages to choose from + * @param int $reason A RULE_* constant describing the reason for * generating this rule - * @param array $job The job this rule was created from - * @return Rule The generated rule + * @param array $job The job this rule was created from + * @return Rule The generated rule */ protected function createInstallOneOfRule(array $packages, $reason, $job) { @@ -90,11 +88,11 @@ class RuleSetGenerator * * The rule for a package A is (-A). * - * @param PackageInterface $package The package to be removed - * @param int $reason A RULE_* constant describing the + * @param PackageInterface $package The package to be removed + * @param int $reason A RULE_* constant describing the * reason for generating this rule - * @param array $job The job this rule was created from - * @return Rule The generated rule + * @param array $job The job this rule was created from + * @return Rule The generated rule */ protected function createRemoveRule(PackageInterface $package, $reason, $job) { @@ -107,13 +105,13 @@ class RuleSetGenerator * The rule for conflicting packages A and B is (-A|-B). A is called the issuer * and B the provider. * - * @param PackageInterface $issuer The package declaring the conflict - * @param Package $provider The package causing the conflict - * @param int $reason A RULE_* constant describing the + * @param PackageInterface $issuer The package declaring the conflict + * @param Package $provider The package causing the conflict + * @param int $reason A RULE_* constant describing the * reason for generating this rule - * @param mixed $reasonData Any data, e.g. the package name, that + * @param mixed $reasonData Any data, e.g. the package name, that * goes with the reason - * @return Rule The generated rule + * @return Rule The generated rule */ protected function createConflictRule(PackageInterface $issuer, PackageInterface $provider, $reason, $reasonData = null) { @@ -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; } @@ -230,9 +229,9 @@ class RuleSetGenerator /** * Adds all rules for all update packages of a given package * - * @param PackageInterface $package Rules for this package's updates are to + * @param PackageInterface $package Rules for this package's updates are to * be added - * @param bool $allowAll Whether downgrades are allowed + * @param bool $allowAll Whether downgrades are allowed */ private function addRulesForUpdatePackages(PackageInterface $package) { diff --git a/src/Composer/DependencyResolver/RuleWatchGraph.php b/src/Composer/DependencyResolver/RuleWatchGraph.php index 93b80f1ad..4e92f378c 100644 --- a/src/Composer/DependencyResolver/RuleWatchGraph.php +++ b/src/Composer/DependencyResolver/RuleWatchGraph.php @@ -70,7 +70,7 @@ class RuleWatchGraph * B must now be decided true as well. * * @param int $decidedLiteral The literal which was decided (A in our example) - * @param int $level The level at which the decision took place and at which + * @param int $level The level at which the decision took place and at which * all resulting decisions should be made. * @param Callable $decisionsSatisfyCallback A callback which checks if a * literal has already been positively decided and the rule is thus diff --git a/src/Composer/DependencyResolver/RuleWatchNode.php b/src/Composer/DependencyResolver/RuleWatchNode.php index 88856974f..9547786b8 100644 --- a/src/Composer/DependencyResolver/RuleWatchNode.php +++ b/src/Composer/DependencyResolver/RuleWatchNode.php @@ -99,7 +99,7 @@ class RuleWatchNode * Moves a watch from one literal to another * * @param int $from The previously watched literal - * @param int $to The literal to be watched now + * @param int $to The literal to be watched now */ public function moveWatch($from, $to) { diff --git a/src/Composer/DependencyResolver/Solver.php b/src/Composer/DependencyResolver/Solver.php index 5ec682d57..fcb4fd428 100644 --- a/src/Composer/DependencyResolver/Solver.php +++ b/src/Composer/DependencyResolver/Solver.php @@ -13,8 +13,6 @@ namespace Composer\DependencyResolver; use Composer\Repository\RepositoryInterface; -use Composer\Package\AliasPackage; -use Composer\DependencyResolver\Operation; /** * @author Nils Adermann @@ -119,7 +117,7 @@ class Solver $assertRuleLiterals = $assertRule->getLiterals(); $assertRuleLiteral = $assertRuleLiterals[0]; - if (abs($literal) !== abs($assertRuleLiteral)) { + if (abs($literal) !== abs($assertRuleLiteral)) { continue; } @@ -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; } @@ -433,7 +437,7 @@ class Solver $this->learnedPool[] = array(); - while(true) { + while (true) { $this->learnedPool[count($this->learnedPool) - 1][] = $rule; foreach ($rule->getLiterals() as $literal) { @@ -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; } diff --git a/src/Composer/DependencyResolver/Transaction.php b/src/Composer/DependencyResolver/Transaction.php index 2cc6d9861..5f64c7245 100644 --- a/src/Composer/DependencyResolver/Transaction.php +++ b/src/Composer/DependencyResolver/Transaction.php @@ -95,7 +95,7 @@ class Transaction $package, $this->decisionQueueWhy[$i] ); } - } else if (!isset($ignoreRemove[$package->getId()])) { + } elseif (!isset($ignoreRemove[$package->getId()])) { if ($package instanceof AliasPackage) { $transaction[] = new Operation\MarkAliasInstalledOperation( $package, $this->decisionQueueWhy[$i] diff --git a/src/Composer/Downloader/ArchiveDownloader.php b/src/Composer/Downloader/ArchiveDownloader.php index 2395e8d40..ed113e0d4 100644 --- a/src/Composer/Downloader/ArchiveDownloader.php +++ b/src/Composer/Downloader/ArchiveDownloader.php @@ -12,7 +12,6 @@ namespace Composer\Downloader; -use Composer\IO\IOInterface; use Composer\Package\PackageInterface; /** diff --git a/src/Composer/Downloader/DownloadManager.php b/src/Composer/Downloader/DownloadManager.php index 3d4f4ec5d..d07d9eb1c 100644 --- a/src/Composer/Downloader/DownloadManager.php +++ b/src/Composer/Downloader/DownloadManager.php @@ -30,7 +30,7 @@ class DownloadManager /** * Initializes download manager. * - * @param Boolean $preferSource prefer downloading from source + * @param Boolean $preferSource prefer downloading from source */ public function __construct($preferSource = false, Filesystem $filesystem = null) { @@ -41,7 +41,7 @@ class DownloadManager /** * Makes downloader prefer source installation over the dist. * - * @param Boolean $preferSource prefer downloading from source + * @param Boolean $preferSource prefer downloading from source */ public function setPreferSource($preferSource) { @@ -53,8 +53,8 @@ class DownloadManager /** * Sets installer downloader for a specific installation type. * - * @param string $type installation type - * @param DownloaderInterface $downloader downloader instance + * @param string $type installation type + * @param DownloaderInterface $downloader downloader instance */ public function setDownloader($type, DownloaderInterface $downloader) { @@ -67,11 +67,11 @@ class DownloadManager /** * Returns downloader for a specific installation type. * - * @param string $type installation type + * @param string $type installation type * - * @return DownloaderInterface + * @return DownloaderInterface * - * @throws UnexpectedValueException if downloader for provided type is not registeterd + * @throws UnexpectedValueException if downloader for provided type is not registeterd */ public function getDownloader($type) { @@ -86,12 +86,12 @@ class DownloadManager /** * Returns downloader for already installed package. * - * @param PackageInterface $package package instance + * @param PackageInterface $package package instance * - * @return DownloaderInterface + * @return DownloaderInterface * - * @throws InvalidArgumentException if package has no installation source specified - * @throws LogicException if specific downloader used to load package with + * @throws InvalidArgumentException if package has no installation source specified + * @throws LogicException if specific downloader used to load package with * wrong type */ public function getDownloaderForInstalledPackage(PackageInterface $package) @@ -121,11 +121,11 @@ class DownloadManager /** * Downloads package into target dir. * - * @param PackageInterface $package package instance - * @param string $targetDir target dir - * @param Boolean $preferSource prefer installation from source + * @param PackageInterface $package package instance + * @param string $targetDir target dir + * @param Boolean $preferSource prefer installation from source * - * @throws InvalidArgumentException if package have no urls to download from + * @throws InvalidArgumentException if package have no urls to download from */ public function download(PackageInterface $package, $targetDir, $preferSource = null) { @@ -152,11 +152,11 @@ class DownloadManager /** * Updates package from initial to target version. * - * @param PackageInterface $initial initial package version - * @param PackageInterface $target target package version - * @param string $targetDir target dir + * @param PackageInterface $initial initial package version + * @param PackageInterface $target target package version + * @param string $targetDir target dir * - * @throws InvalidArgumentException if initial package is not installed + * @throws InvalidArgumentException if initial package is not installed */ public function update(PackageInterface $initial, PackageInterface $target, $targetDir) { @@ -175,6 +175,7 @@ class DownloadManager if ($target->isDev() && 'dist' === $installationSource) { $downloader->remove($initial, $targetDir); $this->download($target, $targetDir); + return; } @@ -190,8 +191,8 @@ class DownloadManager /** * Removes package from target dir. * - * @param PackageInterface $package package instance - * @param string $targetDir target dir + * @param PackageInterface $package package instance + * @param string $targetDir target dir */ public function remove(PackageInterface $package, $targetDir) { diff --git a/src/Composer/Downloader/DownloaderInterface.php b/src/Composer/Downloader/DownloaderInterface.php index 8c6ed4c07..9bd1a5231 100644 --- a/src/Composer/Downloader/DownloaderInterface.php +++ b/src/Composer/Downloader/DownloaderInterface.php @@ -25,32 +25,32 @@ interface DownloaderInterface /** * Returns installation source (either source or dist). * - * @return string "source" or "dist" + * @return string "source" or "dist" */ function getInstallationSource(); /** * Downloads specific package into specific folder. * - * @param PackageInterface $package package instance - * @param string $path download path + * @param PackageInterface $package package instance + * @param string $path download path */ function download(PackageInterface $package, $path); /** * Updates specific package in specific folder from initial to target version. * - * @param PackageInterface $initial initial package - * @param PackageInterface $target updated package - * @param string $path download path + * @param PackageInterface $initial initial package + * @param PackageInterface $target updated package + * @param string $path download path */ function update(PackageInterface $initial, PackageInterface $target, $path); /** * Removes specific package from specific folder. * - * @param PackageInterface $package package instance - * @param string $path download path + * @param PackageInterface $package package instance + * @param string $path download path */ function remove(PackageInterface $package, $path); } diff --git a/src/Composer/Downloader/FileDownloader.php b/src/Composer/Downloader/FileDownloader.php index 3e15acf80..e6b0c1061 100644 --- a/src/Composer/Downloader/FileDownloader.php +++ b/src/Composer/Downloader/FileDownloader.php @@ -33,7 +33,7 @@ class FileDownloader implements DownloaderInterface /** * Constructor. * - * @param IOInterface $io The IO instance + * @param IOInterface $io The IO instance */ public function __construct(IOInterface $io, RemoteFilesystem $rfs = null, Filesystem $filesystem = null) { @@ -110,9 +110,9 @@ class FileDownloader implements DownloaderInterface /** * Gets file name for specific package * - * @param PackageInterface $package package instance - * @param string $path download path - * @return string file name + * @param PackageInterface $package package instance + * @param string $path download path + * @return string file name */ protected function getFileName(PackageInterface $package, $path) { @@ -122,7 +122,7 @@ class FileDownloader implements DownloaderInterface /** * Process the download url * - * @param string $url download url + * @param string $url download url * @return string url * * @throws \RuntimeException If any problem with the url diff --git a/src/Composer/Downloader/GitDownloader.php b/src/Composer/Downloader/GitDownloader.php index a75a7d6d3..bc759a283 100644 --- a/src/Composer/Downloader/GitDownloader.php +++ b/src/Composer/Downloader/GitDownloader.php @@ -13,7 +13,6 @@ namespace Composer\Downloader; use Composer\Package\PackageInterface; -use Composer\Util\ProcessExecutor; /** * @author Jordi Boggiano @@ -80,9 +79,9 @@ class GitDownloader extends VcsDownloader /** * Runs a command doing attempts for each protocol supported by github. * - * @param callable $commandCallable A callable building the command for the given url - * @param string $url - * @param string $path The directory to remove for each attempt (null if not needed) + * @param callable $commandCallable A callable building the command for the given url + * @param string $url + * @param string $path The directory to remove for each attempt (null if not needed) * @throws \RuntimeException */ protected function runCommand($commandCallable, $url, $path = null) diff --git a/src/Composer/Downloader/HgDownloader.php b/src/Composer/Downloader/HgDownloader.php index 25431d1cd..7dc845a98 100644 --- a/src/Composer/Downloader/HgDownloader.php +++ b/src/Composer/Downloader/HgDownloader.php @@ -13,7 +13,6 @@ namespace Composer\Downloader; use Composer\Package\PackageInterface; -use Composer\Util\ProcessExecutor; /** * @author Per Bernhardt diff --git a/src/Composer/Downloader/PearDownloader.php b/src/Composer/Downloader/PearDownloader.php index dac33d9a5..0debce13f 100644 --- a/src/Composer/Downloader/PearDownloader.php +++ b/src/Composer/Downloader/PearDownloader.php @@ -12,7 +12,6 @@ namespace Composer\Downloader; -use Composer\Package\PackageInterface; /** * Downloader for pear packages diff --git a/src/Composer/Downloader/PharDownloader.php b/src/Composer/Downloader/PharDownloader.php index 94a52e056..96fe04b56 100644 --- a/src/Composer/Downloader/PharDownloader.php +++ b/src/Composer/Downloader/PharDownloader.php @@ -12,7 +12,6 @@ namespace Composer\Downloader; -use Composer\Package\PackageInterface; /** * Downloader for phar files diff --git a/src/Composer/Downloader/SvnDownloader.php b/src/Composer/Downloader/SvnDownloader.php index 4bc2e530a..3fb476410 100644 --- a/src/Composer/Downloader/SvnDownloader.php +++ b/src/Composer/Downloader/SvnDownloader.php @@ -13,7 +13,6 @@ namespace Composer\Downloader; use Composer\Package\PackageInterface; -use Composer\Util\ProcessExecutor; use Composer\Util\Svn as SvnUtil; /** diff --git a/src/Composer/Downloader/TarDownloader.php b/src/Composer/Downloader/TarDownloader.php index c9ea449f8..405881538 100644 --- a/src/Composer/Downloader/TarDownloader.php +++ b/src/Composer/Downloader/TarDownloader.php @@ -12,7 +12,6 @@ namespace Composer\Downloader; -use Composer\Package\PackageInterface; /** * Downloader for tar files: tar, tar.gz or tar.bz2 diff --git a/src/Composer/Downloader/VcsDownloader.php b/src/Composer/Downloader/VcsDownloader.php index e2aa3be7b..d7c9f20c5 100644 --- a/src/Composer/Downloader/VcsDownloader.php +++ b/src/Composer/Downloader/VcsDownloader.php @@ -86,17 +86,17 @@ abstract class VcsDownloader implements DownloaderInterface /** * Downloads specific package into specific folder. * - * @param PackageInterface $package package instance - * @param string $path download path + * @param PackageInterface $package package instance + * @param string $path download path */ abstract protected function doDownload(PackageInterface $package, $path); /** * Updates specific package in specific folder from initial to target version. * - * @param PackageInterface $initial initial package - * @param PackageInterface $target updated package - * @param string $path download path + * @param PackageInterface $initial initial package + * @param PackageInterface $target updated package + * @param string $path download path */ abstract protected function doUpdate(PackageInterface $initial, PackageInterface $target, $path); diff --git a/src/Composer/Downloader/ZipDownloader.php b/src/Composer/Downloader/ZipDownloader.php index 4ad99095a..b438ec204 100644 --- a/src/Composer/Downloader/ZipDownloader.php +++ b/src/Composer/Downloader/ZipDownloader.php @@ -12,7 +12,6 @@ namespace Composer\Downloader; -use Composer\Package\PackageInterface; use Composer\Util\ProcessExecutor; use Composer\IO\IOInterface; use ZipArchive; @@ -62,8 +61,8 @@ class ZipDownloader extends ArchiveDownloader /** * Give a meaningful error message to the user. * - * @param int $retval - * @param string $file + * @param int $retval + * @param string $file * @return string */ protected function getErrorMessage($retval, $file) diff --git a/src/Composer/Factory.php b/src/Composer/Factory.php index a2f0ed631..47252b3ca 100644 --- a/src/Composer/Factory.php +++ b/src/Composer/Factory.php @@ -65,8 +65,8 @@ class Factory /** * Creates a Composer instance * - * @param IOInterface $io IO instance - * @param mixed $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 mixed $localConfig either a configuration array or a filename to read from, if null it will read from the default filename * @return Composer */ public function createComposer(IOInterface $io, $localConfig = null) @@ -250,8 +250,8 @@ class Factory } /** - * @param IOInterface $io IO instance - * @param mixed $config 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 mixed $config either a configuration array or a filename to read from, if null it will read from the default filename * @return Composer */ static public function create(IOInterface $io, $config = null) diff --git a/src/Composer/IO/ConsoleIO.php b/src/Composer/IO/ConsoleIO.php index 0865fab29..5f6f8d08f 100644 --- a/src/Composer/IO/ConsoleIO.php +++ b/src/Composer/IO/ConsoleIO.php @@ -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; /** diff --git a/src/Composer/IO/IOInterface.php b/src/Composer/IO/IOInterface.php index 79e0d7e8e..168a8eac4 100644 --- a/src/Composer/IO/IOInterface.php +++ b/src/Composer/IO/IOInterface.php @@ -60,8 +60,8 @@ interface IOInterface /** * Asks a question to the user. * - * @param string|array $question The question to ask - * @param string $default The default answer if none is given by the user + * @param string|array $question The question to ask + * @param string $default The default answer if none is given by the user * * @return string The user answer * @@ -74,8 +74,8 @@ interface IOInterface * * The question will be asked until the user answers by nothing, yes, or no. * - * @param string|array $question The question to ask - * @param Boolean $default The default answer if the user enters nothing + * @param string|array $question The question to ask + * @param Boolean $default The default answer if the user enters nothing * * @return Boolean true if the user has confirmed, false otherwise */ @@ -88,10 +88,10 @@ interface IOInterface * validated data when the data is valid and throw an exception * otherwise. * - * @param string|array $question The question to ask - * @param callback $validator A PHP callback - * @param integer $attempts Max number of times to ask before giving up (false by default, which means infinite) - * @param string $default The default answer if none is given by the user + * @param string|array $question The question to ask + * @param callback $validator A PHP callback + * @param integer $attempts Max number of times to ask before giving up (false by default, which means infinite) + * @param string $default The default answer if none is given by the user * * @return mixed * diff --git a/src/Composer/Installer.php b/src/Composer/Installer.php index 6de106741..d62cf73d3 100644 --- a/src/Composer/Installer.php +++ b/src/Composer/Installer.php @@ -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; @@ -102,14 +101,14 @@ class Installer /** * Constructor * - * @param IOInterface $io - * @param PackageInterface $package - * @param DownloadManager $downloadManager - * @param RepositoryManager $repositoryManager - * @param Locker $locker + * @param IOInterface $io + * @param PackageInterface $package + * @param DownloadManager $downloadManager + * @param RepositoryManager $repositoryManager + * @param Locker $locker * @param InstallationManager $installationManager - * @param EventDispatcher $eventDispatcher - * @param AutoloadGenerator $autoloadGenerator + * @param EventDispatcher $eventDispatcher + * @param AutoloadGenerator $autoloadGenerator */ public function __construct(IOInterface $io, PackageInterface $package, DownloadManager $downloadManager, RepositoryManager $repositoryManager, Locker $locker, InstallationManager $installationManager, EventDispatcher $eventDispatcher, AutoloadGenerator $autoloadGenerator) { @@ -447,10 +446,10 @@ class Installer /** * Create Installer * - * @param IOInterface $io - * @param Composer $composer - * @param EventDispatcher $eventDispatcher - * @param AutoloadGenerator $autoloadGenerator + * @param IOInterface $io + * @param Composer $composer + * @param EventDispatcher $eventDispatcher + * @param AutoloadGenerator $autoloadGenerator * @return Installer */ static public function create(IOInterface $io, Composer $composer, EventDispatcher $eventDispatcher = null, AutoloadGenerator $autoloadGenerator = null) @@ -480,7 +479,7 @@ class Installer /** * wether to run in drymode or not * - * @param boolean $dryRun + * @param boolean $dryRun * @return Installer */ public function setDryRun($dryRun = true) @@ -493,7 +492,7 @@ class Installer /** * prefer source installation * - * @param boolean $preferSource + * @param boolean $preferSource * @return Installer */ public function setPreferSource($preferSource = true) @@ -506,7 +505,7 @@ class Installer /** * update packages * - * @param boolean $update + * @param boolean $update * @return Installer */ public function setUpdate($update = true) @@ -519,7 +518,7 @@ class Installer /** * enables dev packages * - * @param boolean $update + * @param boolean $update * @return Installer */ public function setDevMode($devMode = true) @@ -532,7 +531,7 @@ class Installer /** * run in verbose mode * - * @param boolean $verbose + * @param boolean $verbose * @return Installer */ public function setVerbose($verbose = true) diff --git a/src/Composer/Installer/InstallationManager.php b/src/Composer/Installer/InstallationManager.php index d54b2d6a9..8fd78af21 100644 --- a/src/Composer/Installer/InstallationManager.php +++ b/src/Composer/Installer/InstallationManager.php @@ -40,8 +40,8 @@ class InstallationManager /** * Creates an instance of InstallationManager * - * @param string $vendorDir Relative path to the vendor directory - * @throws \InvalidArgumentException + * @param string $vendorDir Relative path to the vendor directory + * @throws \InvalidArgumentException */ public function __construct($vendorDir = 'vendor') { @@ -62,7 +62,7 @@ class InstallationManager /** * Adds installer * - * @param InstallerInterface $installer installer instance + * @param InstallerInterface $installer installer instance */ public function addInstaller(InstallerInterface $installer) { @@ -73,11 +73,11 @@ class InstallationManager /** * Returns installer for a specific package type. * - * @param string $type package type + * @param string $type package type * - * @return InstallerInterface + * @return InstallerInterface * - * @throws InvalidArgumentException if installer for provided type is not registered + * @throws InvalidArgumentException if installer for provided type is not registered */ public function getInstaller($type) { @@ -99,10 +99,10 @@ class InstallationManager /** * Checks whether provided package is installed in one of the registered installers. * - * @param InstalledRepositoryInterface $repo repository in which to check - * @param PackageInterface $package package instance + * @param InstalledRepositoryInterface $repo repository in which to check + * @param PackageInterface $package package instance * - * @return Boolean + * @return Boolean */ public function isPackageInstalled(InstalledRepositoryInterface $repo, PackageInterface $package) { @@ -116,8 +116,8 @@ class InstallationManager /** * Executes solver operation. * - * @param RepositoryInterface $repo repository in which to check - * @param OperationInterface $operation operation instance + * @param RepositoryInterface $repo repository in which to check + * @param OperationInterface $operation operation instance */ public function execute(RepositoryInterface $repo, OperationInterface $operation) { @@ -128,8 +128,8 @@ class InstallationManager /** * Executes install operation. * - * @param RepositoryInterface $repo repository in which to check - * @param InstallOperation $operation operation instance + * @param RepositoryInterface $repo repository in which to check + * @param InstallOperation $operation operation instance */ public function install(RepositoryInterface $repo, InstallOperation $operation) { @@ -142,8 +142,8 @@ class InstallationManager /** * Executes update operation. * - * @param RepositoryInterface $repo repository in which to check - * @param InstallOperation $operation operation instance + * @param RepositoryInterface $repo repository in which to check + * @param InstallOperation $operation operation instance */ public function update(RepositoryInterface $repo, UpdateOperation $operation) { @@ -166,8 +166,8 @@ class InstallationManager /** * Uninstalls package. * - * @param RepositoryInterface $repo repository in which to check - * @param UninstallOperation $operation operation instance + * @param RepositoryInterface $repo repository in which to check + * @param UninstallOperation $operation operation instance */ public function uninstall(RepositoryInterface $repo, UninstallOperation $operation) { @@ -179,8 +179,8 @@ class InstallationManager /** * Executes markAliasInstalled operation. * - * @param RepositoryInterface $repo repository in which to check - * @param MarkAliasInstalledOperation $operation operation instance + * @param RepositoryInterface $repo repository in which to check + * @param MarkAliasInstalledOperation $operation operation instance */ public function markAliasInstalled(RepositoryInterface $repo, MarkAliasInstalledOperation $operation) { @@ -194,8 +194,8 @@ class InstallationManager /** * Executes markAlias operation. * - * @param RepositoryInterface $repo repository in which to check - * @param MarkAliasUninstalledOperation $operation operation instance + * @param RepositoryInterface $repo repository in which to check + * @param MarkAliasUninstalledOperation $operation operation instance */ public function markAliasUninstalled(RepositoryInterface $repo, MarkAliasUninstalledOperation $operation) { @@ -207,20 +207,21 @@ class InstallationManager /** * Returns the installation path of a package * - * @param PackageInterface $package - * @return string path + * @param PackageInterface $package + * @return string path */ public function getInstallPath(PackageInterface $package) { $installer = $this->getInstaller($package->getType()); + return $installer->getInstallPath($package); } /** * Returns the vendor path * - * @param boolean $absolute Whether or not to return an absolute path - * @return string path + * @param boolean $absolute Whether or not to return an absolute path + * @return string path */ public function getVendorPath($absolute = false) { diff --git a/src/Composer/Installer/InstallerInstaller.php b/src/Composer/Installer/InstallerInstaller.php index 98e941d4c..582817f93 100644 --- a/src/Composer/Installer/InstallerInstaller.php +++ b/src/Composer/Installer/InstallerInstaller.php @@ -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; /** @@ -30,12 +29,12 @@ class InstallerInstaller extends LibraryInstaller private static $classCounter = 0; /** - * @param string $vendorDir relative path for packages home - * @param string $binDir relative path for binaries - * @param DownloadManager $dm download manager - * @param IOInterface $io io instance - * @param InstallationManager $im installation manager - * @param array $localRepositories array of InstalledRepositoryInterface + * @param string $vendorDir relative path for packages home + * @param string $binDir relative path for binaries + * @param DownloadManager $dm download manager + * @param IOInterface $io io instance + * @param InstallationManager $im installation manager + * @param array $localRepositories array of InstalledRepositoryInterface */ public function __construct($vendorDir, $binDir, DownloadManager $dm, IOInterface $io, InstallationManager $im, array $localRepositories) { diff --git a/src/Composer/Installer/InstallerInterface.php b/src/Composer/Installer/InstallerInterface.php index 099b46fdc..68f0bae70 100644 --- a/src/Composer/Installer/InstallerInterface.php +++ b/src/Composer/Installer/InstallerInterface.php @@ -12,7 +12,6 @@ namespace Composer\Installer; -use Composer\DependencyResolver\Operation\OperationInterface; use Composer\Package\PackageInterface; use Composer\Repository\InstalledRepositoryInterface; @@ -27,53 +26,53 @@ interface InstallerInterface /** * Decides if the installer supports the given type * - * @param string $packageType - * @return Boolean + * @param string $packageType + * @return Boolean */ function supports($packageType); /** * Checks that provided package is installed. * - * @param InstalledRepositoryInterface $repo repository in which to check - * @param PackageInterface $package package instance + * @param InstalledRepositoryInterface $repo repository in which to check + * @param PackageInterface $package package instance * - * @return Boolean + * @return Boolean */ function isInstalled(InstalledRepositoryInterface $repo, PackageInterface $package); /** * Installs specific package. * - * @param InstalledRepositoryInterface $repo repository in which to check - * @param PackageInterface $package package instance + * @param InstalledRepositoryInterface $repo repository in which to check + * @param PackageInterface $package package instance */ function install(InstalledRepositoryInterface $repo, PackageInterface $package); /** * Updates specific package. * - * @param InstalledRepositoryInterface $repo repository in which to check - * @param PackageInterface $initial already installed package version - * @param PackageInterface $target updated version + * @param InstalledRepositoryInterface $repo repository in which to check + * @param PackageInterface $initial already installed package version + * @param PackageInterface $target updated version * - * @throws InvalidArgumentException if $from package is not installed + * @throws InvalidArgumentException if $from package is not installed */ function update(InstalledRepositoryInterface $repo, PackageInterface $initial, PackageInterface $target); /** * Uninstalls specific package. * - * @param InstalledRepositoryInterface $repo repository in which to check - * @param PackageInterface $package package instance + * @param InstalledRepositoryInterface $repo repository in which to check + * @param PackageInterface $package package instance */ function uninstall(InstalledRepositoryInterface $repo, PackageInterface $package); /** * Returns the installation path of a package * - * @param PackageInterface $package - * @return string path + * @param PackageInterface $package + * @return string path */ function getInstallPath(PackageInterface $package); } diff --git a/src/Composer/Installer/LibraryInstaller.php b/src/Composer/Installer/LibraryInstaller.php index 9be2e1d1d..685c0f178 100644 --- a/src/Composer/Installer/LibraryInstaller.php +++ b/src/Composer/Installer/LibraryInstaller.php @@ -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; @@ -37,11 +36,11 @@ class LibraryInstaller implements InstallerInterface /** * Initializes library installer. * - * @param string $vendorDir relative path for packages home - * @param string $binDir relative path for binaries - * @param DownloadManager $dm download manager - * @param IOInterface $io io instance - * @param string $type package type that this installer handles + * @param string $vendorDir relative path for packages home + * @param string $binDir relative path for binaries + * @param DownloadManager $dm download manager + * @param IOInterface $io io instance + * @param string $type package type that this installer handles */ public function __construct($vendorDir, $binDir, DownloadManager $dm, IOInterface $io, $type = 'library') { diff --git a/src/Composer/Installer/ProjectInstaller.php b/src/Composer/Installer/ProjectInstaller.php index 274d8e5ae..fc857d137 100644 --- a/src/Composer/Installer/ProjectInstaller.php +++ b/src/Composer/Installer/ProjectInstaller.php @@ -12,7 +12,6 @@ namespace Composer\Installer; -use Composer\DependencyResolver\Operation\OperationInterface; use Composer\Package\PackageInterface; use Composer\Downloader\DownloadManager; use Composer\Repository\InstalledRepositoryInterface; @@ -37,8 +36,8 @@ class ProjectInstaller implements InstallerInterface /** * Decides if the installer supports the given type * - * @param string $packageType - * @return Boolean + * @param string $packageType + * @return Boolean */ public function supports($packageType) { @@ -88,8 +87,8 @@ class ProjectInstaller implements InstallerInterface /** * Returns the installation path of a package * - * @param PackageInterface $package - * @return string path + * @param PackageInterface $package + * @return string path */ public function getInstallPath(PackageInterface $package) { diff --git a/src/Composer/Json/JsonFile.php b/src/Composer/Json/JsonFile.php index 579b750d1..998094db1 100644 --- a/src/Composer/Json/JsonFile.php +++ b/src/Composer/Json/JsonFile.php @@ -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; @@ -41,8 +39,8 @@ class JsonFile /** * Initializes json file reader/parser. * - * @param string $lockFile path to a lockfile - * @param RemoteFilesystem $rfs required for loading http/https json files + * @param string $lockFile path to a lockfile + * @param RemoteFilesystem $rfs required for loading http/https json files */ public function __construct($path, RemoteFilesystem $rfs = null) { @@ -62,7 +60,7 @@ class JsonFile /** * Checks whether json file exists. * - * @return Boolean + * @return Boolean */ public function exists() { @@ -72,7 +70,7 @@ class JsonFile /** * Reads json file. * - * @return array + * @return array */ public function read() { @@ -94,8 +92,8 @@ class JsonFile /** * Writes json file. * - * @param array $hash writes hash into json file - * @param int $options json_encode options (defaults to JSON_UNESCAPED_SLASHES | JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE) + * @param array $hash writes hash into json file + * @param int $options json_encode options (defaults to JSON_UNESCAPED_SLASHES | JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE) */ public function write(array $hash, $options = 448) { @@ -118,8 +116,8 @@ class JsonFile /** * Validates the schema of the current json file according to composer-schema.json rules * - * @param int $schema a JsonFile::*_SCHEMA constant - * @return Boolean true on success + * @param int $schema a JsonFile::*_SCHEMA constant + * @return Boolean true on success * @throws \UnexpectedValueException */ public function validateSchema($schema = self::STRICT_SCHEMA) @@ -164,8 +162,8 @@ class JsonFile * * Originally licensed under MIT by Dave Perrett * - * @param mixed $data Data to encode into a formatted JSON string - * @param int $options json_encode options (defaults to JSON_UNESCAPED_SLASHES | JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE) + * @param mixed $data Data to encode into a formatted JSON string + * @param int $options json_encode options (defaults to JSON_UNESCAPED_SLASHES | JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE) * @return string Encoded json */ static public function encode($data, $options = 448) @@ -268,7 +266,7 @@ class JsonFile * * @param string $json json string * - * @return mixed + * @return mixed */ public static function parseJson($json) { @@ -283,8 +281,8 @@ class JsonFile /** * Validates the syntax of a JSON string * - * @param string $json - * @return Boolean true on success + * @param string $json + * @return Boolean true on success * @throws \UnexpectedValueException */ protected static function validateSyntax($json) diff --git a/src/Composer/Package/AliasPackage.php b/src/Composer/Package/AliasPackage.php index 6835226d8..5bc86e889 100644 --- a/src/Composer/Package/AliasPackage.php +++ b/src/Composer/Package/AliasPackage.php @@ -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; /** @@ -40,9 +37,9 @@ class AliasPackage extends BasePackage /** * All descendants' constructors should call this parent constructor * - * @param PackageInterface $aliasOf The package this package is an alias of - * @param string $version The version the alias must report - * @param string $prettyVersion The alias's non-normalized version + * @param PackageInterface $aliasOf The package this package is an alias of + * @param string $version The version the alias must report + * @param string $prettyVersion The alias's non-normalized version */ public function __construct(PackageInterface $aliasOf, $version, $prettyVersion) { diff --git a/src/Composer/Package/BasePackage.php b/src/Composer/Package/BasePackage.php index 299c9b17c..64f6ea6c2 100644 --- a/src/Composer/Package/BasePackage.php +++ b/src/Composer/Package/BasePackage.php @@ -120,9 +120,9 @@ abstract class BasePackage implements PackageInterface * Checks if the package matches the given constraint directly or through * provided or replaced packages * - * @param string $name Name of the package to be matched - * @param LinkConstraintInterface $constraint The constraint to verify - * @return bool Whether this package matches the name and constraint + * @param string $name Name of the package to be matched + * @param LinkConstraintInterface $constraint The constraint to verify + * @return bool Whether this package matches the name and constraint */ public function matches($name, LinkConstraintInterface $constraint) { @@ -187,6 +187,7 @@ abstract class BasePackage implements PackageInterface if ($package instanceof AliasPackage) { $package = $package->getAliasOf(); } + return $package === $self; } diff --git a/src/Composer/Package/LinkConstraint/MultiConstraint.php b/src/Composer/Package/LinkConstraint/MultiConstraint.php index 211f0ee71..db3af2a39 100644 --- a/src/Composer/Package/LinkConstraint/MultiConstraint.php +++ b/src/Composer/Package/LinkConstraint/MultiConstraint.php @@ -48,6 +48,7 @@ class MultiConstraint implements LinkConstraintInterface foreach ($this->constraints as $constraint) { $constraints[] = $constraint->__toString(); } + return '['.implode(', ', $constraints).']'; } } diff --git a/src/Composer/Package/Loader/ArrayLoader.php b/src/Composer/Package/Loader/ArrayLoader.php index 475fd122c..035dcf75a 100644 --- a/src/Composer/Package/Loader/ArrayLoader.php +++ b/src/Composer/Package/Loader/ArrayLoader.php @@ -14,7 +14,6 @@ namespace Composer\Package\Loader; use Composer\Package; use Composer\Package\Version\VersionParser; -use Composer\Repository\RepositoryManager; /** * @author Konstantin Kudryashiv diff --git a/src/Composer/Package/Loader/RootPackageLoader.php b/src/Composer/Package/Loader/RootPackageLoader.php index 4d4df156e..b88b3e866 100644 --- a/src/Composer/Package/Loader/RootPackageLoader.php +++ b/src/Composer/Package/Loader/RootPackageLoader.php @@ -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 diff --git a/src/Composer/Package/Locker.php b/src/Composer/Package/Locker.php index d7502bfdb..e33d7a247 100644 --- a/src/Composer/Package/Locker.php +++ b/src/Composer/Package/Locker.php @@ -31,9 +31,9 @@ class Locker /** * Initializes packages locker. * - * @param JsonFile $lockFile lockfile loader - * @param RepositoryManager $repositoryManager repository manager instance - * @param string $hash unique hash of the current composer configuration + * @param JsonFile $lockFile lockfile loader + * @param RepositoryManager $repositoryManager repository manager instance + * @param string $hash unique hash of the current composer configuration */ public function __construct(JsonFile $lockFile, RepositoryManager $repositoryManager, $hash) { @@ -45,7 +45,7 @@ class Locker /** * Checks whether locker were been locked (lockfile found). * - * @param Boolean $dev true to check if dev packages are locked + * @param Boolean $dev true to check if dev packages are locked * @return Boolean */ public function isLocked($dev = false) @@ -77,7 +77,7 @@ class Locker /** * Searches and returns an array of locked packages, retrieved from registered repositories. * - * @param Boolean $dev true to retrieve the locked dev packages + * @param Boolean $dev true to retrieve the locked dev packages * @return array */ public function getLockedPackages($dev = false) @@ -168,7 +168,7 @@ class Locker * * @param array $packages array of packages * @param mixed $packages array of dev packages or null if installed without --dev - * @param array $aliases array of aliases + * @param array $aliases array of aliases * * @return Boolean */ diff --git a/src/Composer/Package/MemoryPackage.php b/src/Composer/Package/MemoryPackage.php index 6a1fc58db..4d1ba0cd7 100644 --- a/src/Composer/Package/MemoryPackage.php +++ b/src/Composer/Package/MemoryPackage.php @@ -65,8 +65,8 @@ class MemoryPackage extends BasePackage /** * Creates a new in memory package. * - * @param string $name The package's name - * @param string $version The package's version + * @param string $name The package's name + * @param string $version The package's version * @param string $prettyVersion The package's non-normalized version */ public function __construct($name, $version, $prettyVersion) diff --git a/src/Composer/Package/PackageInterface.php b/src/Composer/Package/PackageInterface.php index 43bd8b88c..70d119654 100644 --- a/src/Composer/Package/PackageInterface.php +++ b/src/Composer/Package/PackageInterface.php @@ -62,9 +62,9 @@ interface PackageInterface * Checks if the package matches the given constraint directly or through * provided or replaced packages * - * @param string $name Name of the package to be matched - * @param LinkConstraintInterface $constraint The constraint to verify - * @return bool Whether this package matches the name and constraint + * @param string $name Name of the package to be matched + * @param LinkConstraintInterface $constraint The constraint to verify + * @return bool Whether this package matches the name and constraint */ function matches($name, LinkConstraintInterface $constraint); @@ -99,14 +99,14 @@ interface PackageInterface /** * Sets source from which this package was installed (source/dist). * - * @param string $type source/dist + * @param string $type source/dist */ function setInstallationSource($type); /** * Returns source from which this package was installed (source/dist). * - * @param string $type source/dist + * @param string $type source/dist */ function getInstallationSource(); diff --git a/src/Composer/Package/Version/VersionParser.php b/src/Composer/Package/Version/VersionParser.php index 9aefbb805..a45f443a3 100644 --- a/src/Composer/Package/Version/VersionParser.php +++ b/src/Composer/Package/Version/VersionParser.php @@ -28,7 +28,7 @@ class VersionParser /** * Returns the stability of a version * - * @param string $version + * @param string $version * @return string */ static public function parseStability($version) @@ -61,7 +61,7 @@ class VersionParser /** * Normalizes a version string to be able to perform comparisons on it * - * @param string $version + * @param string $version * @return array */ public function normalize($version) @@ -123,7 +123,7 @@ class VersionParser /** * Normalizes a branch name to be able to perform comparisons on it * - * @param string $version + * @param string $version * @return array */ public function normalizeBranch($name) @@ -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'; } @@ -148,7 +149,7 @@ class VersionParser /** * Parses as constraint string into LinkConstraint objects * - * @param string $constraints + * @param string $constraints * @return \Composer\Package\LinkConstraint\LinkConstraintInterface */ public function parseConstraints($constraints) @@ -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) {} } diff --git a/src/Composer/Repository/ArrayRepository.php b/src/Composer/Repository/ArrayRepository.php index e75e3b18a..d19584b7e 100644 --- a/src/Composer/Repository/ArrayRepository.php +++ b/src/Composer/Repository/ArrayRepository.php @@ -117,7 +117,7 @@ class ArrayRepository implements RepositoryInterface /** * Removes package from repository. * - * @param PackageInterface $package package instance + * @param PackageInterface $package package instance */ public function removePackage(PackageInterface $package) { @@ -140,6 +140,7 @@ class ArrayRepository implements RepositoryInterface if (null === $this->packages) { $this->initialize(); } + return $this->packages; } diff --git a/src/Composer/Repository/ComposerRepository.php b/src/Composer/Repository/ComposerRepository.php index 938e7b566..692bacb88 100644 --- a/src/Composer/Repository/ComposerRepository.php +++ b/src/Composer/Repository/ComposerRepository.php @@ -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; diff --git a/src/Composer/Repository/CompositeRepository.php b/src/Composer/Repository/CompositeRepository.php index 82b7e9b45..53d3be821 100644 --- a/src/Composer/Repository/CompositeRepository.php +++ b/src/Composer/Repository/CompositeRepository.php @@ -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; } @@ -122,4 +127,4 @@ class CompositeRepository implements RepositoryInterface { $this->repositories[] = $repository; } -} \ No newline at end of file +} diff --git a/src/Composer/Repository/FilesystemRepository.php b/src/Composer/Repository/FilesystemRepository.php index 3e645885e..314e45997 100644 --- a/src/Composer/Repository/FilesystemRepository.php +++ b/src/Composer/Repository/FilesystemRepository.php @@ -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; @@ -31,7 +30,7 @@ class FilesystemRepository extends ArrayRepository implements WritableRepository /** * Initializes filesystem repository. * - * @param JsonFile $repositoryFile repository json file + * @param JsonFile $repositoryFile repository json file */ public function __construct(JsonFile $repositoryFile) { diff --git a/src/Composer/Repository/InstalledArrayRepository.php b/src/Composer/Repository/InstalledArrayRepository.php index 151d00190..7443b3d63 100644 --- a/src/Composer/Repository/InstalledArrayRepository.php +++ b/src/Composer/Repository/InstalledArrayRepository.php @@ -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. diff --git a/src/Composer/Repository/InstalledFilesystemRepository.php b/src/Composer/Repository/InstalledFilesystemRepository.php index 7bb70d666..bb06405c7 100644 --- a/src/Composer/Repository/InstalledFilesystemRepository.php +++ b/src/Composer/Repository/InstalledFilesystemRepository.php @@ -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. diff --git a/src/Composer/Repository/InstalledRepositoryInterface.php b/src/Composer/Repository/InstalledRepositoryInterface.php index 7b9ddaeae..61463096d 100644 --- a/src/Composer/Repository/InstalledRepositoryInterface.php +++ b/src/Composer/Repository/InstalledRepositoryInterface.php @@ -12,7 +12,6 @@ namespace Composer\Repository; -use Composer\Package\PackageInterface; /** * Installable repository interface. diff --git a/src/Composer/Repository/PackageRepository.php b/src/Composer/Repository/PackageRepository.php index 0bace24cc..323cc805a 100644 --- a/src/Composer/Repository/PackageRepository.php +++ b/src/Composer/Repository/PackageRepository.php @@ -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. diff --git a/src/Composer/Repository/PearRepository.php b/src/Composer/Repository/PearRepository.php index e743e4eab..b964bf08e 100644 --- a/src/Composer/Repository/PearRepository.php +++ b/src/Composer/Repository/PearRepository.php @@ -124,9 +124,9 @@ class PearRepository extends ArrayRepository } /** - * @param string $categoryLink - * @throws TransportException - * @throws \InvalidArgumentException + * @param string $categoryLink + * @throws TransportException + * @throws \InvalidArgumentException */ private function fetchPearPackages($categoryLink) { @@ -192,8 +192,8 @@ class PearRepository extends ArrayRepository } /** - * @param array $data - * @return string + * @param array $data + * @return string */ private function parseVersion(array $data) { @@ -207,13 +207,14 @@ class PearRepository extends ArrayRepository if (isset($data['max'])) { $versions[] = '<=' . $data['max']; } + return implode(',', $versions); } /** * @todo Improve dependencies resolution of pear packages. - * @param array $depsOptions - * @return array + * @param array $depsOptions + * @return array */ private function parseDependenciesOptions(array $depsOptions) { @@ -251,13 +252,14 @@ class PearRepository extends ArrayRepository } } } + return $data; } /** - * @param string $deps - * @return array - * @throws \InvalidArgumentException + * @param string $deps + * @return array + * @throws \InvalidArgumentException */ private function parseDependencies($deps) { @@ -282,9 +284,9 @@ class PearRepository extends ArrayRepository } /** - * @param string $packagesLink - * @return void - * @throws \InvalidArgumentException + * @param string $packagesLink + * @return void + * @throws \InvalidArgumentException */ private function fetchPear2Packages($packagesLink) { @@ -357,7 +359,7 @@ class PearRepository extends ArrayRepository } /** - * @param string $url + * @param string $url * @return \DOMDocument */ private function requestXml($url) diff --git a/src/Composer/Repository/RepositoryInterface.php b/src/Composer/Repository/RepositoryInterface.php index e4a79695d..d70e9f9c4 100644 --- a/src/Composer/Repository/RepositoryInterface.php +++ b/src/Composer/Repository/RepositoryInterface.php @@ -25,36 +25,36 @@ interface RepositoryInterface extends \Countable /** * Checks if specified package registered (installed). * - * @param PackageInterface $package package instance + * @param PackageInterface $package package instance * - * @return Boolean + * @return Boolean */ function hasPackage(PackageInterface $package); /** * Searches for the first match of a package by name and version. * - * @param string $name package name - * @param string $version package version + * @param string $name package name + * @param string $version package version * - * @return PackageInterface|null + * @return PackageInterface|null */ function findPackage($name, $version); /** * Searches for all packages matching a name and optionally a version. * - * @param string $name package name - * @param string $version package version + * @param string $name package name + * @param string $version package version * - * @return array + * @return array */ function findPackages($name, $version = null); /** * Returns list of registered packages. * - * @return array + * @return array */ function getPackages(); } diff --git a/src/Composer/Repository/RepositoryManager.php b/src/Composer/Repository/RepositoryManager.php index febce81a3..92738755a 100644 --- a/src/Composer/Repository/RepositoryManager.php +++ b/src/Composer/Repository/RepositoryManager.php @@ -40,10 +40,10 @@ class RepositoryManager /** * Searches for a package by it's name and version in managed repositories. * - * @param string $name package name - * @param string $version package version + * @param string $name package name + * @param string $version package version * - * @return PackageInterface|null + * @return PackageInterface|null */ public function findPackage($name, $version) { @@ -57,10 +57,10 @@ class RepositoryManager /** * Searches for all packages matching a name and optionally a version in managed repositories. * - * @param string $name package name - * @param string $version package version + * @param string $name package name + * @param string $version package version * - * @return array + * @return array */ public function findPackages($name, $version) { @@ -76,7 +76,7 @@ class RepositoryManager /** * Adds repository * - * @param RepositoryInterface $repository repository instance + * @param RepositoryInterface $repository repository instance */ public function addRepository(RepositoryInterface $repository) { @@ -86,10 +86,10 @@ class RepositoryManager /** * Returns a new repository for a specific installation type. * - * @param string $type repository type - * @param string $config repository configuration - * @return RepositoryInterface - * @throws InvalidArgumentException if repository for provided type is not registeterd + * @param string $type repository type + * @param string $config repository configuration + * @return RepositoryInterface + * @throws InvalidArgumentException if repository for provided type is not registeterd */ public function createRepository($type, $config) { @@ -98,14 +98,15 @@ class RepositoryManager } $class = $this->repositoryClasses[$type]; + return new $class($config, $this->io, $this->config); } /** * Stores repository class for a specific installation type. * - * @param string $type installation type - * @param string $class class name of the repo implementation + * @param string $type installation type + * @param string $class class name of the repo implementation */ public function setRepositoryClass($type, $class) { @@ -115,7 +116,7 @@ class RepositoryManager /** * Returns all repositories, except local one. * - * @return array + * @return array */ public function getRepositories() { @@ -125,7 +126,7 @@ class RepositoryManager /** * Sets local repository for the project. * - * @param RepositoryInterface $repository repository instance + * @param RepositoryInterface $repository repository instance */ public function setLocalRepository(RepositoryInterface $repository) { @@ -135,7 +136,7 @@ class RepositoryManager /** * Returns local repository for the project. * - * @return RepositoryInterface + * @return RepositoryInterface */ public function getLocalRepository() { @@ -145,7 +146,7 @@ class RepositoryManager /** * Sets localDev repository for the project. * - * @param RepositoryInterface $repository repository instance + * @param RepositoryInterface $repository repository instance */ public function setLocalDevRepository(RepositoryInterface $repository) { @@ -155,7 +156,7 @@ class RepositoryManager /** * Returns localDev repository for the project. * - * @return RepositoryInterface + * @return RepositoryInterface */ public function getLocalDevRepository() { @@ -165,7 +166,7 @@ class RepositoryManager /** * Returns all local repositories for the project. * - * @return array[RepositoryInterface] + * @return array[RepositoryInterface] */ public function getLocalRepositories() { diff --git a/src/Composer/Repository/Vcs/GitBitbucketDriver.php b/src/Composer/Repository/Vcs/GitBitbucketDriver.php index 28eb66631..0ed579fa4 100644 --- a/src/Composer/Repository/Vcs/GitBitbucketDriver.php +++ b/src/Composer/Repository/Vcs/GitBitbucketDriver.php @@ -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; } diff --git a/src/Composer/Repository/Vcs/GitHubDriver.php b/src/Composer/Repository/Vcs/GitHubDriver.php index f97b9c37c..425683983 100644 --- a/src/Composer/Repository/Vcs/GitHubDriver.php +++ b/src/Composer/Repository/Vcs/GitHubDriver.php @@ -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; } @@ -245,7 +247,7 @@ class GitHubDriver extends VcsDriver $this->rootIdentifier = 'master'; } } catch (TransportException $e) { - switch($e->getCode()) { + switch ($e->getCode()) { case 401: case 404: $this->isPrivate = true; @@ -262,6 +264,7 @@ class GitHubDriver extends VcsDriver $this->remoteFilesystem ); $this->gitDriver->initialize(); + return; } $this->io->write('Authentication required ('.$this->url.'):'); diff --git a/src/Composer/Repository/Vcs/HgBitbucketDriver.php b/src/Composer/Repository/Vcs/HgBitbucketDriver.php index dfdf033f5..d0d1097b2 100644 --- a/src/Composer/Repository/Vcs/HgBitbucketDriver.php +++ b/src/Composer/Repository/Vcs/HgBitbucketDriver.php @@ -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; } diff --git a/src/Composer/Repository/Vcs/HgDriver.php b/src/Composer/Repository/Vcs/HgDriver.php index 45186da7c..b4d5e0478 100644 --- a/src/Composer/Repository/Vcs/HgDriver.php +++ b/src/Composer/Repository/Vcs/HgDriver.php @@ -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; } } diff --git a/src/Composer/Repository/Vcs/VcsDriver.php b/src/Composer/Repository/Vcs/VcsDriver.php index 785d53548..3e2680942 100644 --- a/src/Composer/Repository/Vcs/VcsDriver.php +++ b/src/Composer/Repository/Vcs/VcsDriver.php @@ -35,11 +35,11 @@ abstract class VcsDriver implements VcsDriverInterface /** * Constructor. * - * @param string $url The URL - * @param IOInterface $io The IO instance - * @param Config $config The composer configuration - * @param ProcessExecutor $process Process instance, injectable for mocking - * @param callable $remoteFilesystem Remote Filesystem, injectable for mocking + * @param string $url The URL + * @param IOInterface $io The IO instance + * @param Config $config The composer configuration + * @param ProcessExecutor $process Process instance, injectable for mocking + * @param callable $remoteFilesystem Remote Filesystem, injectable for mocking */ final public function __construct($url, IOInterface $io, Config $config, ProcessExecutor $process = null, $remoteFilesystem = null) { @@ -76,6 +76,7 @@ abstract class VcsDriver implements VcsDriverInterface if (extension_loaded('openssl')) { return 'https'; } + return 'http'; } diff --git a/src/Composer/Repository/Vcs/VcsDriverInterface.php b/src/Composer/Repository/Vcs/VcsDriverInterface.php index 472461ed3..c74977f8c 100644 --- a/src/Composer/Repository/Vcs/VcsDriverInterface.php +++ b/src/Composer/Repository/Vcs/VcsDriverInterface.php @@ -27,8 +27,8 @@ interface VcsDriverInterface /** * Return the composer.json file information * - * @param string $identifier Any identifier to a specific branch/tag/commit - * @return array containing all infos from the composer.json file + * @param string $identifier Any identifier to a specific branch/tag/commit + * @return array containing all infos from the composer.json file */ function getComposerInformation($identifier); @@ -54,14 +54,14 @@ interface VcsDriverInterface function getTags(); /** - * @param string $identifier Any identifier to a specific branch/tag/commit - * @return array With type, url reference and shasum keys. + * @param string $identifier Any identifier to a specific branch/tag/commit + * @return array With type, url reference and shasum keys. */ function getDist($identifier); /** - * @param string $identifier Any identifier to a specific branch/tag/commit - * @return array With type, url and reference keys. + * @param string $identifier Any identifier to a specific branch/tag/commit + * @return array With type, url and reference keys. */ function getSource($identifier); @@ -76,7 +76,7 @@ interface VcsDriverInterface * Return true if the repository has a composer file for a given identifier, * false otherwise. * - * @param string $identifier Any identifier to a specific branch/tag/commit + * @param string $identifier Any identifier to a specific branch/tag/commit * @return boolean Whether the repository has a composer file for a given identifier. */ function hasComposerFile($identifier); @@ -84,9 +84,9 @@ interface VcsDriverInterface /** * Checks if this driver can handle a given url * - * @param IOInterface $io IO instance - * @param string $url - * @param Boolean $shallow unless true, only shallow checks (url matching typically) should be done + * @param IOInterface $io IO instance + * @param string $url + * @param Boolean $shallow unless true, only shallow checks (url matching typically) should be done * @return Boolean */ static function supports(IOInterface $io, $url, $deep = false); diff --git a/src/Composer/Repository/VcsRepository.php b/src/Composer/Repository/VcsRepository.php index ea560fc92..67e15f5a9 100644 --- a/src/Composer/Repository/VcsRepository.php +++ b/src/Composer/Repository/VcsRepository.php @@ -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; } } diff --git a/src/Composer/Repository/WritableRepositoryInterface.php b/src/Composer/Repository/WritableRepositoryInterface.php index dc67628ad..b0cef8c5d 100644 --- a/src/Composer/Repository/WritableRepositoryInterface.php +++ b/src/Composer/Repository/WritableRepositoryInterface.php @@ -29,14 +29,14 @@ interface WritableRepositoryInterface extends RepositoryInterface /** * Adds package to the repository. * - * @param PackageInterface $package package instance + * @param PackageInterface $package package instance */ function addPackage(PackageInterface $package); /** * Removes package from the repository. * - * @param PackageInterface $package package instance + * @param PackageInterface $package package instance */ function removePackage(PackageInterface $package); diff --git a/src/Composer/Script/CommandEvent.php b/src/Composer/Script/CommandEvent.php index 2526a99d7..5d8f732c9 100644 --- a/src/Composer/Script/CommandEvent.php +++ b/src/Composer/Script/CommandEvent.php @@ -13,8 +13,6 @@ namespace Composer\Script; use Composer\Composer; -use Composer\IO\IOInterface; -use Composer\Package\PackageInterface; /** * The Command Event. diff --git a/src/Composer/Script/EventDispatcher.php b/src/Composer/Script/EventDispatcher.php index 83b4fb500..820675b8a 100644 --- a/src/Composer/Script/EventDispatcher.php +++ b/src/Composer/Script/EventDispatcher.php @@ -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; @@ -53,7 +50,7 @@ class EventDispatcher /** * Dispatch a package event. * - * @param string $eventName The constant in ScriptEvents + * @param string $eventName The constant in ScriptEvents * @param OperationInterface $operation The package being installed/updated/removed */ public function dispatchPackageEvent($eventName, OperationInterface $operation) @@ -96,7 +93,7 @@ class EventDispatcher } /** - * @param Event $event Event object + * @param Event $event Event object * @return array Listeners */ protected function getListeners(Event $event) diff --git a/src/Composer/Script/PackageEvent.php b/src/Composer/Script/PackageEvent.php index 7d0e39407..e1bf97920 100644 --- a/src/Composer/Script/PackageEvent.php +++ b/src/Composer/Script/PackageEvent.php @@ -31,9 +31,9 @@ class PackageEvent extends Event /** * Constructor. * - * @param string $name The event name - * @param Composer $composer The composer objet - * @param IOInterface $io The IOInterface object + * @param string $name The event name + * @param Composer $composer The composer objet + * @param IOInterface $io The IOInterface object * @param OperationInterface $operation The operation object */ public function __construct($name, Composer $composer, IOInterface $io, OperationInterface $operation) diff --git a/src/Composer/Util/Filesystem.php b/src/Composer/Util/Filesystem.php index fd60cd2fd..27f41a308 100644 --- a/src/Composer/Util/Filesystem.php +++ b/src/Composer/Util/Filesystem.php @@ -56,9 +56,9 @@ class Filesystem /** * Returns the shortest path from $from to $to * - * @param string $from - * @param string $to - * @param Boolean $directories if true, the source/target are considered to be directories + * @param string $from + * @param string $to + * @param Boolean $directories if true, the source/target are considered to be directories * @return string */ public function findShortestPath($from, $to, $directories = false) @@ -90,15 +90,16 @@ class Filesystem $commonPath = rtrim($commonPath, '/') . '/'; $sourcePathDepth = substr_count(substr($from, strlen($commonPath)), '/'); $commonPathCode = str_repeat('../', $sourcePathDepth); + return ($commonPathCode . substr($to, strlen($commonPath))) ?: './'; } /** * Returns PHP code that, when executed in $from, will return the path to $to * - * @param string $from - * @param string $to - * @param Boolean $directories if true, the source/target are considered to be directories + * @param string $from + * @param string $to + * @param Boolean $directories if true, the source/target are considered to be directories * @return string */ public function findShortestPathCode($from, $to, $directories = false) @@ -130,13 +131,14 @@ 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) : ''); } /** * Checks if the given path is absolute * - * @param string $path + * @param string $path * @return Boolean */ public function isAbsolutePath($path) diff --git a/src/Composer/Util/ProcessExecutor.php b/src/Composer/Util/ProcessExecutor.php index 34e195f51..9965f2013 100644 --- a/src/Composer/Util/ProcessExecutor.php +++ b/src/Composer/Util/ProcessExecutor.php @@ -30,8 +30,8 @@ class ProcessExecutor * @param string $command the command to execute * @param mixed $output the output will be written into this var if passed by ref * if a callable is passed it will be used as output handler - * @param string $cwd the working directory - * @return int statuscode + * @param string $cwd the working directory + * @return int statuscode */ public function execute($command, &$output = null, $cwd = null) { diff --git a/src/Composer/Util/RemoteFilesystem.php b/src/Composer/Util/RemoteFilesystem.php index 695e765f3..babee6094 100644 --- a/src/Composer/Util/RemoteFilesystem.php +++ b/src/Composer/Util/RemoteFilesystem.php @@ -34,7 +34,7 @@ class RemoteFilesystem /** * Constructor. * - * @param IOInterface $io The IO instance + * @param IOInterface $io The IO instance */ public function __construct(IOInterface $io) { diff --git a/src/Composer/Util/StreamContextFactory.php b/src/Composer/Util/StreamContextFactory.php index 8860e7f17..b05cf0c15 100644 --- a/src/Composer/Util/StreamContextFactory.php +++ b/src/Composer/Util/StreamContextFactory.php @@ -22,9 +22,9 @@ final class StreamContextFactory /** * Creates a context supporting HTTP proxies * - * @param array $defaultOptions Options to merge with the default - * @param array $defaultParams Parameters to specify on the context - * @return resource Default context + * @param array $defaultOptions Options to merge with the default + * @param array $defaultParams Parameters to specify on the context + * @return resource Default context * @throws \RuntimeException if https proxy required and OpenSSL uninstalled */ static public function getContext(array $defaultOptions = array(), array $defaultParams = array()) diff --git a/src/Composer/Util/Svn.php b/src/Composer/Util/Svn.php index 62da6e121..affb4d5ec 100644 --- a/src/Composer/Util/Svn.php +++ b/src/Composer/Util/Svn.php @@ -66,10 +66,10 @@ class Svn * Execute an SVN command and try to fix up the process with credentials * if necessary. * - * @param string $command SVN command to run - * @param string $url SVN url - * @param string $cwd Working directory - * @param string $path Target for a checkout + * @param string $command SVN command to run + * @param string $url SVN url + * @param string $cwd Working directory + * @param string $path Target for a checkout * @param Boolean $verbose Output all output to the user * * @return string @@ -256,4 +256,4 @@ class Svn { return $this->cacheCredentials ? '' : '--no-auth-cache '; } -} \ No newline at end of file +} diff --git a/src/bootstrap.php b/src/bootstrap.php index 3ce95752c..7ce8c1b0c 100644 --- a/src/bootstrap.php +++ b/src/bootstrap.php @@ -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; } diff --git a/tests/Composer/Test/Autoload/Fixtures/autoload_target_dir.php b/tests/Composer/Test/Autoload/Fixtures/autoload_target_dir.php index 16d187d27..a4012aab9 100644 --- a/tests/Composer/Test/Autoload/Fixtures/autoload_target_dir.php +++ b/tests/Composer/Test/Autoload/Fixtures/autoload_target_dir.php @@ -31,6 +31,7 @@ return call_user_func(function() { return false; } require_once $path; + return true; } });