1
0
Fork 0

Report validation error if a package replaces and conflicts against the same name, fixes #9845

pull/10308/head
Jordi Boggiano 2021-11-25 10:21:30 +01:00
parent c15eba3fe3
commit deaec7c0ac
No known key found for this signature in database
GPG Key ID: 7BBD42C429EC80BC
1 changed files with 5 additions and 0 deletions

View File

@ -281,6 +281,11 @@ class ValidatingArrayLoader implements LoaderInterface
$this->warnings[] = $linkType.'.'.$package.' : exact version constraints ('.$constraint.') should be avoided if the package follows semantic versioning';
}
}
if ($linkType === 'conflict' && isset($this->config['replace']) && $keys = array_intersect_key($this->config['replace'], $this->config['conflict'])) {
$this->errors[] = $linkType.'.'.$package.' : you cannot conflict with a package that is also replaced, as replace already creates an implicit conflict rule';
unset($this->config[$linkType][$package]);
}
}
}
}