Skip to content

Commit

Permalink
Bump to phpdoc-parser 1.23 and fill construct() attributes (#4590)
Browse files Browse the repository at this point in the history
* Bump to phpdoc-parser 1.23 and fill construct() attributes

* update fixture drupal

* update TypeParser and ConstExprParser usedAttributes

* rename fixture

* Revert "rename fixture"

This reverts commit 46dcd82.

* Revert "update fixture drupal"

This reverts commit d401cc6.

* set to false
  • Loading branch information
samsonasik committed Jul 24, 2023
1 parent 6658a0e commit fcc32e5
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 4 deletions.
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
"nette/utils": "^3.2",
"nikic/php-parser": "^4.16.0",
"ondram/ci-detector": "^4.1",
"phpstan/phpdoc-parser": "^1.21.3",
"phpstan/phpdoc-parser": "^1.23",
"phpstan/phpstan": "^1.10.26",
"react/event-loop": "^1.3",
"react/socket": "^1.12",
Expand Down
6 changes: 4 additions & 2 deletions config/config.php
Original file line number Diff line number Diff line change
Expand Up @@ -262,8 +262,10 @@
$services->alias(PhpDocParser::class, BetterPhpDocParser::class);

$services->set(\PHPStan\PhpDocParser\Lexer\Lexer::class);
$services->set(TypeParser::class);
$services->set(ConstExprParser::class);
$services->set(TypeParser::class)
->arg('$usedAttributes', ['lines' => true, 'indexes' => true]);
$services->set(ConstExprParser::class)
->arg('$usedAttributes', ['lines' => true, 'indexes' => true]);

// tagged services
$services->set(PhpDocNodeMapper::class)
Expand Down
18 changes: 17 additions & 1 deletion packages/BetterPhpDocParser/PhpDocParser/BetterPhpDocParser.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,23 @@ public function __construct(
private readonly iterable $phpDocNodeDecorators,
private readonly PrivatesAccessor $privatesAccessor = new PrivatesAccessor(),
) {
parent::__construct($typeParser, $constExprParser);
parent::__construct(
// TypeParser
$typeParser,
// ConstExprParser
$constExprParser,
// requireWhitespaceBeforeDescription
false,
// preserveTypeAliasesWithInvalidTypes
false,
// usedAttributes
['lines' => true, 'indexes' => true],
// parseDoctrineAnnotations
false,
// textBetweenTagsBelongsToDescription, default to false, exists since 1.23.0
// @todo: make it true to allow next doc line text as part of current docblock
false
);
}

public function parse(TokenIterator $tokenIterator): PhpDocNode
Expand Down

0 comments on commit fcc32e5

Please sign in to comment.