diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 21821595f..cb7d13b5f 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -23,8 +23,6 @@ jobs: dependencies: - "highest" php-version: - - "7.2" - - "7.3" - "7.4" - "8.0" - "8.1" @@ -45,7 +43,7 @@ jobs: ini-values: error_reporting=-1, display_errors=On, zend.assertions=1 - name: "Reset composer platform" - if: matrix.php-version == '7.2' || matrix.php-version == '7.3' || matrix.php-version == '7.4' + if: matrix.php-version == '7.4' run: "composer config --unset platform" - name: "Install dependencies" @@ -135,8 +133,6 @@ jobs: - "lowest" - "highest" php-version: - - "7.2" - - "7.3" - "7.4" - "8.0" - "8.1" @@ -159,7 +155,7 @@ jobs: ini-values: error_reporting=-1, display_errors=On, zend.assertions=1 - name: "Reset composer platform" - if: matrix.php-version == '7.2' || matrix.php-version == '7.3' || matrix.php-version == '7.4' || matrix.php-version == '8.0' + if: matrix.php-version == '7.4' || matrix.php-version == '8.0' run: "composer config --unset platform" - name: "Install dependencies" diff --git a/SlevomatCodingStandard/Helpers/PhpDocParserHelper.php b/SlevomatCodingStandard/Helpers/PhpDocParserHelper.php index 6cc06d61a..d78a307da 100644 --- a/SlevomatCodingStandard/Helpers/PhpDocParserHelper.php +++ b/SlevomatCodingStandard/Helpers/PhpDocParserHelper.php @@ -9,6 +9,7 @@ use PHPStan\PhpDocParser\Parser\ConstExprParser; use PHPStan\PhpDocParser\Parser\PhpDocParser; use PHPStan\PhpDocParser\Parser\TypeParser; +use PHPStan\PhpDocParser\ParserConfig; use PHPStan\PhpDocParser\Printer\Printer; /** @@ -22,7 +23,7 @@ public static function getLexer(): Lexer static $lexer; if ($lexer === null) { - $lexer = new Lexer(true); + $lexer = new Lexer(self::getConfig()); } return $lexer; @@ -33,17 +34,12 @@ public static function getParser(): PhpDocParser static $parser; if ($parser === null) { - $usedAttributes = ['lines' => true, 'indexes' => true]; - - $constantExpressionParser = new ConstExprParser(true, true, $usedAttributes); + $config = self::getConfig(); + $constantExpressionParser = new ConstExprParser($config); $parser = new PhpDocParser( - new TypeParser($constantExpressionParser, true, $usedAttributes), - $constantExpressionParser, - true, - true, - $usedAttributes, - true, - true + $config, + new TypeParser($config, $constantExpressionParser), + $constantExpressionParser ); } @@ -79,4 +75,15 @@ public static function cloneNode(Node $node): Node return $cloneNode; } + private static function getConfig(): ParserConfig + { + static $config; + + if ($config === null) { + $config = new ParserConfig(['lines' => true, 'indexes' => true]); + } + + return $config; + } + } diff --git a/composer.json b/composer.json index 2ac38f82b..b1eb9a5df 100644 --- a/composer.json +++ b/composer.json @@ -16,9 +16,9 @@ } }, "require": { - "php": "^7.2 || ^8.0", + "php": "^7.4 || ^8.0", "dealerdirect/phpcodesniffer-composer-installer": "^0.6.2 || ^0.7 || ^1.0", - "phpstan/phpdoc-parser": "^1.23.1", + "phpstan/phpdoc-parser": "^2.0", "squizlabs/php_codesniffer": "^3.9.0" }, "require-dev": { @@ -28,7 +28,7 @@ "phpstan/phpstan-deprecation-rules": "1.1.4", "phpstan/phpstan-phpunit": "1.3.16", "phpstan/phpstan-strict-rules": "1.5.2", - "phpunit/phpunit": "8.5.21|9.6.8|10.5.11" + "phpunit/phpunit": "9.6.8|10.5.11" }, "autoload": { "psr-4": {