1
0
Fork 0
mirror of https://github.com/composer/composer synced 2025-05-09 16:42:57 +00:00

Removed a PHP notice when dumping the autoloader

This occured when the root package has a target-dir but does not have
configure a PSR-0 autoloader.
Fixes #1028
This commit is contained in:
Christophe Coevoet 2012-08-24 23:11:16 +02:00
parent 01593e0628
commit 66b83a39d2
2 changed files with 23 additions and 1 deletions

View file

@ -85,7 +85,7 @@ EOF;
// add custom psr-0 autoloading if the root package has a target dir
$targetDirLoader = null;
$mainAutoload = $mainPackage->getAutoload();
if ($mainPackage->getTargetDir() && $mainAutoload['psr-0']) {
if ($mainPackage->getTargetDir() && !empty($mainAutoload['psr-0'])) {
$levels = count(explode('/', trim(strtr($mainPackage->getTargetDir(), '\\', '/'), '/')));
$prefixes = implode(', ', array_map(function ($prefix) {
return var_export($prefix, true);