Add psr-4 stuff in a few more places.
parent
b62fa2bc1c
commit
39c09d5192
|
@ -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
|
||||
|
|
|
@ -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."
|
||||
|
|
|
@ -310,6 +310,12 @@ EOF;
|
|||
}
|
||||
}
|
||||
|
||||
if (isset($autoloads['psr-4'])) {
|
||||
foreach ($autoloads['psr-4'] as $namespace => $path) {
|
||||
$loader->addPsr4($namespace, $path);
|
||||
}
|
||||
}
|
||||
|
||||
return $loader;
|
||||
}
|
||||
|
||||
|
|
|
@ -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));
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
|
|
Loading…
Reference in New Issue