Skip to content

Commit 8d3e90f

Browse files
committed
PhpDocParser - always require whitespace before description
1 parent a165178 commit 8d3e90f

File tree

4 files changed

+9
-116
lines changed

4 files changed

+9
-116
lines changed

src/Parser/PhpDocParser.php

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -38,9 +38,6 @@ class PhpDocParser
3838
/** @var ConstExprParser */
3939
private $doctrineConstantExprParser;
4040

41-
/** @var bool */
42-
private $requireWhitespaceBeforeDescription;
43-
4441
/** @var bool */
4542
private $preserveTypeAliasesWithInvalidTypes;
4643

@@ -59,7 +56,6 @@ class PhpDocParser
5956
public function __construct(
6057
TypeParser $typeParser,
6158
ConstExprParser $constantExprParser,
62-
bool $requireWhitespaceBeforeDescription = false,
6359
bool $preserveTypeAliasesWithInvalidTypes = false,
6460
array $usedAttributes = [],
6561
bool $textBetweenTagsBelongsToDescription = false
@@ -68,7 +64,6 @@ public function __construct(
6864
$this->typeParser = $typeParser;
6965
$this->constantExprParser = $constantExprParser;
7066
$this->doctrineConstantExprParser = $constantExprParser->toDoctrine();
71-
$this->requireWhitespaceBeforeDescription = $requireWhitespaceBeforeDescription;
7267
$this->preserveTypeAliasesWithInvalidTypes = $preserveTypeAliasesWithInvalidTypes;
7368
$this->useLinesAttributes = $usedAttributes['lines'] ?? false;
7469
$this->useIndexAttributes = $usedAttributes['indexes'] ?? false;
@@ -1255,8 +1250,7 @@ private function parseOptionalDescription(TokenIterator $tokens, bool $limitStar
12551250
}
12561251

12571252
if (
1258-
$this->requireWhitespaceBeforeDescription
1259-
&& !$tokens->isCurrentTokenType(Lexer::TOKEN_PHPDOC_EOL, Lexer::TOKEN_CLOSE_PHPDOC, Lexer::TOKEN_END)
1253+
!$tokens->isCurrentTokenType(Lexer::TOKEN_PHPDOC_EOL, Lexer::TOKEN_CLOSE_PHPDOC, Lexer::TOKEN_END)
12601254
&& !$tokens->isPrecededByHorizontalWhitespace()
12611255
) {
12621256
$tokens->consumeTokenType(Lexer::TOKEN_HORIZONTAL_WS); // will throw exception

0 commit comments

Comments
 (0)