1
0
Fork 0

Validate constraints in require command, fixes #2197

pull/2209/head
Jordi Boggiano 2013-08-26 13:29:47 +02:00
parent c2dc433fa4
commit 51ea1f03f9
1 changed files with 7 additions and 0 deletions

View File

@ -20,6 +20,7 @@ use Composer\Factory;
use Composer\Installer;
use Composer\Json\JsonFile;
use Composer\Json\JsonManipulator;
use Composer\Package\Version\VersionParser;
/**
* @author Jérémy Romey <jeremy@free-agent.fr>
@ -80,6 +81,12 @@ EOT
$baseRequirements = array_key_exists($requireKey, $composer) ? $composer[$requireKey] : array();
$requirements = $this->formatRequirements($requirements);
// validate requirements format
$versionParser = new VersionParser();
foreach ($requirements as $constraint) {
$versionParser->parseConstraints($constraint);
}
if (!$this->updateFileCleanly($json, $baseRequirements, $requirements, $requireKey)) {
foreach ($requirements as $package => $version) {
$baseRequirements[$package] = $version;