Skip to content
Snippets Groups Projects
Commit ab9bb259 authored by Helmut Hummel's avatar Helmut Hummel Committed by Jigal van Hemert
Browse files

[BUGFIX] Strip trailing slash from parsed doc comment

If methods do not end with tag values (arguments or return statement)
the doc comment parser returned a slash as last line,
which is now stripped off.

Resolves: #76815
Releases: master, 7.6
Change-Id: I15d52104c190fbbf1e4ee5146595810f961ca3c7
Reviewed-on: https://review.typo3.org/48700


Reviewed-by: default avatarMarkus Klein <markus.klein@typo3.org>
Tested-by: default avatarMarkus Klein <markus.klein@typo3.org>
Tested-by: default avatarBamboo TYPO3com <info@typo3.com>
Reviewed-by: default avatarJigal van Hemert <jigal.van.hemert@typo3.org>
Tested-by: default avatarJigal van Hemert <jigal.van.hemert@typo3.org>
parent 4e4caae8
Branches
Tags
No related merge requests found
......@@ -46,7 +46,7 @@ class DocCommentParser
if ($line !== '' && strpos($line, '@') !== false) {
$this->parseTag(substr($line, strpos($line, '@')));
} elseif (empty($this->tags)) {
$this->description .= preg_replace('/\\s*\\/?[\\\\*]*(.*)$/', '$1', $line) . LF;
$this->description .= preg_replace('#\\s*/?[*/]*(.*)$#', '$1', $line) . LF;
}
}
$this->description = trim($this->description);
......
<?php
namespace TYPO3\CMS\Extbase\Tests\Unit\Reflection;
/*
* This file is part of the TYPO3 CMS project.
*
* It is free software; you can redistribute it and/or modify it under
* the terms of the GNU General Public License, either version 2
* of the License, or any later version.
*
* For the full copyright and license information, please read the
* LICENSE.txt file that was distributed with this source code.
*
* The TYPO3 project - inspiring people to share!
*/
use TYPO3\CMS\Extbase\Reflection\DocCommentParser;
/**
* Test case
*/
class DocCommentParserTest extends \TYPO3\CMS\Core\Tests\UnitTestCase
{
/**
* @test
*/
public function stripsSlashFromMethodComment()
{
$commentParser = new DocCommentParser();
$comment = '/**
* Here is some text, but neither an argument nor a return type.
*/
';
$commentParser->parseDocComment($comment);
$this->assertSame(
'Here is some text, but neither an argument nor a return type.',
$commentParser->getDescription()
);
}
}
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment