Skip to content

Commit a97d79a

Browse files
committed
minor symfony#48338 [FrameworkBundle] Fix too eager deprecations for PhpAstExtractor (wouterj)
This PR was squashed before being merged into the 6.2 branch. Discussion ---------- [FrameworkBundle] Fix too eager deprecations for PhpAstExtractor | Q | A | ------------- | --- | Branch? | 6.2 | Bug fix? | no | New feature? | no | Deprecations? | no | Tickets | - | License | MIT | Doc PR | n/a Improve some deprecation handling for `PhpAstExtractor`, as found in the Symfony Demo application by `@javiereguiluz`: * Extractors are not a production feature, so we should not be using `ContainerBuilder::willBeAvailable()` * Mark the `translation.extractor.php` service as deprecated, which prevents the `AutowirePass` from always [including the class](https://github.com/symfony/symfony/blob/6.3/src/Symfony/Component/DependencyInjection/Compiler/AutowirePass.php#L452) and therefor triggering the deprecation Also, I've improved 2 workflow deprecation messages. These were using an old deprecation standard that we removed since using `trigger_deprecation()`. Commits ------- 924bce1 Remove redundant version information from deprecation 30a67ea Fix too eager deprecations for PhpAstExtractor
2 parents 25026b3 + 924bce1 commit a97d79a

File tree

3 files changed

+5
-5
lines changed

3 files changed

+5
-5
lines changed

src/Symfony/Bundle/FrameworkBundle/DependencyInjection/FrameworkExtension.php

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1306,9 +1306,8 @@ private function registerTranslatorConfiguration(array $config, ContainerBuilder
13061306
$container->removeDefinition('translation.locale_switcher');
13071307
}
13081308

1309-
if (ContainerBuilder::willBeAvailable('nikic/php-parser', Parser::class, ['symfony/translation'])
1310-
&& ContainerBuilder::willBeAvailable('symfony/translation', PhpAstExtractor::class, ['symfony/framework-bundle'])
1311-
) {
1309+
// don't use ContainerBuilder::willBeAvailable() as these are not needed in production
1310+
if (interface_exists(Parser::class) && class_exists(PhpAstExtractor::class)) {
13121311
$container->removeDefinition('translation.extractor.php');
13131312
} else {
13141313
$container->removeDefinition('translation.extractor.php_ast');

src/Symfony/Bundle/FrameworkBundle/Resources/config/translation.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -153,6 +153,7 @@
153153
->tag('translation.dumper', ['alias' => 'res'])
154154

155155
->set('translation.extractor.php', PhpExtractor::class)
156+
->deprecate('symfony/framework-bundle', '6.2', 'The "%service_id%" service is deprecated, use "translation.extractor.php_ast" instead.')
156157
->tag('translation.extractor', ['alias' => 'php'])
157158

158159
->set('translation.extractor.php_ast', PhpAstExtractor::class)

src/Symfony/Bundle/FrameworkBundle/Resources/config/workflow.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,9 +41,9 @@
4141
->abstract()
4242
->set('.workflow.registry', Registry::class)
4343
->alias(Registry::class, '.workflow.registry')
44-
->deprecate('symfony/workflow', '6.2', 'The "%alias_id%" alias is deprecated since Symfony 6.2 and will be removed in Symfony 7.0. Inject the workflow directly.')
44+
->deprecate('symfony/workflow', '6.2', 'The "%alias_id%" alias is deprecated, inject the workflow directly.')
4545
->alias('workflow.registry', '.workflow.registry')
46-
->deprecate('symfony/workflow', '6.2', 'The "%alias_id%" service is deprecated since Symfony 6.2 and will be removed in Symfony 7.0. Inject the workflow directly.')
46+
->deprecate('symfony/workflow', '6.2', 'The "%alias_id%" alias is deprecated, inject the workflow directly.')
4747
->set('workflow.security.expression_language', ExpressionLanguage::class)
4848
;
4949
};

0 commit comments

Comments
 (0)