Validation to make the combination of target-dir with psr-4 illegal.
parent
39c09d5192
commit
c0aad84d8b
|
@ -259,6 +259,7 @@ EOF;
|
||||||
if ($package instanceof AliasPackage) {
|
if ($package instanceof AliasPackage) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
$this->validatePackage($package);
|
||||||
|
|
||||||
$packageMap[] = array(
|
$packageMap[] = array(
|
||||||
$package,
|
$package,
|
||||||
|
@ -269,6 +270,21 @@ EOF;
|
||||||
return $packageMap;
|
return $packageMap;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param PackageInterface $package
|
||||||
|
*
|
||||||
|
* @throws \Exception
|
||||||
|
* Throws an exception, if the package has illegal settings.
|
||||||
|
*/
|
||||||
|
protected function validatePackage(PackageInterface $package) {
|
||||||
|
$autoload = $package->getAutoload();
|
||||||
|
if (!empty($autoload['psr-4']) && null !== $package->getTargetDir()) {
|
||||||
|
$name = $package->getName();
|
||||||
|
$package->getTargetDir();
|
||||||
|
throw new \Exception("The ['autoload']['psr-4'] setting is incompatible with the ['target-dir'] setting, in package '$name'.");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Compiles an ordered list of namespace => path mappings
|
* Compiles an ordered list of namespace => path mappings
|
||||||
*
|
*
|
||||||
|
|
|
@ -189,6 +189,13 @@ class ValidatingArrayLoader implements LoaderInterface
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!empty($this->config['autoload']['psr-4']) && !empty($this->config['target-dir'])) {
|
||||||
|
$this->errors[] = "The ['autoload']['psr-4'] setting is incompatible with the ['target-dir'] setting.";
|
||||||
|
// Unset the psr-4 setting, since unsetting target-dir might
|
||||||
|
// interfere with other settings.
|
||||||
|
unset($this->config['autoload']['psr-4']);
|
||||||
|
}
|
||||||
|
|
||||||
// TODO validate dist
|
// TODO validate dist
|
||||||
// TODO validate source
|
// TODO validate source
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue