1010namespace Drush \Psysh ;
1111
1212use Consolidation \AnnotatedCommand \AnnotatedCommand ;
13+ use Symfony \Component \Console \Command \Command ;
1314use Psy \Command \Command as BaseCommand ;
1415use Symfony \Component \Console \Formatter \OutputFormatter ;
1516use Symfony \Component \Console \Input \InputInterface ;
@@ -22,17 +23,17 @@ class DrushCommand extends BaseCommand
2223{
2324
2425 /**
25- * @var \Consolidation\AnnotatedCommand\AnnotatedCommand
26+ * @var \Symfony\Component\Console\Command\Command
2627 */
2728 private $ command ;
2829
2930 /**
3031 * DrushCommand constructor.
3132 *
32- * @param \Consolidation\AnnotatedCommand\AnnotatedCommand $command
33- * Original (annotated) Drush command.
33+ * @param \Symfony\Component\Console\Command\Command $command
34+ * Original Drush command.
3435 */
35- public function __construct (AnnotatedCommand $ command )
36+ public function __construct (Command $ command )
3637 {
3738 $ this ->command = $ command ;
3839 parent ::__construct ();
@@ -110,14 +111,17 @@ protected function buildHelpFromCommand()
110111 $ help = wordwrap ($ this ->command ->getDescription ());
111112
112113 $ examples = [];
113- foreach ($ this ->command ->getExampleUsages () as $ ex => $ def ) {
114- // Skip empty examples and things with obvious pipes...
115- if (($ ex === '' ) || (strpos ($ ex , '| ' ) !== false )) {
116- continue ;
117- }
118114
119- $ ex = preg_replace ('/^drush\s+/ ' , '' , $ ex );
120- $ examples [$ ex ] = $ def ;
115+ if ($ this ->command instanceof AnnotatedCommand) {
116+ foreach ($ this ->command ->getExampleUsages () as $ ex => $ def ) {
117+ // Skip empty examples and things with obvious pipes...
118+ if (($ ex === '' ) || (strpos ($ ex , '| ' ) !== false )) {
119+ continue ;
120+ }
121+
122+ $ ex = preg_replace ('/^drush\s+/ ' , '' , $ ex );
123+ $ examples [$ ex ] = $ def ;
124+ }
121125 }
122126
123127 if (!empty ($ examples )) {
0 commit comments