From 8ffe3c2e2638ea8ea3b1d2f06e9769ed8c9eb4bd Mon Sep 17 00:00:00 2001 From: Jordi Boggiano Date: Sun, 27 May 2012 23:21:10 +0200 Subject: [PATCH] Cosmetic fixes --- CHANGELOG.md | 2 +- src/Composer/Command/RequireCommand.php | 2 +- src/Composer/Installer.php | 2 +- src/Composer/Json/JsonManipulator.php | 5 +++-- 4 files changed, 6 insertions(+), 5 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index e7c61d32e..793d311d6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,7 +2,7 @@ * Schema: Added references for dev versions, requiring `dev-master#abcdef` for example will force the abcdef commit * Added `require` command to add a package to your requirements and install it - * Added a whitelist to `update. Calling `composer update foo/bar foo/baz` allows you to update only those packages + * Added a whitelist to `update`. Calling `composer update foo/bar foo/baz` allows you to update only those packages * Added caching of GitHub metadata (faster startup time with custom GitHub VCS repos) * Added support for file:// URLs to GitDriver * Added --dev flag to `create-project` command diff --git a/src/Composer/Command/RequireCommand.php b/src/Composer/Command/RequireCommand.php index 92d21fef2..78d7f326f 100644 --- a/src/Composer/Command/RequireCommand.php +++ b/src/Composer/Command/RequireCommand.php @@ -70,7 +70,7 @@ EOT $requireKey = $input->getOption('dev') ? 'require-dev' : 'require'; $baseRequirements = array_key_exists($requireKey, $composer) ? $composer[$requireKey] : array(); - $requirements = $this->formatRequirements($requirements); + $requirements = $this->formatRequirements($requirements); if (!$this->updateFileCleanly($json, $baseRequirements, $requirements, $requireKey)) { foreach ($requirements as $package => $version) { diff --git a/src/Composer/Installer.php b/src/Composer/Installer.php index 77542284e..97a1bcbc6 100644 --- a/src/Composer/Installer.php +++ b/src/Composer/Installer.php @@ -337,7 +337,7 @@ class Installer } else { // force update to latest on update if ($this->update) { - // skip package is the whitelist is enabled and it is not in it + // skip package if the whitelist is enabled and it is not in it if ($this->updateWhitelist && !in_array($package->getName(), $this->updateWhitelist)) { continue; } diff --git a/src/Composer/Json/JsonManipulator.php b/src/Composer/Json/JsonManipulator.php index f070fe792..59413aaac 100644 --- a/src/Composer/Json/JsonManipulator.php +++ b/src/Composer/Json/JsonManipulator.php @@ -23,11 +23,12 @@ class JsonManipulator public function __construct($contents) { - if (!preg_match('#^\{(.*)\}$#s', trim($contents), $match)) { + $contents = trim($contents); + if (!preg_match('#^\{(.*)\}$#s', $contents)) { throw new \InvalidArgumentException('The json file must be an object ({})'); } $this->newline = false !== strpos("\r\n", $contents) ? "\r\n": "\n"; - $this->contents = '{' . $match[1] . '}'; + $this->contents = $contents; $this->detectIndenting(); }