mirror of
https://github.com/composer/composer
synced 2025-05-09 00:22:53 +00:00
Merge pull request #4529 from jeroenseegers/warn-on-commit-reference
Generate a warning when a commit reference is used
This commit is contained in:
commit
c7ed232ef4
3 changed files with 55 additions and 0 deletions
|
@ -124,6 +124,19 @@ class ConfigValidator
|
|||
}
|
||||
}
|
||||
|
||||
// check for commit references
|
||||
$require = isset($manifest['require']) ? $manifest['require'] : array();
|
||||
$requireDev = isset($manifest['require-dev']) ? $manifest['require-dev'] : array();
|
||||
$packages = array_merge($require, $requireDev);
|
||||
foreach ($packages as $package => $version) {
|
||||
if (preg_match('/#/', $version) === 1) {
|
||||
$warnings[] = sprintf(
|
||||
'The package "%s" is pointing to a commit-ref, this is bad practice and can cause unforeseen issues.',
|
||||
$package
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
// check for empty psr-0/psr-4 namespace prefixes
|
||||
if (isset($manifest['autoload']['psr-0'][''])) {
|
||||
$warnings[] = "Defining autoload.psr-0 with an empty namespace prefix is a bad idea for performance";
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue