mirror of
https://github.com/guzzle/guzzle.git
synced 2025-02-25 10:33:18 +01:00
[Service] Fixing the resolution of extended parameters when using multiple inheritance
This commit is contained in:
parent
8c6bc88bc8
commit
64758d8041
@ -36,15 +36,20 @@ class ArrayDescriptionBuilder implements DescriptionBuilderInterface
|
|||||||
$name = $command['name'] = isset($command['name']) ? $command['name'] : $name;
|
$name = $command['name'] = isset($command['name']) ? $command['name'] : $name;
|
||||||
// Extend other commands
|
// Extend other commands
|
||||||
if (!empty($command['extends'])) {
|
if (!empty($command['extends'])) {
|
||||||
|
|
||||||
|
$originalParams = empty($command['params']) ? false: $command['params'];
|
||||||
|
$resolvedParams = array();
|
||||||
|
|
||||||
foreach ((array) $command['extends'] as $extendedCommand) {
|
foreach ((array) $command['extends'] as $extendedCommand) {
|
||||||
if (empty($commands[$extendedCommand])) {
|
if (empty($commands[$extendedCommand])) {
|
||||||
throw new DescriptionBuilderException("{$name} extends missing command {$extendedCommand}");
|
throw new DescriptionBuilderException("{$name} extends missing command {$extendedCommand}");
|
||||||
}
|
}
|
||||||
$toArray = $commands[$extendedCommand]->toArray();
|
$toArray = $commands[$extendedCommand]->toArray();
|
||||||
$params = empty($command['params']) ? $toArray['params'] : array_merge($command['params'], $toArray['params']);
|
$resolvedParams = empty($resolvedParams) ? $toArray['params'] : array_merge($resolvedParams, $toArray['params']);
|
||||||
$command = array_merge($toArray, $command);
|
$command = array_merge($toArray, $command);
|
||||||
$command['params'] = $params;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$command['params'] = $originalParams ? array_merge($resolvedParams, $originalParams) : $resolvedParams;
|
||||||
}
|
}
|
||||||
// Use the default class
|
// Use the default class
|
||||||
$command['class'] = isset($command['class']) ? str_replace('.', '\\', $command['class']) : ServiceDescription::DEFAULT_COMMAND_CLASS;
|
$command['class'] = isset($command['class']) ? str_replace('.', '\\', $command['class']) : ServiceDescription::DEFAULT_COMMAND_CLASS;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user