The latest version of this library doesn't allow to parse php8.4+ classes, for example:
readonly class RepositoryExportCollection
{
/**
* @var ExportableInterface[]
*/
public private(set) array $collection;
/**
* @param iterable<ExportableInterface> $repositories
*/
public function __construct(
#[AutowireIterator('tenant.data.export')]
iterable $repositories,
) {
$this->collection = iterator_to_array($repositories, false);
}
}
With the following error:
In Modifiers.php line 73:
[PhpParser\Error]
Multiple access type modifiers are not allowed on line 13
Exception trace:
at x/vendor/nikic/php-parser/lib/PhpParser/Modifiers.php:73
PhpParser\Modifiers::verifyModifier() at x/vendor/nikic/php-parser/lib/PhpParser/ParserAbstract.php:1067
PhpParser\ParserAbstract->checkModifier() at x/vendor/nikic/php-parser/lib/PhpParser/Parser/Php8.php:2175
PhpParser\Parser\Php8::{closure:PhpParser\Parser\Php8::initReduceCallbacks():2174}() at x/vendor/nikic/php-parser/lib/PhpParser/ParserAbstract.php:332
PhpParser\ParserAbstract->doParse() at x/vendor/nikic/php-parser/lib/PhpParser/ParserAbstract.php:193
PhpParser\ParserAbstract->parse() at x/vendor/php-translation/extractor/src/FileExtractor/PHPFileExtractor.php:46
Translation\Extractor\FileExtractor\PHPFileExtractor->getSourceLocations() at x/vendor/php-translation/extractor/src/Extractor.php:55
Translation\Extractor\Extractor->doExtract() at x/vendor/php-translation/extractor/src/Extractor.php:34
Translation\Extractor\Extractor->extract() at x/vendor/php-translation/symfony-bundle/Service/Importer.php:72
Translation\Bundle\Service\Importer->extractToCatalogues() at x/vendor/php-translation/symfony-bundle/Command/ExtractCommand.php:106
Translation\Bundle\Command\ExtractCommand->execute() at x/vendor/symfony/console/Command/Command.php:341
Symfony\Component\Console\Command\Command->run() at x/vendor/symfony/console/Application.php:1117
Symfony\Component\Console\Application->doRunCommand() at x/vendor/symfony/framework-bundle/Console/Application.php:123
Symfony\Bundle\FrameworkBundle\Console\Application->doRunCommand() at x/vendor/symfony/console/Application.php:356
Symfony\Component\Console\Application->doRun() at x/vendor/symfony/framework-bundle/Console/Application.php:77
Symfony\Bundle\FrameworkBundle\Console\Application->doRun() at x/vendor/symfony/console/Application.php:195
Symfony\Component\Console\Application->run() at x/bin/console:42
translation:extract [--hide-errors] [-b|--bundle BUNDLE] [--] [<configuration> [<locale>]]
It's because:
$parser = (new ParserFactory())->createForVersion(PhpVersion::fromString('8.1'));
in PHPFileExtractor.
Shouldn't this 8.1 PHP version:
a) be higher, as the parser seems backwards compatible
b) be determined differently than the hardcoded version (like getNewestSupported or getHostVersion)?
c) be configurable somehow?
The latest version of this library doesn't allow to parse php8.4+ classes, for example:
With the following error:
It's because:
in
PHPFileExtractor.Shouldn't this 8.1 PHP version:
a) be higher, as the parser seems backwards compatible
b) be determined differently than the hardcoded version (like
getNewestSupportedorgetHostVersion)?c) be configurable somehow?