Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 0 additions & 3 deletions .github/workflows/ci-linux.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -84,9 +84,6 @@ jobs:

- name: Install PHPUnit
run: |
if [[ ${{ matrix.dependency_versions == 'lowest' }} ]]; then
echo "SYMFONY_PHPUNIT_REQUIRE=nikic/php-parser:^4.18" >> $GITHUB_ENV
fi
vendor/bin/simple-phpunit install

- name: PHPUnit version
Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
"require": {
"php": ">=8.1",
"doctrine/inflector": "^2.0",
"nikic/php-parser": "^4.18|^5.0",
"nikic/php-parser": "^5.0",
"symfony/config": "^6.4|^7.0",
"symfony/console": "^6.4|^7.0",
"symfony/dependency-injection": "^6.4|^7.0",
Expand Down
26 changes: 5 additions & 21 deletions src/Util/ClassSourceManipulator.php
Original file line number Diff line number Diff line change
Expand Up @@ -66,21 +66,10 @@ public function __construct(
private bool $overwrite = false,
private bool $useAttributesForDoctrineMapping = true,
) {
/* @legacy Support for nikic/php-parser v4 */
if (class_exists(PhpVersion::class)) {
$version = PhpVersion::fromString(\PHP_VERSION);
$this->lexer = new Lexer\Emulative($version);
$this->parser = new Parser\Php8($this->lexer, $version);
} else {
$this->lexer = new Lexer\Emulative([
'usedAttributes' => [
'comments',
'startLine', 'endLine',
'startTokenPos', 'endTokenPos',
],
]);
$this->parser = new Parser\Php7($this->lexer);
}
$this->lexer = new Lexer\Emulative(
PhpVersion::fromString('8.1'),
);
$this->parser = new Parser\Php7($this->lexer);

$this->printer = new PrettyPrinter();

Expand Down Expand Up @@ -963,12 +952,7 @@ private function setSourceCode(string $sourceCode): void
$this->sourceCode = $sourceCode;
$this->oldStmts = $this->parser->parse($sourceCode);

/* @legacy Support for nikic/php-parser v4 */
if (\is_callable([$this->parser, 'getTokens'])) {
$this->oldTokens = $this->parser->getTokens();
} elseif (\is_callable($this->lexer->getTokens(...))) {
$this->oldTokens = $this->lexer->getTokens();
}
$this->oldTokens = $this->parser->getTokens();

$traverser = new NodeTraverser();
$traverser->addVisitor(new NodeVisitor\CloningVisitor());
Expand Down