[BUGFIX] Fix the help message of CLI 06/31106/6
authorStefano Kowalke <blueduck@gmx.net>
Tue, 24 Jun 2014 11:26:41 +0000 (13:26 +0200)
committerHelmut Hummel <helmut.hummel@typo3.org>
Sat, 26 Jul 2014 21:42:05 +0000 (23:42 +0200)
The help command prints informations about a specific command.
This text is taken from the doc comment by reflection.

Currently the parser expects that type, variable name and comment
are separated by exactly one space, according to our CGL.

Relax the parsing to allow multiple whitespace characters (including tabs)
as separators when fetching the comment for an argument,
to support other coding styles.

Resolves: #59843
Releases: 6.3, 6.2
Change-Id: Id0a9c0ec00bf442adcbd428088744419200a69a0
Reviewed-on: http://review.typo3.org/31106
Reviewed-by: Helmut Hummel <helmut.hummel@typo3.org>
Tested-by: Helmut Hummel <helmut.hummel@typo3.org>
typo3/sysext/extbase/Classes/Mvc/Cli/Command.php

index 41aae27..0b83e53 100644 (file)
@@ -174,10 +174,8 @@ class Command {
                $commandParameters = $this->reflectionService->getMethodParameters($this->controllerClassName, $this->controllerCommandName . 'Command');
                $i = 0;
                foreach ($commandParameters as $commandParameterName => $commandParameterDefinition) {
-                       $explodedAnnotation = explode(' ', $annotations['param'][$i]);
-                       array_shift($explodedAnnotation);
-                       array_shift($explodedAnnotation);
-                       $description = ltrim(implode(' ', $explodedAnnotation));
+                       $explodedAnnotation = preg_split('/\s+/', $annotations['param'][$i], 3);
+                       $description = !empty($explodedAnnotation[2]) ? $explodedAnnotation[2] : '';
                        $required = $commandParameterDefinition['optional'] !== TRUE;
                        $commandArgumentDefinitions[] = $this->objectManager->get('TYPO3\\CMS\\Extbase\\Mvc\\Cli\\CommandArgumentDefinition', $commandParameterName, $required, $description);
                        $i++;