浏览代码

Fix: Do not issue warning when using exact version constraint for unstable package

Andreas Möller 9 年之前
父节点
当前提交
bb0fb0eb26
共有 1 个文件被更改,包括 2 次插入0 次删除
  1. 2 0
      src/Composer/Package/Loader/ValidatingArrayLoader.php

+ 2 - 0
src/Composer/Package/Loader/ValidatingArrayLoader.php

@@ -151,6 +151,7 @@ class ValidatingArrayLoader implements LoaderInterface
         }
 
         $unboundConstraint = new Constraint('=', $this->versionParser->normalize('dev-master'));
+        $stableConstraint = new Constraint('=', '1.0.0');
 
         foreach (array_keys(BasePackage::$supportedLinkTypes) as $linkType) {
             if ($this->validateArray($linkType) && isset($this->config[$linkType])) {
@@ -183,6 +184,7 @@ class ValidatingArrayLoader implements LoaderInterface
                             ($this->flags & self::CHECK_STRICT_CONSTRAINTS)
                             && 'require' === $linkType
                             && substr($linkConstraint, 0, 1) === '='
+                            && $stableConstraint->versionCompare($stableConstraint, $linkConstraint, '<=')
                         ) {
                             $this->warnings[] = $linkType.'.'.$package.' : exact version constraints ('.$constraint.') should be avoided if the package follows semantic versioning';
                         }