8000 [Translation] fix support for nikic/php-parser 5.0 by xabbuh · Pull Request #53453 · symfony/symfony · GitHub
[go: up one dir, main page]

Skip to content

[Translation] fix support for nikic/php-parser 5.0 #53453

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jan 8, 2024
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
4 changes: 4 additions & 0 deletions .github/workflows/unit-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,10 @@ jobs:
echo SYMFONY_REQUIRE=">=$([ '${{ matrix.mode }}' = low-deps ] && echo 4.4 || echo $SYMFONY_VERSION)" >> $GITHUB_ENV
[[ "${{ matrix.mode }}" = *-deps ]] && mv composer.json.phpunit composer.json || true

if [[ "${{ matrix.mode }}" = low-deps ]]; then
echo SYMFONY_PHPUNIT_REQUIRE="nikic/php-parser:^4.16" >> $GITHUB_ENV
fi

- name: Install dependencies
run: |
echo "::group::composer update"
Expand Down
10000
1 change: 1 addition & 0 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,7 @@
"league/uri": "^6.5|^7.0",
"masterminds/html5": "^2.7.2",
"monolog/monolog": "^1.25.1|^2",
"nikic/php-parser": "^4.16|^5.0",
"nyholm/psr7": "^1.0",
"pda/pheanstalk": "^4.0",
"php-http/discovery": "^1.15",
Expand Down
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
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
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 src/Symfony/Component/Translation/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",
"symfony/console": "^5.4|^6.0",
"symfony/dependency-injection": "^5.4|^6.0",
Expand Down
0