1
0
Fork 0

Add psr-4 stuff in a few more places.

pull/2459/head
Andreas Hennings 2013-12-14 16:28:27 +01:00
parent b62fa2bc1c
commit 39c09d5192
5 changed files with 20 additions and 1 deletions

View File

@ -438,6 +438,10 @@ use an empty prefix like:
}
}
#### PSR-4
Stub: Similar to PSR-0.
#### Classmap
The `classmap` references are all combined, during install/update, into a single

View File

@ -203,6 +203,11 @@
"description": "This is a hash of namespaces (keys) and the directories they can be found into (values, can be arrays of paths) by the autoloader.",
"additionalProperties": true
},
"psr-4": {
"type": "object",
"description": "This is a hash of namespaces (keys) and the PSR-4 directories they can be found into (values, can be arrays of paths) by the autoloader.",
"additionalProperties": true
},
"classmap": {
"type": "array",
"description": "This is an array of directories that contain classes to be included in the class-map generation process."

View File

@ -310,6 +310,12 @@ EOF;
}
}
if (isset($autoloads['psr-4'])) {
foreach ($autoloads['psr-4'] as $namespace => $path) {
$loader->addPsr4($namespace, $path);
}
}
return $loader;
}

View File

@ -303,6 +303,10 @@ EOT
foreach ($autoloads as $name => $path) {
$output->writeln(($name ?: '*') . ' => ' . (is_array($path) ? implode(', ', $path) : ($path ?: '.')));
}
} elseif ($type === 'psr-4') {
foreach ($autoloads as $name => $path) {
$output->writeln(($name ?: '*') . ' => ' . (is_array($path) ? implode(', ', $path) : ($path ?: '.')));
}
} elseif ($type === 'classmap') {
$output->writeln(implode(', ', $autoloads));
}

View File

@ -180,7 +180,7 @@ class ValidatingArrayLoader implements LoaderInterface
}
if ($this->validateArray('autoload') && !empty($this->config['autoload'])) {
$types = array('psr-0', 'classmap', 'files');
$types = array('psr-0', 'psr-4', '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);