From da4dac86ae46978741280284d96753686f794d86 Mon Sep 17 00:00:00 2001 From: Jesus Manuel Olivas Date: Tue, 6 Mar 2018 10:48:48 -0800 Subject: [PATCH] [help] Validate examples at TextDescriptor class. (#328) --- src/Descriptor/TextDescriptor.php | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/src/Descriptor/TextDescriptor.php b/src/Descriptor/TextDescriptor.php index 8018d9e..54f9808 100644 --- a/src/Descriptor/TextDescriptor.php +++ b/src/Descriptor/TextDescriptor.php @@ -157,12 +157,14 @@ protected function describeCommand(Command $command, array $options = []) (strpos($command->getName(), ':')?:0) ); $commandData = $command->getApplication()->getData(); - $commands = $commandData['commands'][$namespace]; $examples = []; - foreach ($commands as $item) { - if ($item['name'] == $command->getName()) { - $examples = $item['examples']; - break; + if (array_key_exists($namespace, $commandData['commands'])) { + $commands = $commandData['commands'][$namespace]; + foreach ($commands as $item) { + if ($item['name'] == $command->getName()) { + $examples = $item['examples']; + break; + } } }