Aggiornato Composer

This commit is contained in:
Paolo A
2024-05-17 12:24:19 +00:00
parent 4ac62108b5
commit ec201d75b2
2238 changed files with 38684 additions and 59785 deletions

View File

@@ -2,6 +2,12 @@
All notable changes are documented in this file using the [Keep a CHANGELOG](https://keepachangelog.com/) principles.
## [2.0.3] - 2023-12-22
### Changed
* This component is now compatible with `nikic/php-parser` 5.0
## [2.0.2] - 2020-10-26
### Fixed
@@ -24,6 +30,7 @@ All notable changes are documented in this file using the [Keep a CHANGELOG](htt
* Initial release
[2.0.3]: https://github.com/sebastianbergmann/complexity/compare/2.0.2...2.0.3
[2.0.2]: https://github.com/sebastianbergmann/complexity/compare/2.0.1...2.0.2
[2.0.1]: https://github.com/sebastianbergmann/complexity/compare/2.0.0...2.0.1
[2.0.0]: https://github.com/sebastianbergmann/complexity/compare/1.0.0...2.0.0

View File

@@ -14,9 +14,10 @@
"support": {
"issues": "https://github.com/sebastianbergmann/complexity/issues"
},
"prefer-stable": true,
"require": {
"php": ">=7.3",
"nikic/php-parser": "^4.7"
"nikic/php-parser": "^4.18 || ^5.0"
},
"require-dev": {
"phpunit/phpunit": "^9.3"

View File

@@ -10,12 +10,10 @@
namespace SebastianBergmann\Complexity;
use PhpParser\Error;
use PhpParser\Lexer;
use PhpParser\Node;
use PhpParser\NodeTraverser;
use PhpParser\NodeVisitor\NameResolver;
use PhpParser\NodeVisitor\ParentConnectingVisitor;
use PhpParser\Parser;
use PhpParser\ParserFactory;
final class Calculator
@@ -34,7 +32,7 @@ final class Calculator
public function calculateForSourceString(string $source): ComplexityCollection
{
try {
$nodes = $this->parser()->parse($source);
$nodes = (new ParserFactory)->createForHostVersion()->parse($source);
assert($nodes !== null);
@@ -80,9 +78,4 @@ final class Calculator
return $complexityCalculatingVisitor->result();
}
private function parser(): Parser
{
return (new ParserFactory)->create(ParserFactory::PREFER_PHP7, new Lexer);
}
}