pull/11895/head
parent
8a69c0555b
commit
0f70c0a9c9
|
@ -17,6 +17,8 @@ use Composer\Pcre\Preg;
|
|||
use Composer\Semver\Constraint\Constraint;
|
||||
use Composer\Package\Version\VersionParser;
|
||||
use Composer\Repository\PlatformRepository;
|
||||
use Composer\Semver\Constraint\MatchNoneConstraint;
|
||||
use Composer\Semver\Intervals;
|
||||
use Composer\Spdx\SpdxLicenses;
|
||||
|
||||
/**
|
||||
|
@ -290,6 +292,11 @@ class ValidatingArrayLoader implements LoaderInterface
|
|||
) {
|
||||
$this->warnings[] = $linkType.'.'.$package.' : exact version constraints ('.$constraint.') should be avoided if the package follows semantic versioning';
|
||||
}
|
||||
|
||||
$compacted = Intervals::compactConstraint($linkConstraint);
|
||||
if ($compacted instanceof MatchNoneConstraint) {
|
||||
$this->warnings[] = $linkType.'.'.$package.' : this version constraint cannot possibly match anything ('.$constraint.')';
|
||||
}
|
||||
}
|
||||
|
||||
if ($linkType === 'conflict' && isset($this->config['replace']) && $keys = array_intersect_key($this->config['replace'], $this->config['conflict'])) {
|
||||
|
|
|
@ -480,6 +480,20 @@ class ValidatingArrayLoaderTest extends TestCase
|
|||
],
|
||||
false,
|
||||
],
|
||||
[
|
||||
[
|
||||
'name' => 'foo/bar',
|
||||
'require' => [
|
||||
'foo/baz' => '>1, <0.5',
|
||||
'bar/baz' => 'dev-main, >0.5',
|
||||
],
|
||||
],
|
||||
[
|
||||
'require.foo/baz : this version constraint cannot possibly match anything (>1, <0.5)',
|
||||
'require.bar/baz : this version constraint cannot possibly match anything (dev-main, >0.5)',
|
||||
],
|
||||
false,
|
||||
],
|
||||
[
|
||||
[
|
||||
'name' => 'foo/bar',
|
||||
|
|
Loading…
Reference in New Issue