Skip to content

[Translation] simplify the parser factory creation #53475

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 11, 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
2 changes: 1 addition & 1 deletion .github/workflows/unit-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ jobs:
[[ "${{ 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
echo SYMFONY_PHPUNIT_REQUIRE="nikic/php-parser:^4.18" >> $GITHUB_ENV
fi

- name: Install dependencies
Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +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",
"nikic/php-parser": "^4.18|^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,11 +39,7 @@ 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));
}

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

public function extract(iterable|string $resource, MessageCatalogue $catalogue): void
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.16|^5.0",
"nikic/php-parser": "^4.18|^5.0",
"symfony/config": "^5.4|^6.0",
"symfony/console": "^5.4|^6.0",
"symfony/dependency-injection": "^5.4|^6.0",
Expand Down