Browse Source

#13313 Completion command should ignore methods from core Shell

Marcelo Rocha 6 years ago
parent
commit
493dd54e1e
1 changed files with 4 additions and 1 deletions
  1. 4 1
      src/Command/CompletionCommand.php

+ 4 - 1
src/Command/CompletionCommand.php

@@ -201,9 +201,12 @@ class CompletionCommand extends Command implements CommandCollectionAwareInterfa
         // If there are no formal subcommands all methods
         // on a shell are 'subcommands'
         if (count($subcommands) === 0) {
+            $coreShellReflection = new ReflectionClass(Shell::class);
             $reflection = new ReflectionClass($shell);
             foreach ($reflection->getMethods(ReflectionMethod::IS_PUBLIC) as $method) {
-                if ($shell->hasMethod($method->getName())) {
+                if ($shell->hasMethod($method->getName())
+                    && !$coreShellReflection->hasMethod($method->getName())
+                ) {
                     $output[] = $method->getName();
                 }
             }