diff --git a/src/DocBlock/Tags/Factory/AbstractPHPStanFactory.php b/src/DocBlock/Tags/Factory/AbstractPHPStanFactory.php index 872a266f..e5b4e413 100644 --- a/src/DocBlock/Tags/Factory/AbstractPHPStanFactory.php +++ b/src/DocBlock/Tags/Factory/AbstractPHPStanFactory.php @@ -75,11 +75,13 @@ public function create(string $tagLine, ?TypeContext $context = null): Tag { $tokens = $this->tokenizeLine($tagLine); $ast = $this->parser->parseTag($tokens); - if (property_exists($ast->value, 'description') === true) { - $ast->value->setAttribute( - 'description', - $ast->value->description . $tokens->joinUntil(Lexer::TOKEN_END) - ); + if (class_exists(ParserConfig::class) === false) { + if (property_exists($ast->value, 'description') === true) { + $ast->value->setAttribute( + 'description', + $ast->value->description . $tokens->joinUntil(Lexer::TOKEN_END) + ); + } } if ($context === null) { diff --git a/tests/integration/InterpretingDocBlocksTest.php b/tests/integration/InterpretingDocBlocksTest.php index 5c240768..95c44c93 100644 --- a/tests/integration/InterpretingDocBlocksTest.php +++ b/tests/integration/InterpretingDocBlocksTest.php @@ -463,4 +463,22 @@ public function testProcessTemplateTag(): void $docblock->getTags() ); } + + public function testParamTagDescriptionIsCorrectly(): void + { + $docComment = ' + /** + * @param int $baz Lorem ipsum dolor sit amet, consectetur adipiscing elit. Maecenas varius, tellus in cursus + * dictum, justo odio sagittis velit, id iaculis mi dui id nisi. + */ +'; + + $factory = DocBlockFactory::createInstance(); + $docblock = $factory->create($docComment); + + $paramTags = $docblock->getTagsWithTypeByName('param')[0]; + + self::assertSame('Lorem ipsum dolor sit amet, consectetur adipiscing elit. Maecenas varius, tellus in cursus +dictum, justo odio sagittis velit, id iaculis mi dui id nisi.', (string) $paramTags->getDescription()); + } }