Fix compatibility issue with phpstan 2.0 parser

The phpstan 2.0 release contains a fix which resolves the existing bug
in the old parser that didn't take the whole description when it was
multiline. Now the workaround is disabled when using phpstan parser v2

Fixes #393
This commit is contained in:
Jaapio
2024-12-07 10:35:23 +01:00
parent f3558a4c23
commit d46c3297fb
2 changed files with 25 additions and 5 deletions
@@ -75,11 +75,13 @@ class AbstractPHPStanFactory implements Factory
{
$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) {