8000 feature #23161 [FrameworkBundle] Deprecate useless --no-prefix option… · symfony/symfony@936c1a5 · GitHub
[go: up one dir, main page]

Skip to content

Commit 936c1a5

Browse files
committed
feature #23161 [FrameworkBundle] Deprecate useless --no-prefix option (chalasr)
This PR was merged into the 3.4 branch. Discussion ---------- [FrameworkBundle] Deprecate useless --no-prefix option | Q | A | ------------- | --- | Branch? | 3.4 | Bug fix? | no | New feature? | no | BC breaks? | no | Deprecations? | yes | Tests pass? | yes | Fixed tickets | n/a | License | MIT | Doc PR | n/a It was a workaround, not needed since #21228. Let's deprecate it and remove it in 4.0. Commits ------- f7afa77 [FrameworkBundle] Deprecate useless --no-prefix option
2 parents a75a32d + f7afa77 commit 936c1a5

File tree

3 files changed

+15
-2
lines changed

3 files changed

+15
-2
lines changed

UPGRADE-3.4.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,10 @@ FrameworkBundle
3434
* The `KernelTestCase::getPhpUnitXmlDir()` and `KernelTestCase::getPhpUnitCliConfigArgument()`
3535
methods are deprecated since 3.4 and will be removed in 4.0.
3636

37+
* The `--no-prefix` option of the `translation:update` command is deprecated and
38+
will be removed in 4.0. Use the `--prefix` option with an empty string as value
39+
instead (e.g. `--prefix=""`)
40+
3741
Process
3842
-------
3943

UPGRADE-4.0.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -345,6 +345,9 @@ FrameworkBundle
345345
* The `Symfony\Bundle\FrameworkBundle\Validator\ConstraintValidatorFactory` class has been removed.
346346
Use `Symfony\Component\Validator\ContainerConstraintValidatorFactory` instead.
347347

348+
* The `--no-prefix` option of the `translation:update` command has
349+
been removed.
350+
348 8000 351
HttpFoundation
349352
--------------
350353

src/Symfony/Bundle/FrameworkBundle/Command/TranslationUpdateCommand.php

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ protected function configure()
3939
new InputArgument('locale', InputArgument::REQUIRED, 'The locale'),
4040
new InputArgument('bundle', InputArgument::OPTIONAL, 'The bundle name or directory where to load the messages, defaults to app/Resources folder'),
4141
new InputOption('prefix', null, InputOption::VALUE_OPTIONAL, 'Override the default prefix', '__'),
42-
new InputOption('no-prefix', null, InputOption::VALUE_NONE, 'If set, no prefix is added to the translations'),
42+
new InputOption('no-prefix', null, InputOption::VALUE_NONE, '[DEPRECATED] If set, no prefix is added to the translations'),
4343
new InputOption('output-format', null, InputOption::VALUE_OPTIONAL, 'Override the default output format', 'yml'),
4444
new InputOption('dump-messages', null, InputOption::VALUE_NONE, 'Should the messages be dumped in the console'),
4545
new InputOption('force', null, InputOption::VALUE_NONE, 'Should the update be done'),
@@ -135,7 +135,13 @@ protected function execute(InputInterface $input, OutputInterface $output)
135135
$extractedCatalogue = new MessageCatalogue($input->getArgument('locale'));
136136
$errorIo->comment('Parsing templates...');
137137
$extractor = $this->getContainer()->get('translation.extractor');
138-
$extractor->setPrefix($input->getOption('no-prefix') ? '' : $input->getOption('prefix'));
138+
$prefix = $input->getOption('prefix');
139+
// @deprecated since version 3.4, to be removed in 4.0 along with the --no-prefix option
140+
if ($input->getOption('no-prefix')) {
141+
@trigger_error('The "--no-prefix" option is deprecated since version 3.4 and will be removed in 4.0. Use the "--prefix" option with an empty string as value instead.', E_USER_DEPRECATED);
142+
$prefix = '';
143+
}
144+
$extractor->setPrefix($prefix);
139145
foreach ($transPaths as $path) {
140146
$path .= 'views';
141147
if (is_dir($path)) {

0 commit comments

Comments
 (0)
0