Security update for Core, with self-updated composer
[yaffs-website] / vendor / consolidation / annotated-command / tests / src / alpha / AlphaCommandFile.php
index b5d06eca63717d4f0b3b4cf85e109472a16e240b..651b8533d02afe1633cd1f80dbb36410f6de37cd 100644 (file)
@@ -9,6 +9,9 @@ use Symfony\Component\Console\Input\InputOption;
 use Consolidation\AnnotatedCommand\CommandData;
 use Consolidation\AnnotatedCommand\Events\CustomEventAwareInterface;
 use Consolidation\AnnotatedCommand\Events\CustomEventAwareTrait;
+use Symfony\Component\Console\Command\Command;
+
+use Consolidation\TestUtils\ExampleCommandFile as ExampleAliasedClass;
 
 /**
  * Test file used in the testCommandDiscovery() test.
@@ -29,6 +32,11 @@ class AlphaCommandFile implements CustomEventAwareInterface
         return new CommandError('This command always fails.', 13);
     }
 
+    public static function ignoredStaticMethod()
+    {
+        return 'This method is static; it should not generate a command.';
+    }
+
     /**
      * @command simulated:status
      */
@@ -89,7 +97,7 @@ class AlphaCommandFile implements CustomEventAwareInterface
      *   Note that either the field ID or the visible field label may be used.
      * @aliases extab
      * @topics docs-tables
-     * @return \Consolidation\OutputFormatters\StructuredData\RowsOfFields
+     * @return \Consolidation\OutputFormatters\StructuredData\RowsOfFields Fully-qualified class name
      */
     public function exampleTable($unused = '', $options = ['format' => 'table', 'fields' => ''])
     {
@@ -102,6 +110,36 @@ class AlphaCommandFile implements CustomEventAwareInterface
         return new RowsOfFields($outputData);
     }
 
+    /**
+     * Test command with formatters using a short classname in @return
+     *
+     * @command example:table2
+     * @param $unused An unused argument
+     * @field-labels
+     *   first: I
+     *   second: II
+     *   third: III
+     * @usage example:table --format=yml
+     *   Show the example table in yml format.
+     * @usage example:table --fields=first,third
+     *   Show only the first and third fields in the table.
+     * @usage example:table --fields=II,III
+     *   Note that either the field ID or the visible field label may be used.
+     * @aliases extab
+     * @topics docs-tables
+     * @return RowsOfFields Short class names are converted to fqcns
+     */
+    public function exampleTableTwo($unused = '', $options = ['format' => 'table', 'fields' => ''])
+    {
+        $outputData = [
+            [ 'first' => 'One',  'second' => 'Two',  'third' => 'Three' ],
+            [ 'first' => 'Eins', 'second' => 'Zwei', 'third' => 'Drei'  ],
+            [ 'first' => 'Ichi', 'second' => 'Ni',   'third' => 'San'   ],
+            [ 'first' => 'Uno',  'second' => 'Dos',  'third' => 'Tres'  ],
+        ];
+        return new RowsOfFields($outputData);
+    }
+
     /**
      * Test word wrapping
      *
@@ -126,7 +164,7 @@ class AlphaCommandFile implements CustomEventAwareInterface
     /**
      * @hook option example:table
      */
-    public function additionalOptionForExampleTable($command, $annotationData)
+    public function additionalOptionForExampleTable(Command $command, AnnotationData $annotationData)
     {
         $command->addOption(
             'dynamic',