Skip to content

Commit da4dac8

Browse files
authored
[help] Validate examples at TextDescriptor class. (#328)
1 parent 1e6afe1 commit da4dac8

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

src/Descriptor/TextDescriptor.php

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -157,12 +157,14 @@ protected function describeCommand(Command $command, array $options = [])
157157
(strpos($command->getName(), ':')?:0)
158158
);
159159
$commandData = $command->getApplication()->getData();
160-
$commands = $commandData['commands'][$namespace];
161160
$examples = [];
162-
foreach ($commands as $item) {
163-
if ($item['name'] == $command->getName()) {
164-
$examples = $item['examples'];
165-
break;
161+
if (array_key_exists($namespace, $commandData['commands'])) {
162+
$commands = $commandData['commands'][$namespace];
163+
foreach ($commands as $item) {
164+
if ($item['name'] == $command->getName()) {
165+
$examples = $item['examples'];
166+
break;
167+
}
166168
}
167169
}
168170

0 commit comments

Comments
 (0)