Skip to content

Commit

Permalink
Merge branch '6.3' into 6.4
Browse files Browse the repository at this point in the history
* 6.3:
  add support for nikic/php-parser 5.0
  • Loading branch information
nicolas-grekas committed Jan 8, 2024
2 parents 4c3e80e + 817e8f7 commit 9644cf6
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 4 deletions.
6 changes: 5 additions & 1 deletion Extractor/PhpAstExtractor.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,11 @@ public function __construct(
throw new \LogicException(sprintf('You cannot use "%s" as the "nikic/php-parser" package is not installed. Try running "composer require nikic/php-parser".', static::class));
}

$this->parser = (new ParserFactory())->create(ParserFactory::PREFER_PHP7);
if (method_exists(ParserFactory::class, 'createForHostVersion')) {
$this->parser = (new ParserFactory())->createForHostVersion();
} else {
$this->parser = (new ParserFactory())->create(ParserFactory::PREFER_PHP7);
}
}

public function extract(iterable|string $resource, MessageCatalogue $catalogue): void
Expand Down
2 changes: 1 addition & 1 deletion Extractor/Visitor/ConstraintVisitor.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ public function enterNode(Node $node): ?Node
return null;
}

$parts = $className->parts;
$parts = $className->getParts();
$isConstraintClass = false;

foreach ($parts as $part) {
Expand Down
2 changes: 1 addition & 1 deletion Extractor/Visitor/TranslatableMessageVisitor.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ public function enterNode(Node $node): ?Node
return null;
}

if (!\in_array('TranslatableMessage', $className->parts, true)) {
if (!\in_array('TranslatableMessage', $className->getParts(), true)) {
return null;
}

Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
"symfony/translation-contracts": "^2.5|^3.0"
},
"require-dev": {
"nikic/php-parser": "^4.13",
"nikic/php-parser": "^4.16|^5.0",
"symfony/config": "^5.4|^6.0|^7.0",
"symfony/console": "^5.4|^6.0|^7.0",
"symfony/dependency-injection": "^5.4|^6.0|^7.0",
Expand Down

0 comments on commit 9644cf6

Please sign in to comment.