mirror of
https://github.com/composer/composer
synced 2025-05-11 09:32:55 +00:00
Validate autoload options are of a supported type
Checks to ensure that the autoload options are one of the three supported autoload types. closes #952
This commit is contained in:
parent
028d95db63
commit
ffd45b7678
2 changed files with 31 additions and 1 deletions
|
@ -179,7 +179,15 @@ class ValidatingArrayLoader implements LoaderInterface
|
|||
}
|
||||
}
|
||||
|
||||
// TODO validate autoload
|
||||
if ($this->validateArray('autoload') && !empty($this->config['autoload'])) {
|
||||
$types = array('psr-0', 'classmap', 'files');
|
||||
foreach ($this->config['autoload'] as $type => $typeConfig) {
|
||||
if (!in_array($type, $types)) {
|
||||
$this->errors[] = 'autoload : invalid value ('.$type.'), must be one of '.implode(', ', $types);
|
||||
unset($this->config['autoload'][$type]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// TODO validate dist
|
||||
// TODO validate source
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue