Skip to content

Commit 2749f39

Browse files
committed
composer.json: upgrade phpdoc-parser to v2 and php_codesniffer to v4
1 parent 9210566 commit 2749f39

4 files changed

Lines changed: 87 additions & 72 deletions

File tree

composer.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@
4242
"google/protobuf": "^5.34",
4343
"jetbrains/phpstorm-stubs": "^2025.3",
4444
"nikic/php-parser": "^5.0",
45-
"phpstan/phpdoc-parser": "^1.20"
45+
"phpstan/phpdoc-parser": "^2.3"
4646
},
4747
"require-dev": {
4848
"phpstan/extension-installer": "^1.2",
@@ -51,8 +51,8 @@
5151
"phpstan/phpstan-phpunit": "^2.0",
5252
"phpstan/phpstan-strict-rules": "^2.0",
5353
"phpunit/phpunit": "^12.0",
54-
"slevomat/coding-standard": "^8.11",
55-
"squizlabs/php_codesniffer": "^3.7"
54+
"slevomat/coding-standard": "^8.28",
55+
"squizlabs/php_codesniffer": "^4.0"
5656
},
5757
"scripts": {
5858
"gen-bindings": "protoc --proto_path=src/Bindings --php_out=src/Bindings src/Bindings/scip.proto",

composer.lock

Lines changed: 70 additions & 57 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

phpcs.xml

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -383,6 +383,14 @@
383383
</properties>
384384
</rule>
385385
<rule ref="SlevomatCodingStandard.TypeHints.DisallowArrayTypeHintSyntax"/>
386+
<rule ref="SlevomatCodingStandard.TypeHints.DNFTypeHintFormat">
387+
<properties>
388+
<property name="withSpacesAroundOperators" value="no"/>
389+
<property name="withSpacesInsideParentheses" value="no"/>
390+
<property name="shortNullable" value="yes"/>
391+
<property name="nullPosition" value="last"/>
392+
</properties>
393+
</rule>
386394
<rule ref="SlevomatCodingStandard.TypeHints.LongTypeHints"/>
387395
<rule ref="SlevomatCodingStandard.TypeHints.NullTypeHintOnLastPosition"/>
388396
<rule ref="SlevomatCodingStandard.TypeHints.NullableTypeForNullDefaultValue"/>
@@ -391,13 +399,6 @@
391399
<rule ref="SlevomatCodingStandard.TypeHints.PropertyTypeHint"/>
392400
<rule ref="SlevomatCodingStandard.TypeHints.ReturnTypeHintSpacing"/>
393401
<rule ref="SlevomatCodingStandard.TypeHints.ReturnTypeHint"/>
394-
<rule ref="SlevomatCodingStandard.TypeHints.UnionTypeHintFormat">
395-
<properties>
396-
<property name="withSpaces" value="no"/>
397-
<property name="shortNullable" value="yes"/>
398-
<property name="nullPosition" value="last"/>
399-
</properties>
400-
</rule>
401402
<rule ref="SlevomatCodingStandard.TypeHints.UselessConstantTypeHint"/>
402403

403404
<!-- Variables -->

src/Parser/DocCommentParser.php

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
use PHPStan\PhpDocParser\Parser\PhpDocParser;
1616
use PHPStan\PhpDocParser\Parser\TokenIterator;
1717
use PHPStan\PhpDocParser\Parser\TypeParser;
18+
use PHPStan\PhpDocParser\ParserConfig;
1819

1920
use function count;
2021

@@ -26,11 +27,11 @@
2627

2728
public function __construct()
2829
{
29-
$usedAttributes = ['lines' => true, 'indexes' => true];
30-
$constExprParser = new ConstExprParser(usedAttributes: $usedAttributes);
31-
$typeParser = new TypeParser($constExprParser, usedAttributes: $usedAttributes);
32-
$this->parser = new PhpDocParser($typeParser, $constExprParser, usedAttributes: $usedAttributes);
33-
$this->lexer = new Lexer();
30+
$config = new ParserConfig(usedAttributes: ['lines' => true, 'indexes' => true]);
31+
$this->lexer = new Lexer($config);
32+
$constExprParser = new ConstExprParser($config);
33+
$typeParser = new TypeParser($config, $constExprParser);
34+
$this->parser = new PhpDocParser($config, $typeParser, $constExprParser);
3435
}
3536

3637
public function parsePropertyType(Node $node): ?TypeNode

0 commit comments

Comments
 (0)