Security update for Core, with self-updated composer
[yaffs-website] / vendor / drupal / console / src / Command / Shared / EventsTrait.php
index 83cb54b4a3e5806bee7def21768a4842ac95dfa1..bb8ce10ea0db2c37762e37aee7f04d6d84a90239 100644 (file)
@@ -7,8 +7,6 @@
 
 namespace Drupal\Console\Command\Shared;
 
-use Drupal\Console\Core\Style\DrupalStyle;
-
 /**
  * Class EventsTrait
  *
@@ -17,31 +15,29 @@ use Drupal\Console\Core\Style\DrupalStyle;
 trait EventsTrait
 {
     /**
-     * @param DrupalStyle $io
-     *
      * @return mixed
      */
-    public function eventsQuestion(DrupalStyle $io)
+    public function eventsQuestion()
     {
         $eventCollection = [];
-        $io->info($this->trans('commands.common.questions.events.message'));
+        $this->getIo()->info($this->trans('commands.common.questions.events.message'));
 
         $events = $this->getEvents();
 
         while (true) {
-            $event = $io->choiceNoList(
+            $event = $this->getIo()->choiceNoList(
                 $this->trans('commands.common.questions.events.name'),
                 $events,
-                null,
+                '',
                 true
             );
 
-            if (empty($event)) {
+            if (empty($event) || is_numeric($event)) {
                 break;
             }
 
             $callbackSuggestion = str_replace('.', '_', $event);
-            $callback = $io->ask(
+            $callback = $this->getIo()->ask(
                 $this->trans('commands.generate.event.subscriber.questions.callback-name'),
                 $callbackSuggestion
             );