Skip to content

Commit

Permalink
bug #29128 [FrameworkBundle] Cleaning translation commands and fix a …
Browse files Browse the repository at this point in the history
…bug for --all option (yceruto)

This PR was squashed before being merged into the 4.2-dev branch (closes #29128).

Discussion
----------

[FrameworkBundle] Cleaning translation commands and fix a bug for --all option

| Q             | A
| ------------- | ---
| Branch?       | master (4.2)
| Bug fix?      | yes
| New feature?  | no
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | #29121 (comment)
| License       | MIT
| Doc PR        | -

Commits
-------

dfc7dcc Also fix a bug for --all option
3cbefd8 Cleaning translation commands
  • Loading branch information
fabpot committed Nov 8, 2018
2 parents 6a8bfb9 + dfc7dcc commit 6ba1803
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
Expand Up @@ -165,7 +165,7 @@ protected function execute(InputInterface $input, OutputInterface $output)
if (is_dir($dir = sprintf('%s/Resources/%s/translations', $rootDir, $bundle->getName()))) {
$transPaths[] = $dir;
$notice = sprintf('Storing translations files for "%s" in the "%s" directory is deprecated since Symfony 4.2, ', $dir, $bundle->getName());
@trigger_error($notice.($this->defaultTransPath ? sprintf('use the "%s" directory instead.', $this->defaultTransPath) : sprintf('configure and use "framework.translator.default_path" instead.', $bundle->getName())), E_USER_DEPRECATED);
@trigger_error($notice.($this->defaultTransPath ? sprintf('use the "%s" directory instead.', $this->defaultTransPath) : 'configure and use "framework.translator.default_path" instead.'), E_USER_DEPRECATED);
}
$viewsPaths = array($bundle->getPath().'/Resources/views');
if ($this->defaultViewsPath) {
Expand All @@ -174,7 +174,7 @@ protected function execute(InputInterface $input, OutputInterface $output)
if (is_dir($dir = sprintf('%s/Resources/%s/views', $rootDir, $bundle->getName()))) {
$viewsPaths[] = $dir;
$notice = sprintf('Storing templates for "%s" in the "%s" directory is deprecated since Symfony 4.2, ', $bundle->getName(), $dir);
@trigger_error($notice.($this->defaultViewsPath ? sprintf('use the "%s" directory instead.', $this->defaultViewsPath) : sprintf('configure and use "twig.default_path" instead.', $bundle->getName())), E_USER_DEPRECATED);
@trigger_error($notice.($this->defaultViewsPath ? sprintf('use the "%s" directory instead.', $this->defaultViewsPath) : 'configure and use "twig.default_path" instead.'), E_USER_DEPRECATED);
}
} catch (\InvalidArgumentException $e) {
// such a bundle does not exist, so treat the argument as path
Expand Down Expand Up @@ -208,11 +208,11 @@ protected function execute(InputInterface $input, OutputInterface $output)
$notice = sprintf('Storing translations files for "%s" in the "%s" directory is deprecated since Symfony 4.2, ', $bundle->getName(), $deprecatedPath);
@trigger_error($notice.($this->defaultTransPath ? sprintf('use the "%s" directory instead.', $this->defaultTransPath) : 'configure and use "framework.translator.default_path" instead.'), E_USER_DEPRECATED);
}
$viewsPaths[] = array($bundle->getPath().'/Resources/views');
$viewsPaths[] = $bundle->getPath().'/Resources/views';
if (is_dir($deprecatedPath = sprintf('%s/Resources/%s/views', $rootDir, $bundle->getName()))) {
$viewsPaths[] = $deprecatedPath;
$notice = sprintf('Storing templates for "%s" in the "%s" directory is deprecated since Symfony 4.2, ', $bundle->getName(), $deprecatedPath);
@trigger_error($notice.($this->defaultViewsPath ? sprintf('use the "%s" directory instead.', $this->defaultViewsPath) : sprintf('configure and use "twig.default_path" instead.', $bundle->getName())), E_USER_DEPRECATED);
@trigger_error($notice.($this->defaultViewsPath ? sprintf('use the "%s" directory instead.', $this->defaultViewsPath) : 'configure and use "twig.default_path" instead.'), E_USER_DEPRECATED);
}
}
}
Expand Down
Expand Up @@ -111,7 +111,7 @@ protected function execute(InputInterface $input, OutputInterface $output)

// check format
$supportedFormats = $this->writer->getFormats();
if (!\in_array($input->getOption('output-format'), $supportedFormats)) {
if (!\in_array($input->getOption('output-format'), $supportedFormats, true)) {
$errorIo->error(array('Wrong output format', 'Supported formats are: '.implode(', ', $supportedFormats).'.'));

return 1;
Expand Down Expand Up @@ -165,7 +165,7 @@ protected function execute(InputInterface $input, OutputInterface $output)
if (is_dir($dir = sprintf('%s/Resources/%s/views', $rootDir, $foundBundle->getName()))) {
$viewsPaths[] = $dir;
$notice = sprintf('Storing templates for "%s" in the "%s" directory is deprecated since Symfony 4.2, ', $foundBundle->getName(), $dir);
@trigger_error($notice.($this->defaultViewsPath ? sprintf('use the "%s" directory instead.', $this->defaultViewsPath) : sprintf('configure and use "twig.default_path" instead.', $foundBundle->getName())), E_USER_DEPRECATED);
@trigger_error($notice.($this->defaultViewsPath ? sprintf('use the "%s" directory instead.', $this->defaultViewsPath) : 'configure and use "twig.default_path" instead.'), E_USER_DEPRECATED);
}
$currentName = $foundBundle->getName();
} catch (\InvalidArgumentException $e) {
Expand Down Expand Up @@ -261,7 +261,7 @@ protected function execute(InputInterface $input, OutputInterface $output)
$extractedMessagesCount += $domainMessagesCount;
}

if ('xlf' == $input->getOption('output-format')) {
if ('xlf' === $input->getOption('output-format')) {
$errorIo->comment('Xliff output version is <info>1.2</info>');
}

Expand Down

0 comments on commit 6ba1803

Please sign in to comment.