diff --git a/src/Composer/Autoload/AutoloadGenerator.php b/src/Composer/Autoload/AutoloadGenerator.php index 45c105ef9..19f194fa1 100644 --- a/src/Composer/Autoload/AutoloadGenerator.php +++ b/src/Composer/Autoload/AutoloadGenerator.php @@ -54,7 +54,7 @@ class AutoloadGenerator public function dump(Config $config, InstalledRepositoryInterface $localRepo, PackageInterface $mainPackage, InstallationManager $installationManager, $targetDir, $scanPsr0Packages = false, $suffix = '') { $this->eventDispatcher->dispatchScript(ScriptEvents::PRE_AUTOLOAD_DUMP, $this->devMode, array(), array( - 'optimize' => (bool) $scanPsr0Packages + 'optimize' => (bool) $scanPsr0Packages, )); $filesystem = new Filesystem(); @@ -255,7 +255,7 @@ EOF; $packageMap[] = array( $package, - $installationManager->getInstallPath($package) + $installationManager->getInstallPath($package), ); } @@ -533,7 +533,6 @@ INCLUDEPATH; REGISTER_AUTOLOAD; - } $file .= <<root . $file, $contents); - } catch(\ErrorException $e) { + } catch (\ErrorException $e) { if (preg_match('{^file_put_contents\(\): Only ([0-9]+) of ([0-9]+) bytes written}', $e->getMessage(), $m)) { // Remove partial file. unlink($this->root . $file); @@ -150,7 +150,7 @@ class Cache public function gcIsNecessary() { - return (!self::$cacheCollected && !mt_rand(0, 50)); + return (!self::$cacheCollected && !mt_rand(0, 50)); } public function remove($file) diff --git a/src/Composer/Command/AboutCommand.php b/src/Composer/Command/AboutCommand.php index da0fb7fbe..ead7604df 100644 --- a/src/Composer/Command/AboutCommand.php +++ b/src/Composer/Command/AboutCommand.php @@ -40,6 +40,5 @@ EOT See http://getcomposer.org/ for more information. EOT ); - } } diff --git a/src/Composer/Command/ArchiveCommand.php b/src/Composer/Command/ArchiveCommand.php index 34f6fe8a6..913a56a42 100644 --- a/src/Composer/Command/ArchiveCommand.php +++ b/src/Composer/Command/ArchiveCommand.php @@ -15,7 +15,6 @@ namespace Composer\Command; use Composer\Factory; use Composer\IO\IOInterface; use Composer\DependencyResolver\Pool; -use Composer\Package\LinkConstraint\VersionConstraint; use Composer\Repository\CompositeRepository; use Composer\Script\ScriptEvents; use Composer\Plugin\CommandEvent; diff --git a/src/Composer/Command/ClearCacheCommand.php b/src/Composer/Command/ClearCacheCommand.php index 47d139144..b1b9ecd9a 100644 --- a/src/Composer/Command/ClearCacheCommand.php +++ b/src/Composer/Command/ClearCacheCommand.php @@ -52,11 +52,13 @@ EOT $cachePath = realpath($cachePath); if (!$cachePath) { $io->write("Cache directory does not exist ($key): $cachePath"); + return; } $cache = new Cache($io, $cachePath); if (!$cache->isEnabled()) { $io->write("Cache is not enabled ($key): $cachePath"); + return; } diff --git a/src/Composer/Command/ConfigCommand.php b/src/Composer/Command/ConfigCommand.php index ab3f1e8e8..a08a6f4a6 100644 --- a/src/Composer/Command/ConfigCommand.php +++ b/src/Composer/Command/ConfigCommand.php @@ -160,7 +160,7 @@ EOT } $file = $input->getOption('auth') ? $this->authConfigFile->getPath() : $this->configFile->getPath(); - system($editor . ' ' . $file . (defined('PHP_WINDOWS_VERSION_BUILD') ? '': ' > `tty`')); + system($editor . ' ' . $file . (defined('PHP_WINDOWS_VERSION_BUILD') ? '' : ' > `tty`')); return 0; } @@ -359,7 +359,7 @@ EOT ); foreach ($uniqueConfigValues as $name => $callbacks) { - if ($settingKey === $name) { + if ($settingKey === $name) { if ($input->getOption('unset')) { return $this->configSource->removeConfigSetting($settingKey); } diff --git a/src/Composer/Command/CreateProjectCommand.php b/src/Composer/Command/CreateProjectCommand.php index 9928692eb..935370bfc 100644 --- a/src/Composer/Command/CreateProjectCommand.php +++ b/src/Composer/Command/CreateProjectCommand.php @@ -322,7 +322,6 @@ EOT return new InstallationManager(); } - /** * Updated preferSource or preferDist based on the preferredInstall config option * @param Config $config diff --git a/src/Composer/Command/HomeCommand.php b/src/Composer/Command/HomeCommand.php index 023fb0843..5b0e32244 100644 --- a/src/Composer/Command/HomeCommand.php +++ b/src/Composer/Command/HomeCommand.php @@ -15,7 +15,6 @@ namespace Composer\Command; use Composer\DependencyResolver\Pool; use Composer\Factory; use Composer\Package\CompletePackageInterface; -use Composer\Package\Loader\InvalidPackageException; use Composer\Repository\CompositeRepository; use Composer\Repository\RepositoryInterface; use Composer\Util\ProcessExecutor; @@ -23,7 +22,6 @@ use Symfony\Component\Console\Input\InputArgument; use Symfony\Component\Console\Input\InputOption; use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Output\OutputInterface; -use Symfony\Component\Process\Exception\InvalidArgumentException; /** * @author Robert Schönthal @@ -92,8 +90,8 @@ EOT /** * finds a package by name * - * @param RepositoryInterface $repos - * @param string $name + * @param RepositoryInterface $repos + * @param string $name * @return CompletePackageInterface */ protected function getPackage(RepositoryInterface $repos, $name) @@ -142,8 +140,8 @@ EOT /** * initializes the repo * - * @param InputInterface $input - * @param OutputInterface $output + * @param InputInterface $input + * @param OutputInterface $output * @return CompositeRepository */ private function initializeRepo(InputInterface $input, OutputInterface $output) @@ -159,5 +157,4 @@ EOT return $repo; } - } diff --git a/src/Composer/Command/InitCommand.php b/src/Composer/Command/InitCommand.php index 64e30de59..462b6d438 100644 --- a/src/Composer/Command/InitCommand.php +++ b/src/Composer/Command/InitCommand.php @@ -105,7 +105,7 @@ EOT } if (isset($options['require-dev'])) { - $options['require-dev'] = $this->formatRequirements($options['require-dev']) ; + $options['require-dev'] = $this->formatRequirements($options['require-dev']); if (array() === $options['require-dev']) { $options['require-dev'] = new \stdClass; } @@ -311,7 +311,6 @@ EOT foreach ($requires as $requirement) { if (!isset($requirement['version'])) { - // determine the best version automatically $version = $this->findBestVersionForPackage($input, $requirement['name']); $requirement['version'] = $version; @@ -553,8 +552,8 @@ EOT * * This returns a version with the ~ operator prefixed when possible. * - * @param InputInterface $input - * @param string $name + * @param InputInterface $input + * @param string $name * @return string * @throws \InvalidArgumentException */ diff --git a/src/Composer/Command/InstallCommand.php b/src/Composer/Command/InstallCommand.php index 43a169e7d..669c03582 100644 --- a/src/Composer/Command/InstallCommand.php +++ b/src/Composer/Command/InstallCommand.php @@ -115,7 +115,7 @@ EOT ->setDevMode(!$input->getOption('no-dev')) ->setRunScripts(!$input->getOption('no-scripts')) ->setOptimizeAutoloader($optimize) - ->setIgnorePlatformRequirements($input->getOption('ignore-platform-reqs')); + ->setIgnorePlatformRequirements($input->getOption('ignore-platform-reqs')) ; if ($input->getOption('no-plugins')) { diff --git a/src/Composer/Command/RemoveCommand.php b/src/Composer/Command/RemoveCommand.php index ee1754c65..cb83f56b7 100755 --- a/src/Composer/Command/RemoveCommand.php +++ b/src/Composer/Command/RemoveCommand.php @@ -104,7 +104,7 @@ EOT ->setDevMode($updateDevMode) ->setUpdate(true) ->setUpdateWhitelist($packages) - ->setWhitelistDependencies($input->getOption('update-with-dependencies')); + ->setWhitelistDependencies($input->getOption('update-with-dependencies')) ; $status = $install->run(); diff --git a/src/Composer/Command/RequireCommand.php b/src/Composer/Command/RequireCommand.php index 682a44e66..908159104 100644 --- a/src/Composer/Command/RequireCommand.php +++ b/src/Composer/Command/RequireCommand.php @@ -130,7 +130,7 @@ EOT ->setDevMode($updateDevMode) ->setUpdate(true) ->setUpdateWhitelist(array_keys($requirements)) - ->setWhitelistDependencies($input->getOption('update-with-dependencies')); + ->setWhitelistDependencies($input->getOption('update-with-dependencies')) ; $status = $install->run(); diff --git a/src/Composer/Command/UpdateCommand.php b/src/Composer/Command/UpdateCommand.php index 9d1e95dd0..ebfd4cb2a 100644 --- a/src/Composer/Command/UpdateCommand.php +++ b/src/Composer/Command/UpdateCommand.php @@ -120,7 +120,7 @@ EOT ->setUpdate(true) ->setUpdateWhitelist($input->getOption('lock') ? array('lock') : $input->getArgument('packages')) ->setWhitelistDependencies($input->getOption('with-dependencies')) - ->setIgnorePlatformRequirements($input->getOption('ignore-platform-reqs')); + ->setIgnorePlatformRequirements($input->getOption('ignore-platform-reqs')) ; if ($input->getOption('no-plugins')) { diff --git a/src/Composer/Config/JsonConfigSource.php b/src/Composer/Config/JsonConfigSource.php index 4d0a873f5..4fba2943c 100644 --- a/src/Composer/Config/JsonConfigSource.php +++ b/src/Composer/Config/JsonConfigSource.php @@ -187,7 +187,7 @@ class JsonConfigSource implements ConfigSourceInterface private function arrayUnshiftRef(&$array, &$value) { $return = array_unshift($array, ''); - $array[0] =& $value; + $array[0] = &$value; return $return; } diff --git a/src/Composer/Console/Application.php b/src/Composer/Console/Application.php index 7148a9a11..6b4167ee7 100644 --- a/src/Composer/Console/Application.php +++ b/src/Composer/Console/Application.php @@ -25,7 +25,6 @@ use Composer\Factory; use Composer\IO\IOInterface; use Composer\IO\ConsoleIO; use Composer\Json\JsonValidationException; -use Composer\Json\JsonFile; use Composer\Util\ErrorHandler; /** @@ -180,7 +179,8 @@ class Application extends BaseApplication $output->writeln('The disk hosting '.$dir.' is full, this may be the cause of the following exception'); } } - } catch (\Exception $e) {} + } catch (\Exception $e) { + } return parent::renderException($exception, $output); } @@ -206,7 +206,6 @@ class Application extends BaseApplication $message = $e->getMessage() . ':' . PHP_EOL . $errors; throw new JsonValidationException($message); } - } return $this->composer; diff --git a/src/Composer/DependencyResolver/Pool.php b/src/Composer/DependencyResolver/Pool.php index d0c660f82..05645c87a 100644 --- a/src/Composer/DependencyResolver/Pool.php +++ b/src/Composer/DependencyResolver/Pool.php @@ -232,7 +232,7 @@ class Pool * packages must match or null to return all * @param bool $mustMatchName Whether the name of returned packages * must match the given name - * @return PackageInterface[] A set of packages + * @return PackageInterface[] A set of packages */ public function whatProvides($name, LinkConstraintInterface $constraint = null, $mustMatchName = false) { diff --git a/src/Composer/DependencyResolver/Solver.php b/src/Composer/DependencyResolver/Solver.php index 2a0256e40..36b1d9862 100644 --- a/src/Composer/DependencyResolver/Solver.php +++ b/src/Composer/DependencyResolver/Solver.php @@ -83,7 +83,6 @@ class Solver $conflict = $this->decisions->decisionRule($literal); if ($conflict && RuleSet::TYPE_PACKAGE === $conflict->getType()) { - $problem = new Problem($this->pool); $problem->addRule($rule); @@ -609,7 +608,6 @@ class Solver $installedPos = 0; while (true) { - if (1 === $level) { $conflictRule = $this->propagate($level); if (null !== $conflictRule) { @@ -658,7 +656,6 @@ class Solver } if ($noneSatisfied && count($decisionQueue)) { - $oLevel = $level; $level = $this->selectAndInstall($level, $decisionQueue, $disableRules, $rule); @@ -742,7 +739,6 @@ class Solver // minimization step if (count($this->branches)) { - $lastLiteral = null; $lastLevel = null; $lastBranchIndex = 0; diff --git a/src/Composer/DependencyResolver/Transaction.php b/src/Composer/DependencyResolver/Transaction.php index 214c502d1..b9569b3fa 100644 --- a/src/Composer/DependencyResolver/Transaction.php +++ b/src/Composer/DependencyResolver/Transaction.php @@ -55,7 +55,6 @@ class Transaction if ($literal > 0) { if (isset($installMeansUpdateMap[abs($literal)]) && !$package instanceof AliasPackage) { - $source = $installMeansUpdateMap[abs($literal)]; $updateMap[$package->getId()] = array( @@ -88,7 +87,6 @@ class Transaction 'package' => $package, 'reason' => $reason, ); - } } diff --git a/src/Composer/Downloader/ArchiveDownloader.php b/src/Composer/Downloader/ArchiveDownloader.php index 9d78d7e2d..204c09154 100644 --- a/src/Composer/Downloader/ArchiveDownloader.php +++ b/src/Composer/Downloader/ArchiveDownloader.php @@ -137,7 +137,7 @@ abstract class ArchiveDownloader extends FileDownloader /** * Returns the folder content, excluding dotfiles * - * @param string $dir Directory + * @param string $dir Directory * @return \SplFileInfo[] */ private function getFolderContent($dir) diff --git a/src/Composer/Downloader/FileDownloader.php b/src/Composer/Downloader/FileDownloader.php index 82a256b7c..0c03f18ab 100644 --- a/src/Composer/Downloader/FileDownloader.php +++ b/src/Composer/Downloader/FileDownloader.php @@ -101,7 +101,7 @@ class FileDownloader implements DownloaderInterface } } } - + $this->io->write(''); } diff --git a/src/Composer/Downloader/PearPackageExtractor.php b/src/Composer/Downloader/PearPackageExtractor.php index 3ed3ed7be..ff0c90a9f 100644 --- a/src/Composer/Downloader/PearPackageExtractor.php +++ b/src/Composer/Downloader/PearPackageExtractor.php @@ -138,8 +138,9 @@ class PearPackageExtractor { /** @var $package \SimpleXmlElement */ $package = simplexml_load_file($this->combine($source, 'package.xml')); - if(false === $package) + if (false === $package) { throw new \RuntimeException('Package definition file is not valid.'); + } $packageSchemaVersion = $package['version']; if ('1.0' == $packageSchemaVersion) { @@ -203,16 +204,16 @@ class PearPackageExtractor /** @var $child \SimpleXMLElement */ if ($child->getName() == 'dir') { $dirSource = $this->combine($source, (string) $child['name']); - $dirTarget = $child['baseinstalldir'] ? : $target; - $dirRole = $child['role'] ? : $role; + $dirTarget = $child['baseinstalldir'] ?: $target; + $dirRole = $child['role'] ?: $role; $dirFiles = $this->buildSourceList10($child->children(), $targetRoles, $dirSource, $dirTarget, $dirRole, $packageName); $result = array_merge($result, $dirFiles); } elseif ($child->getName() == 'file') { - $fileRole = (string) $child['role'] ? : $role; + $fileRole = (string) $child['role'] ?: $role; if (isset($targetRoles[$fileRole])) { - $fileName = (string) ($child['name'] ? : $child[0]); // $child[0] means text content + $fileName = (string) ($child['name'] ?: $child[0]); // $child[0] means text content $fileSource = $this->combine($source, $fileName); - $fileTarget = $this->combine((string) $child['baseinstalldir'] ? : $target, $fileName); + $fileTarget = $this->combine((string) $child['baseinstalldir'] ?: $target, $fileName); if (!in_array($fileRole, self::$rolesWithoutPackageNamePrefix)) { $fileTarget = $packageName . '/' . $fileTarget; } @@ -233,15 +234,15 @@ class PearPackageExtractor /** @var $child \SimpleXMLElement */ if ('dir' == $child->getName()) { $dirSource = $this->combine($source, $child['name']); - $dirTarget = $child['baseinstalldir'] ? : $target; - $dirRole = $child['role'] ? : $role; + $dirTarget = $child['baseinstalldir'] ?: $target; + $dirRole = $child['role'] ?: $role; $dirFiles = $this->buildSourceList20($child->children(), $targetRoles, $dirSource, $dirTarget, $dirRole, $packageName); $result = array_merge($result, $dirFiles); } elseif ('file' == $child->getName()) { - $fileRole = (string) $child['role'] ? : $role; + $fileRole = (string) $child['role'] ?: $role; if (isset($targetRoles[$fileRole])) { $fileSource = $this->combine($source, (string) $child['name']); - $fileTarget = $this->combine((string) ($child['baseinstalldir'] ? : $target), (string) $child['name']); + $fileTarget = $this->combine((string) ($child['baseinstalldir'] ?: $target), (string) $child['name']); $fileTasks = array(); foreach ($child->children('http://pear.php.net/dtd/tasks-1.0') as $taskNode) { if ('replace' == $taskNode->getName()) { diff --git a/src/Composer/EventDispatcher/Event.php b/src/Composer/EventDispatcher/Event.php index b9ebeb029..38ae4f440 100644 --- a/src/Composer/EventDispatcher/Event.php +++ b/src/Composer/EventDispatcher/Event.php @@ -42,9 +42,9 @@ class Event /** * Constructor. * - * @param string $name The event name - * @param array $args Arguments passed by the user - * @param array $flags Optional flags to pass data not as argument + * @param string $name The event name + * @param array $args Arguments passed by the user + * @param array $flags Optional flags to pass data not as argument */ public function __construct($name, array $args = array(), array $flags = array()) { diff --git a/src/Composer/EventDispatcher/EventDispatcher.php b/src/Composer/EventDispatcher/EventDispatcher.php index 3026d3c9c..0f534b470 100644 --- a/src/Composer/EventDispatcher/EventDispatcher.php +++ b/src/Composer/EventDispatcher/EventDispatcher.php @@ -79,12 +79,12 @@ class EventDispatcher /** * Dispatch a script event. * - * @param string $eventName The constant in ScriptEvents - * @param bool $devMode - * @param array $additionalArgs Arguments passed by the user - * @param array $flags Optional flags to pass data not as argument - * @return int return code of the executed script if any, for php scripts a false return - * value is changed to 1, anything else to 0 + * @param string $eventName The constant in ScriptEvents + * @param bool $devMode + * @param array $additionalArgs Arguments passed by the user + * @param array $flags Optional flags to pass data not as argument + * @return int return code of the executed script if any, for php scripts a false return + * value is changed to 1, anything else to 0 */ public function dispatchScript($eventName, $devMode = false, $additionalArgs = array(), $flags = array()) { @@ -108,19 +108,18 @@ class EventDispatcher /** * Dispatch a command event. * - * @param string $eventName The constant in ScriptEvents - * @param boolean $devMode Whether or not we are in dev mode + * @param string $eventName The constant in ScriptEvents + * @param boolean $devMode Whether or not we are in dev mode * @param array $additionalArgs Arguments passed by the user * @param array $flags Optional flags to pass data not as argument * @return int return code of the executed script if any, for php scripts a false return - * value is changed to 1, anything else to 0 + * value is changed to 1, anything else to 0 */ public function dispatchCommandEvent($eventName, $devMode, $additionalArgs = array(), $flags = array()) { return $this->doDispatch(new CommandEvent($eventName, $this->composer, $this->io, $devMode, $additionalArgs, $flags)); } - /** * Dispatch a installer event. * @@ -132,7 +131,7 @@ class EventDispatcher * @param array $operations The list of operations * * @return int return code of the executed script if any, for php scripts a false return - * value is changed to 1, anything else to 0 + * value is changed to 1, anything else to 0 */ public function dispatchInstallerEvent($eventName, PolicyInterface $policy, Pool $pool, CompositeRepository $installedRepo, Request $request, array $operations = array()) { @@ -142,10 +141,10 @@ class EventDispatcher /** * Triggers the listeners of an event. * - * @param Event $event The event object to pass to the event handlers/listeners. + * @param Event $event The event object to pass to the event handlers/listeners. * @param string $additionalArgs * @return int return code of the executed script if any, for php scripts a false return - * value is changed to 1, anything else to 0 + * value is changed to 1, anything else to 0 * @throws \RuntimeException * @throws \Exception */ diff --git a/src/Composer/Factory.php b/src/Composer/Factory.php index e495f05f6..4f7bfefd8 100644 --- a/src/Composer/Factory.php +++ b/src/Composer/Factory.php @@ -85,7 +85,7 @@ class Factory } /** - * @param IOInterface|null $io + * @param IOInterface|null $io * @return Config */ public static function createConfig(IOInterface $io = null) @@ -335,8 +335,8 @@ class Factory } /** - * @param Config $config - * @param string $vendorDir + * @param Config $config + * @param string $vendorDir * @return Repository\InstalledFilesystemRepository|null */ protected function createGlobalRepository(Config $config, $vendorDir) @@ -415,9 +415,9 @@ class Factory } /** - * @param Composer $composer - * @param IOInterface $io - * @param RepositoryInterface $globalRepository + * @param Composer $composer + * @param IOInterface $io + * @param RepositoryInterface $globalRepository * @return Plugin\PluginManager */ protected function createPluginManager(Composer $composer, IOInterface $io, RepositoryInterface $globalRepository = null) diff --git a/src/Composer/Installer.php b/src/Composer/Installer.php index 4fb58e07f..294ab0a0a 100644 --- a/src/Composer/Installer.php +++ b/src/Composer/Installer.php @@ -380,7 +380,7 @@ class Installer } if ($this->update) { - $this->io->write('Updating dependencies'.($withDevReqs?' (including require-dev)':'').''); + $this->io->write('Updating dependencies'.($withDevReqs ? ' (including require-dev)' : '').''); $request->updateAll(); @@ -431,7 +431,7 @@ class Installer } } } elseif ($installFromLock) { - $this->io->write('Installing dependencies'.($withDevReqs?' (including require-dev)':'').' from lock file'); + $this->io->write('Installing dependencies'.($withDevReqs ? ' (including require-dev)' : '').' from lock file'); if (!$this->locker->isFresh()) { $this->io->write('Warning: The lock file is not up to date with the latest changes in composer.json. You may be getting outdated dependencies. Run update to update them.'); @@ -451,7 +451,7 @@ class Installer $request->install($link->getTarget(), $link->getConstraint()); } } else { - $this->io->write('Installing dependencies'.($withDevReqs?' (including require-dev)':'').''); + $this->io->write('Installing dependencies'.($withDevReqs ? ' (including require-dev)' : '').''); if ($withDevReqs) { $links = array_merge($this->package->getRequires(), $this->package->getDevRequires()); diff --git a/src/Composer/Installer/PluginInstaller.php b/src/Composer/Installer/PluginInstaller.php index 61c5a2823..b5469ccc6 100644 --- a/src/Composer/Installer/PluginInstaller.php +++ b/src/Composer/Installer/PluginInstaller.php @@ -40,7 +40,6 @@ class PluginInstaller extends LibraryInstaller { parent::__construct($io, $composer, 'composer-plugin'); $this->installationManager = $composer->getInstallationManager(); - } /** diff --git a/src/Composer/Json/JsonFile.php b/src/Composer/Json/JsonFile.php index 80718348c..bed35d598 100644 --- a/src/Composer/Json/JsonFile.php +++ b/src/Composer/Json/JsonFile.php @@ -188,8 +188,8 @@ class JsonFile // compact brackets to follow recent php versions if (PHP_VERSION_ID < 50428 || (PHP_VERSION_ID >= 50500 && PHP_VERSION_ID < 50512)) { - $json = preg_replace('/\[\s+\]/', '[]', $json); - $json = preg_replace('/\{\s+\}/', '{}', $json); + $json = preg_replace('/\[\s+\]/', '[]', $json); + $json = preg_replace('/\{\s+\}/', '{}', $json); } return $json; diff --git a/src/Composer/Json/JsonManipulator.php b/src/Composer/Json/JsonManipulator.php index 6dccc62dc..dd8c49ebd 100644 --- a/src/Composer/Json/JsonManipulator.php +++ b/src/Composer/Json/JsonManipulator.php @@ -42,7 +42,7 @@ class JsonManipulator if (!$this->pregMatch('#^\{(.*)\}$#s', $contents)) { throw new \InvalidArgumentException('The json file must be an object ({})'); } - $this->newline = false !== strpos($contents, "\r\n") ? "\r\n": "\n"; + $this->newline = false !== strpos($contents, "\r\n") ? "\r\n" : "\n"; $this->contents = $contents === '{}' ? '{' . $this->newline . '}' : $contents; $this->detectIndenting(); } diff --git a/src/Composer/Package/LinkConstraint/SpecificConstraint.php b/src/Composer/Package/LinkConstraint/SpecificConstraint.php index eda09c6ec..e0904dbbf 100644 --- a/src/Composer/Package/LinkConstraint/SpecificConstraint.php +++ b/src/Composer/Package/LinkConstraint/SpecificConstraint.php @@ -50,5 +50,4 @@ abstract class SpecificConstraint implements LinkConstraintInterface // implementations must implement a method of this format: // not declared abstract here because type hinting violates parameter coherence (TODO right word?) // public function matchSpecific( $provider); - } diff --git a/src/Composer/Package/Loader/ArrayLoader.php b/src/Composer/Package/Loader/ArrayLoader.php index 142b15c72..d25ea5546 100644 --- a/src/Composer/Package/Loader/ArrayLoader.php +++ b/src/Composer/Package/Loader/ArrayLoader.php @@ -67,7 +67,7 @@ class ArrayLoader implements LoaderInterface throw new \UnexpectedValueException('Package '.$config['name'].'\'s bin key should be an array, '.gettype($config['bin']).' given.'); } foreach ($config['bin'] as $key => $bin) { - $config['bin'][$key]= ltrim($bin, '/'); + $config['bin'][$key] = ltrim($bin, '/'); } $package->setBinaries($config['bin']); } diff --git a/src/Composer/Package/Locker.php b/src/Composer/Package/Locker.php index 4eb836706..9d49f6eaf 100644 --- a/src/Composer/Package/Locker.php +++ b/src/Composer/Package/Locker.php @@ -297,7 +297,7 @@ class Locker $time = $this->getPackageTime($package) ?: $time; } if (null !== $time) { - $spec['time'] = $time; + $spec['time'] = $time; } unset($spec['installation-source']); diff --git a/src/Composer/Package/Version/VersionParser.php b/src/Composer/Package/Version/VersionParser.php index 3825426a8..f14f09622 100644 --- a/src/Composer/Package/Version/VersionParser.php +++ b/src/Composer/Package/Version/VersionParser.php @@ -150,7 +150,8 @@ class VersionParser if (preg_match('{(.*?)[.-]?dev$}i', $version, $match)) { try { return $this->normalizeBranch($match[1]); - } catch (\Exception $e) {} + } catch (\Exception $e) { + } } $extraMessage = ''; @@ -365,7 +366,8 @@ class VersionParser } return array(new VersionConstraint($matches[1] ?: '=', $version)); - } catch (\Exception $e) { } + } catch (\Exception $e) { + } } $message = 'Could not parse version constraint '.$constraint; diff --git a/src/Composer/Package/Version/VersionSelector.php b/src/Composer/Package/Version/VersionSelector.php index 29358027f..202b11883 100644 --- a/src/Composer/Package/Version/VersionSelector.php +++ b/src/Composer/Package/Version/VersionSelector.php @@ -37,8 +37,8 @@ class VersionSelector * Given a package name and optional version, returns the latest PackageInterface * that matches. * - * @param string $packageName - * @param string $targetPackageVersion + * @param string $packageName + * @param string $targetPackageVersion * @return PackageInterface|bool */ public function findBestCandidate($packageName, $targetPackageVersion = null) @@ -73,7 +73,7 @@ class VersionSelector * * dev-master -> ~2.1@dev (dev version with alias) * * dev-master -> dev-master (dev versions are untouched) * - * @param PackageInterface $package + * @param PackageInterface $package * @return string */ public function findRecommendedRequireVersion(PackageInterface $package) @@ -90,6 +90,7 @@ class VersionSelector $extra = preg_replace('{^(\d+\.\d+\.\d+)(\.9999999)-dev$}', '$1.0', $extra, -1, $count); if ($count) { $extra = str_replace('.9999999', '.0', $extra); + return $this->transformVersion($extra, $extra, 'dev'); } } diff --git a/src/Composer/Repository/ArtifactRepository.php b/src/Composer/Repository/ArtifactRepository.php index 0b7775aaf..38936e40a 100644 --- a/src/Composer/Repository/ArtifactRepository.php +++ b/src/Composer/Repository/ArtifactRepository.php @@ -96,7 +96,7 @@ class ArtifactRepository extends ArrayRepository return $i; } - if(strpos($directoryName, '\\') !== false || + if (strpos($directoryName, '\\') !== false || strpos($directoryName, '/') !== false) { //composer.json files below first directory are rejected continue; diff --git a/src/Composer/Repository/Pear/PackageDependencyParser.php b/src/Composer/Repository/Pear/PackageDependencyParser.php index 515993d03..a124cd07a 100644 --- a/src/Composer/Repository/Pear/PackageDependencyParser.php +++ b/src/Composer/Repository/Pear/PackageDependencyParser.php @@ -51,7 +51,7 @@ class PackageDependencyParser */ private function buildDependency10Info($depArray) { - static $dep10toOperatorMap = array('has'=>'==', 'eq' => '==', 'ge' => '>=', 'gt' => '>', 'le' => '<=', 'lt' => '<', 'not' => '!='); + static $dep10toOperatorMap = array('has' => '==', 'eq' => '==', 'ge' => '>=', 'gt' => '>', 'le' => '<=', 'lt' => '<', 'not' => '!='); $result = array(); @@ -255,7 +255,7 @@ class PackageDependencyParser */ private function parse20VersionConstraint(array $data) { - static $dep20toOperatorMap = array('has'=>'==', 'min' => '>=', 'max' => '<=', 'exclude' => '!='); + static $dep20toOperatorMap = array('has' => '==', 'min' => '>=', 'max' => '<=', 'exclude' => '!='); $versions = array(); $values = array_intersect_key($data, $dep20toOperatorMap); diff --git a/src/Composer/Repository/Vcs/GitDriver.php b/src/Composer/Repository/Vcs/GitDriver.php index a020b92c2..a47643988 100644 --- a/src/Composer/Repository/Vcs/GitDriver.php +++ b/src/Composer/Repository/Vcs/GitDriver.php @@ -203,7 +203,7 @@ class GitDriver extends VcsDriver foreach ($this->process->splitLines($output) as $branch) { if ($branch && !preg_match('{^ *[^/]+/HEAD }', $branch)) { if (preg_match('{^(?:\* )? *(\S+) *([a-f0-9]+) .*$}', $branch, $match)) { - $branches[$match[1]] = $match[2]; + $branches[$match[1]] = $match[2]; } } } diff --git a/src/Composer/Repository/Vcs/PerforceDriver.php b/src/Composer/Repository/Vcs/PerforceDriver.php index 7e313bf63..c7c225b27 100644 --- a/src/Composer/Repository/Vcs/PerforceDriver.php +++ b/src/Composer/Repository/Vcs/PerforceDriver.php @@ -182,5 +182,4 @@ class PerforceDriver extends VcsDriver { return $this->branch; } - } diff --git a/src/Composer/Repository/Vcs/SvnDriver.php b/src/Composer/Repository/Vcs/SvnDriver.php index 729bda94e..c8d9a17a6 100644 --- a/src/Composer/Repository/Vcs/SvnDriver.php +++ b/src/Composer/Repository/Vcs/SvnDriver.php @@ -27,7 +27,6 @@ use Composer\Downloader\TransportException; */ class SvnDriver extends VcsDriver { - /** * @var Cache */ diff --git a/src/Composer/Util/NoProxyPattern.php b/src/Composer/Util/NoProxyPattern.php index 533dbc19c..4e5c0c76b 100644 --- a/src/Composer/Util/NoProxyPattern.php +++ b/src/Composer/Util/NoProxyPattern.php @@ -126,7 +126,7 @@ class NoProxyPattern // Now do some bit shifting/switching to convert to ints $i = ($a << 24) + ($b << 16) + ($c << 8) + $d; - $mask = $bits == 0 ? 0: (~0 << (32 - $bits)); + $mask = $bits == 0 ? 0 : (~0 << (32 - $bits)); // Here's our lowest int $low = $i & $mask; diff --git a/src/Composer/Util/Perforce.php b/src/Composer/Util/Perforce.php index d3dcd696f..8e79f87b3 100644 --- a/src/Composer/Util/Perforce.php +++ b/src/Composer/Util/Perforce.php @@ -570,5 +570,4 @@ class Perforce { $this->filesystem = $fs; } - } diff --git a/src/Composer/Util/ProcessExecutor.php b/src/Composer/Util/ProcessExecutor.php index d5a0549d3..46dafb0ae 100644 --- a/src/Composer/Util/ProcessExecutor.php +++ b/src/Composer/Util/ProcessExecutor.php @@ -105,7 +105,7 @@ class ProcessExecutor { static::$timeout = $timeout; } - + /** * Escapes a string to be used as a shell argument. * @@ -113,9 +113,9 @@ class ProcessExecutor * * @return string The escaped argument */ - - public static function escape ($argument) + + public static function escape($argument) { - return ProcessUtils::escapeArgument($argument); + return ProcessUtils::escapeArgument($argument); } } diff --git a/src/Composer/Util/Svn.php b/src/Composer/Util/Svn.php index 4b6d615fb..4949aa271 100644 --- a/src/Composer/Util/Svn.php +++ b/src/Composer/Util/Svn.php @@ -137,7 +137,6 @@ class Svn // try to authenticate if maximum quantity of tries not reached if ($this->qtyAuthTries++ < self::MAX_QTY_AUTH_TRIES) { - // restart the process return $this->execute($command, $url, $cwd, $path, $verbose); } diff --git a/tests/Composer/Test/Autoload/ClassLoaderTest.php b/tests/Composer/Test/Autoload/ClassLoaderTest.php index eee942e42..ad42e233a 100644 --- a/tests/Composer/Test/Autoload/ClassLoaderTest.php +++ b/tests/Composer/Test/Autoload/ClassLoaderTest.php @@ -18,7 +18,7 @@ class ClassLoaderTest extends \PHPUnit_Framework_TestCase * @param bool $prependSeparator Whether to call ->loadClass() with a class name with preceding * namespace separator, as it happens in PHP 5.3.0 - 5.3.2. See https://bugs.php.net/50731 */ - public function testLoadClass($class, $prependSeparator = FALSE) + public function testLoadClass($class, $prependSeparator = false) { $loader = new ClassLoader(); $loader->add('Namespaced\\', __DIR__ . '/Fixtures'); diff --git a/tests/Composer/Test/Config/JsonConfigSourceTest.php b/tests/Composer/Test/Config/JsonConfigSourceTest.php index d0b78f3e3..b7a3b592c 100644 --- a/tests/Composer/Test/Config/JsonConfigSourceTest.php +++ b/tests/Composer/Test/Config/JsonConfigSourceTest.php @@ -48,7 +48,6 @@ class JsonConfigSourceTest extends \PHPUnit_Framework_TestCase $value, $this->fixturePath('addLink/'.$fixtureBasename.'.json'), ); - } /** diff --git a/tests/Composer/Test/DependencyResolver/SolverTest.php b/tests/Composer/Test/DependencyResolver/SolverTest.php index ac78b5a26..d3b540f47 100644 --- a/tests/Composer/Test/DependencyResolver/SolverTest.php +++ b/tests/Composer/Test/DependencyResolver/SolverTest.php @@ -654,8 +654,7 @@ class SolverTest extends TestCase public function testConflictResultEmpty() { $this->repo->addPackage($packageA = $this->getPackage('A', '1.0')); - $this->repo->addPackage($packageB = $this->getPackage('B', '1.0'));; - + $this->repo->addPackage($packageB = $this->getPackage('B', '1.0')); $packageA->setConflicts(array( 'b' => new Link('A', 'B', $this->getVersionConstraint('>=', '1.0'), 'conflicts'), )); diff --git a/tests/Composer/Test/Downloader/PearPackageExtractorTest.php b/tests/Composer/Test/Downloader/PearPackageExtractorTest.php index fa393833d..c053976d7 100644 --- a/tests/Composer/Test/Downloader/PearPackageExtractorTest.php +++ b/tests/Composer/Test/Downloader/PearPackageExtractorTest.php @@ -25,19 +25,19 @@ class PearPackageExtractorTest extends \PHPUnit_Framework_TestCase $fileActions = $method->invoke($extractor, __DIR__ . '/Fixtures/Package_v1.0', array('php' => '/'), array()); $expectedFileActions = array( - 'Gtk.php' => Array( + 'Gtk.php' => array( 'from' => 'PEAR_Frontend_Gtk-0.4.0/Gtk.php', 'to' => 'PEAR/Frontend/Gtk.php', 'role' => 'php', 'tasks' => array(), ), - 'Gtk/Config.php' => Array( + 'Gtk/Config.php' => array( 'from' => 'PEAR_Frontend_Gtk-0.4.0/Gtk/Config.php', 'to' => 'PEAR/Frontend/Gtk/Config.php', 'role' => 'php', 'tasks' => array(), ), - 'Gtk/xpm/black_close_icon.xpm' => Array( + 'Gtk/xpm/black_close_icon.xpm' => array( 'from' => 'PEAR_Frontend_Gtk-0.4.0/Gtk/xpm/black_close_icon.xpm', 'to' => 'PEAR/Frontend/Gtk/xpm/black_close_icon.xpm', 'role' => 'php', @@ -56,7 +56,7 @@ class PearPackageExtractorTest extends \PHPUnit_Framework_TestCase $fileActions = $method->invoke($extractor, __DIR__ . '/Fixtures/Package_v2.0', array('php' => '/'), array()); $expectedFileActions = array( - 'URL.php' => Array( + 'URL.php' => array( 'from' => 'Net_URL-1.0.15/URL.php', 'to' => 'Net/URL.php', 'role' => 'php', @@ -75,13 +75,13 @@ class PearPackageExtractorTest extends \PHPUnit_Framework_TestCase $fileActions = $method->invoke($extractor, __DIR__ . '/Fixtures/Package_v2.1', array('php' => '/', 'script' => '/bin'), array()); $expectedFileActions = array( - 'php/Zend/Authentication/Storage/StorageInterface.php' => Array( + 'php/Zend/Authentication/Storage/StorageInterface.php' => array( 'from' => 'Zend_Authentication-2.0.0beta4/php/Zend/Authentication/Storage/StorageInterface.php', 'to' => '/php/Zend/Authentication/Storage/StorageInterface.php', 'role' => 'php', 'tasks' => array(), ), - 'php/Zend/Authentication/Result.php' => Array( + 'php/Zend/Authentication/Result.php' => array( 'from' => 'Zend_Authentication-2.0.0beta4/php/Zend/Authentication/Result.php', 'to' => '/php/Zend/Authentication/Result.php', 'role' => 'php', @@ -98,7 +98,7 @@ class PearPackageExtractorTest extends \PHPUnit_Framework_TestCase ) ) ), - 'renamedFile.php' => Array( + 'renamedFile.php' => array( 'from' => 'Zend_Authentication-2.0.0beta4/renamedFile.php', 'to' => 'correctFile.php', 'role' => 'php', diff --git a/tests/Composer/Test/Downloader/PerforceDownloaderTest.php b/tests/Composer/Test/Downloader/PerforceDownloaderTest.php index 9e26689a9..3e2bce2b4 100644 --- a/tests/Composer/Test/Downloader/PerforceDownloaderTest.php +++ b/tests/Composer/Test/Downloader/PerforceDownloaderTest.php @@ -22,7 +22,6 @@ use Composer\IO\IOInterface; */ class PerforceDownloaderTest extends \PHPUnit_Framework_TestCase { - protected $config; protected $downloader; protected $io; diff --git a/tests/Composer/Test/InstallerTest.php b/tests/Composer/Test/InstallerTest.php index cc12cb3ef..03cc10628 100644 --- a/tests/Composer/Test/InstallerTest.php +++ b/tests/Composer/Test/InstallerTest.php @@ -152,7 +152,7 @@ class InstallerTest extends TestCase $io->expects($this->any()) ->method('write') ->will($this->returnCallback(function ($text, $newline) use (&$output) { - $output .= $text . ($newline ? "\n":""); + $output .= $text . ($newline ? "\n" : ""); })); $composer = FactoryMock::create($io, $composerConfig); diff --git a/tests/Composer/Test/Json/JsonFileTest.php b/tests/Composer/Test/Json/JsonFileTest.php index cf89da35e..9036a23e8 100644 --- a/tests/Composer/Test/Json/JsonFileTest.php +++ b/tests/Composer/Test/Json/JsonFileTest.php @@ -226,5 +226,4 @@ class JsonFileTest extends \PHPUnit_Framework_TestCase $this->assertEquals($json, $file->encode($data, $options)); } } - } diff --git a/tests/Composer/Test/Json/JsonFormatterTest.php b/tests/Composer/Test/Json/JsonFormatterTest.php index eb6e87b00..557312fc3 100644 --- a/tests/Composer/Test/Json/JsonFormatterTest.php +++ b/tests/Composer/Test/Json/JsonFormatterTest.php @@ -46,5 +46,4 @@ class JsonFormatterTest extends \PHPUnit_Framework_TestCase return implode('+', $codes); } - } diff --git a/tests/Composer/Test/Mock/RemoteFilesystemMock.php b/tests/Composer/Test/Mock/RemoteFilesystemMock.php index caf1c5e65..79a25e550 100644 --- a/tests/Composer/Test/Mock/RemoteFilesystemMock.php +++ b/tests/Composer/Test/Mock/RemoteFilesystemMock.php @@ -36,5 +36,4 @@ class RemoteFilesystemMock extends RemoteFilesystem throw new TransportException('The "'.$fileUrl.'" file could not be downloaded (NOT FOUND)', 404); } - } diff --git a/tests/Composer/Test/Package/Archiver/ArchiveManagerTest.php b/tests/Composer/Test/Package/Archiver/ArchiveManagerTest.php index 5a9f8c2d8..aa98a62a2 100644 --- a/tests/Composer/Test/Package/Archiver/ArchiveManagerTest.php +++ b/tests/Composer/Test/Package/Archiver/ArchiveManagerTest.php @@ -13,7 +13,6 @@ namespace Composer\Test\Package\Archiver; use Composer\Factory; -use Composer\Package\Archiver; use Composer\Package\PackageInterface; class ArchiveManagerTest extends ArchiverTest diff --git a/tests/Composer/Test/Plugin/PluginInstallerTest.php b/tests/Composer/Test/Plugin/PluginInstallerTest.php index bd9e2b554..1799eb2b8 100644 --- a/tests/Composer/Test/Plugin/PluginInstallerTest.php +++ b/tests/Composer/Test/Plugin/PluginInstallerTest.php @@ -39,7 +39,7 @@ class PluginInstallerTest extends \PHPUnit_Framework_TestCase $this->directory = sys_get_temp_dir() . '/' . uniqid(); for ($i = 1; $i <= 4; $i++) { $filename = '/Fixtures/plugin-v'.$i.'/composer.json'; - mkdir(dirname($this->directory . $filename), 0777, TRUE); + mkdir(dirname($this->directory . $filename), 0777, true); $this->packages[] = $loader->load(__DIR__ . $filename); } diff --git a/tests/Composer/Test/Repository/ArtifactRepositoryTest.php b/tests/Composer/Test/Repository/ArtifactRepositoryTest.php index db7ca42ba..7d64a0141 100644 --- a/tests/Composer/Test/Repository/ArtifactRepositoryTest.php +++ b/tests/Composer/Test/Repository/ArtifactRepositoryTest.php @@ -16,7 +16,6 @@ use Composer\TestCase; use Composer\IO\NullIO; use Composer\Config; use Composer\Package\BasePackage; -use Composer\Util\Filesystem; class ArtifactRepositoryTest extends TestCase { @@ -67,7 +66,6 @@ class ArtifactRepositoryTest extends TestCase $this->assertTrue(strpos($package->getDistUrl(), $relativePath) === 0); } } - } //Files jsonInFirstLevel.zip, jsonInRoot.zip and jsonInSecondLevel.zip were generated with: diff --git a/tests/Composer/Test/Repository/Vcs/PerforceDriverTest.php b/tests/Composer/Test/Repository/Vcs/PerforceDriverTest.php index 09762f26e..59030f506 100644 --- a/tests/Composer/Test/Repository/Vcs/PerforceDriverTest.php +++ b/tests/Composer/Test/Repository/Vcs/PerforceDriverTest.php @@ -73,7 +73,7 @@ class PerforceDriverTest extends \PHPUnit_Framework_TestCase protected function getTestConfig($testPath) { $config = new Config(); - $config->merge(array('config'=>array('home'=>$testPath))); + $config->merge(array('config' => array('home' => $testPath))); return $config; } @@ -173,5 +173,4 @@ class PerforceDriverTest extends \PHPUnit_Framework_TestCase $this->perforce->expects($this->once())->method('cleanupClientSpec'); $this->driver->cleanup(); } - } diff --git a/tests/Composer/Test/Util/PerforceTest.php b/tests/Composer/Test/Util/PerforceTest.php index 91575b06d..dc727096d 100644 --- a/tests/Composer/Test/Util/PerforceTest.php +++ b/tests/Composer/Test/Util/PerforceTest.php @@ -718,5 +718,4 @@ class PerforceTest extends \PHPUnit_Framework_TestCase $this->perforce->cleanupClientSpec(); } - }