mirror of
https://github.com/Combodo/iTop.git
synced 2026-04-21 01:28:47 +02:00
N°6934 - Symfony 6.4 - upgrade Symfony bundles to 6.4 (#580)
* Update Symfony lib to version ~6.4.0 * Update code missing return type * Add an iTop general configuration entry to store application secret (Symfony mandatory parameter) * Use dependency injection in ExceptionListener & UserProvider classes
This commit is contained in:
@@ -11,6 +11,7 @@
|
||||
|
||||
namespace Symfony\Bundle\FrameworkBundle\Command;
|
||||
|
||||
use Symfony\Component\Console\Attribute\AsCommand;
|
||||
use Symfony\Component\Console\Command\Command;
|
||||
use Symfony\Component\Console\Completion\CompletionInput;
|
||||
use Symfony\Component\Console\Completion\CompletionSuggestions;
|
||||
@@ -38,6 +39,7 @@ use Symfony\Contracts\Translation\TranslatorInterface;
|
||||
*
|
||||
* @final
|
||||
*/
|
||||
#[AsCommand(name: 'debug:translation', description: 'Display translation messages information')]
|
||||
class TranslationDebugCommand extends Command
|
||||
{
|
||||
public const EXIT_CODE_GENERAL_ERROR = 64;
|
||||
@@ -48,17 +50,14 @@ class TranslationDebugCommand extends Command
|
||||
public const MESSAGE_UNUSED = 1;
|
||||
public const MESSAGE_EQUALS_FALLBACK = 2;
|
||||
|
||||
protected static $defaultName = 'debug:translation';
|
||||
protected static $defaultDescription = 'Display translation messages information';
|
||||
|
||||
private $translator;
|
||||
private $reader;
|
||||
private $extractor;
|
||||
private $defaultTransPath;
|
||||
private $defaultViewsPath;
|
||||
private $transPaths;
|
||||
private $codePaths;
|
||||
private $enabledLocales;
|
||||
private TranslatorInterface $translator;
|
||||
private TranslationReaderInterface $reader;
|
||||
private ExtractorInterface $extractor;
|
||||
private ?string $defaultTransPath;
|
||||
private ?string $defaultViewsPath;
|
||||
private array $transPaths;
|
||||
private array $codePaths;
|
||||
private array $enabledLocales;
|
||||
|
||||
public function __construct(TranslatorInterface $translator, TranslationReaderInterface $reader, ExtractorInterface $extractor, string $defaultTransPath = null, string $defaultViewsPath = null, array $transPaths = [], array $codePaths = [], array $enabledLocales = [])
|
||||
{
|
||||
@@ -74,10 +73,7 @@ class TranslationDebugCommand extends Command
|
||||
$this->enabledLocales = $enabledLocales;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
protected function configure()
|
||||
protected function configure(): void
|
||||
{
|
||||
$this
|
||||
->setDefinition([
|
||||
@@ -88,7 +84,6 @@ class TranslationDebugCommand extends Command
|
||||
new InputOption('only-unused', null, InputOption::VALUE_NONE, 'Display only unused messages'),
|
||||
new InputOption('all', null, InputOption::VALUE_NONE, 'Load messages from all registered bundles'),
|
||||
])
|
||||
->setDescription(self::$defaultDescription)
|
||||
->setHelp(<<<'EOF'
|
||||
The <info>%command.name%</info> command helps finding unused or missing translation
|
||||
messages and comparing them with the fallback ones by inspecting the
|
||||
@@ -123,9 +118,6 @@ EOF
|
||||
;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
protected function execute(InputInterface $input, OutputInterface $output): int
|
||||
{
|
||||
$io = new SymfonyStyle($input, $output);
|
||||
@@ -155,7 +147,7 @@ EOF
|
||||
if ($this->defaultViewsPath) {
|
||||
$codePaths[] = $this->defaultViewsPath;
|
||||
}
|
||||
} catch (\InvalidArgumentException $e) {
|
||||
} catch (\InvalidArgumentException) {
|
||||
// such a bundle does not exist, so treat the argument as path
|
||||
$path = $input->getArgument('bundle');
|
||||
|
||||
@@ -188,7 +180,7 @@ EOF
|
||||
}
|
||||
|
||||
// No defined or extracted messages
|
||||
if (empty($allMessages) || null !== $domain && empty($allMessages[$domain])) {
|
||||
if (!$allMessages || null !== $domain && empty($allMessages[$domain])) {
|
||||
$outputMessage = sprintf('No defined or extracted messages for locale "%s"', $locale);
|
||||
|
||||
if (null !== $domain) {
|
||||
@@ -220,14 +212,14 @@ EOF
|
||||
$states[] = self::MESSAGE_MISSING;
|
||||
|
||||
if (!$input->getOption('only-unused')) {
|
||||
$exitCode = $exitCode | self::EXIT_CODE_MISSING;
|
||||
$exitCode |= self::EXIT_CODE_MISSING;
|
||||
}
|
||||
}
|
||||
} elseif ($currentCatalogue->defines($messageId, $domain)) {
|
||||
$states[] = self::MESSAGE_UNUSED;
|
||||
|
||||
if (!$input->getOption('only-missing')) {
|
||||
$exitCode = $exitCode | self::EXIT_CODE_UNUSED;
|
||||
$exitCode |= self::EXIT_CODE_UNUSED;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -241,7 +233,7 @@ EOF
|
||||
if ($fallbackCatalogue->defines($messageId, $domain) && $value === $fallbackCatalogue->get($messageId, $domain)) {
|
||||
$states[] = self::MESSAGE_EQUALS_FALLBACK;
|
||||
|
||||
$exitCode = $exitCode | self::EXIT_CODE_FALLBACK;
|
||||
$exitCode |= self::EXIT_CODE_FALLBACK;
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user