Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitb64fe2d

Browse files
ogizanagichalasr
authored andcommitted
Use stderr for some other commands
1 parentf4cfc0a commitb64fe2d

File tree

4 files changed

+25
-20
lines changed

4 files changed

+25
-20
lines changed

‎src/Symfony/Bridge/Twig/Command/LintCommand.php‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@
1616
useSymfony\Component\Console\Input\InputInterface;
1717
useSymfony\Component\Console\Input\InputOption;
1818
useSymfony\Component\Console\Output\OutputInterface;
19-
useSymfony\Component\Console\Output\ConsoleOutputInterface;
2019
useSymfony\Component\Console\Style\SymfonyStyle;
2120
useSymfony\Component\Finder\Finder;
2221

‎src/Symfony/Bundle/FrameworkBundle/Command/TranslationDebugCommand.php‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
namespaceSymfony\Bundle\FrameworkBundle\Command;
1313

1414
useSymfony\Bundle\FrameworkBundle\Translation\TranslationLoader;
15+
useSymfony\Component\Console\Output\ConsoleOutputInterface;
1516
useSymfony\Component\Console\Style\SymfonyStyle;
1617
useSymfony\Component\Console\Input\InputInterface;
1718
useSymfony\Component\Console\Input\InputArgument;
@@ -159,7 +160,8 @@ protected function execute(InputInterface $input, OutputInterface $output)
159160
$outputMessage .=sprintf(' and domain "%s"',$domain);
160161
}
161162

162-
$io->warning($outputMessage);
163+
$errorIo =$outputinstanceof ConsoleOutputInterface ?newSymfonyStyle($input,$output->getErrorOutput()) :$io;
164+
$errorIo->warning($outputMessage);
163165

164166
return;
165167
}

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

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111

1212
namespaceSymfony\Bundle\FrameworkBundle\Command;
1313

14+
useSymfony\Component\Console\Output\ConsoleOutputInterface;
1415
useSymfony\Component\Console\Style\SymfonyStyle;
1516
useSymfony\Component\Translation\Catalogue\TargetOperation;
1617
useSymfony\Component\Translation\Catalogue\MergeOperation;
@@ -85,10 +86,11 @@ public function isEnabled()
8586
protectedfunctionexecute(InputInterface$input,OutputInterface$output)
8687
{
8788
$io =newSymfonyStyle($input,$output);
89+
$errorIo =$outputinstanceof ConsoleOutputInterface ?newSymfonyStyle($input,$output->getErrorOutput()) :$io;
8890

8991
// check presence of force or dump-message
9092
if ($input->getOption('force') !==true &&$input->getOption('dump-messages') !==true) {
91-
$io->error('You must choose one of --force or --dump-messages');
93+
$errorIo->error('You must choose one of --force or --dump-messages');
9294

9395
return1;
9496
}
@@ -97,7 +99,7 @@ protected function execute(InputInterface $input, OutputInterface $output)
9799
$writer =$this->getContainer()->get('translation.writer');
98100
$supportedFormats =$writer->getFormats();
99101
if (!in_array($input->getOption('output-format'),$supportedFormats)) {
100-
$io->error(array('Wrong output format','Supported formats are:'.implode(',',$supportedFormats).'.'));
102+
$errorIo->error(array('Wrong output format','Supported formats are:'.implode(',',$supportedFormats).'.'));
101103

102104
return1;
103105
}
@@ -127,12 +129,12 @@ protected function execute(InputInterface $input, OutputInterface $output)
127129
}
128130
}
129131

130-
$io->title('Translation Messages Extractor and Dumper');
131-
$io->comment(sprintf('Generating "<info>%s</info>" translation files for "<info>%s</info>"',$input->getArgument('locale'),$currentName));
132+
$errorIo->title('Translation Messages Extractor and Dumper');
133+
$errorIo->comment(sprintf('Generating "<info>%s</info>" translation files for "<info>%s</info>"',$input->getArgument('locale'),$currentName));
132134

133135
// load any messages from templates
134136
$extractedCatalogue =newMessageCatalogue($input->getArgument('locale'));
135-
$io->comment('Parsing templates...');
137+
$errorIo->comment('Parsing templates...');
136138
$extractor =$this->getContainer()->get('translation.extractor');
137139
$extractor->setPrefix($input->getOption('no-prefix') ?'' :$input->getOption('prefix'));
138140
foreach ($transPathsas$path) {
@@ -144,7 +146,7 @@ protected function execute(InputInterface $input, OutputInterface $output)
144146

145147
// load any existing messages from the translation files
146148
$currentCatalogue =newMessageCatalogue($input->getArgument('locale'));
147-
$io->comment('Loading translation files...');
149+
$errorIo->comment('Loading translation files...');
148150
$loader =$this->getContainer()->get('translation.loader');
149151
foreach ($transPathsas$path) {
150152
$path .='translations';
@@ -165,7 +167,7 @@ protected function execute(InputInterface $input, OutputInterface $output)
165167

166168
// Exit if no messages found.
167169
if (!count($operation->getDomains())) {
168-
$io->warning('No translation messages were found.');
170+
$errorIo->warning('No translation messages were found.');
169171

170172
return;
171173
}
@@ -199,7 +201,7 @@ protected function execute(InputInterface $input, OutputInterface $output)
199201
}
200202

201203
if ($input->getOption('output-format') =='xlf') {
202-
$io->comment('Xliff output version is <info>1.2</info>');
204+
$errorIo->comment('Xliff output version is <info>1.2</info>');
203205
}
204206

205207
$resultMessage =sprintf('%d message%s successfully extracted',$extractedMessagesCount,$extractedMessagesCount >1 ?'s were' :' was');
@@ -211,7 +213,7 @@ protected function execute(InputInterface $input, OutputInterface $output)
211213

212214
// save the files
213215
if ($input->getOption('force') ===true) {
214-
$io->comment('Writing files...');
216+
$errorIo->comment('Writing files...');
215217

216218
$bundleTransPath =false;
217219
foreach ($transPathsas$path) {
@@ -232,7 +234,7 @@ protected function execute(InputInterface $input, OutputInterface $output)
232234
}
233235
}
234236

235-
$io->success($resultMessage.'.');
237+
$errorIo->success($resultMessage.'.');
236238
}
237239

238240
privatefunctionfilterCatalogue(MessageCatalogue$catalogue,$domain)

‎src/Symfony/Bundle/SecurityBundle/Command/UserPasswordEncoderCommand.php‎

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
useSymfony\Component\Console\Input\InputArgument;
1616
useSymfony\Component\Console\Input\InputInterface;
1717
useSymfony\Component\Console\Input\InputOption;
18+
useSymfony\Component\Console\Output\ConsoleOutputInterface;
1819
useSymfony\Component\Console\Output\OutputInterface;
1920
useSymfony\Component\Console\Question\Question;
2021
useSymfony\Component\Console\Style\SymfonyStyle;
@@ -85,8 +86,9 @@ protected function configure()
8586
protectedfunctionexecute(InputInterface$input,OutputInterface$output)
8687
{
8788
$io =newSymfonyStyle($input,$output);
89+
$errorIo =$outputinstanceof ConsoleOutputInterface ?newSymfonyStyle($input,$output->getErrorOutput()) :$io;
8890

89-
$input->isInteractive() ?$io->title('Symfony Password Encoder Utility') :$io->newLine();
91+
$input->isInteractive() ?$errorIo->title('Symfony Password Encoder Utility') :$errorIo->newLine();
9092

9193
$password =$input->getArgument('password');
9294
$userClass =$input->getArgument('user-class');
@@ -101,22 +103,22 @@ protected function execute(InputInterface $input, OutputInterface $output)
101103

102104
if (!$password) {
103105
if (!$input->isInteractive()) {
104-
$io->error('The password must not be empty.');
106+
$errorIo->error('The password must not be empty.');
105107

106108
return1;
107109
}
108110
$passwordQuestion =$this->createPasswordQuestion();
109-
$password =$io->askQuestion($passwordQuestion);
111+
$password =$errorIo->askQuestion($passwordQuestion);
110112
}
111113

112114
$salt =null;
113115

114116
if ($input->isInteractive() && !$emptySalt) {
115117
$emptySalt =true;
116118

117-
$io->note('The command will take care of generating a salt for you. Be aware that some encoders advise to let them generate their own salt. If you\'re using one of those encoders, please answer\'no\' to the question below.'.PHP_EOL.'Provide the\'empty-salt\' option in order to let the encoder handle the generation itself.');
119+
$errorIo->note('The command will take care of generating a salt for you. Be aware that some encoders advise to let them generate their own salt. If you\'re using one of those encoders, please answer\'no\' to the question below.'.PHP_EOL.'Provide the\'empty-salt\' option in order to let the encoder handle the generation itself.');
118120

119-
if ($io->confirm('Confirm salt generation ?')) {
121+
if ($errorIo->confirm('Confirm salt generation ?')) {
120122
$salt =$this->generateSalt();
121123
$emptySalt =false;
122124
}
@@ -136,12 +138,12 @@ protected function execute(InputInterface $input, OutputInterface $output)
136138
$io->table(array('Key','Value'),$rows);
137139

138140
if (!$emptySalt) {
139-
$io->note(sprintf('Make sure that your salt storage field fits the salt length: %s chars',strlen($salt)));
141+
$errorIo->note(sprintf('Make sure that your salt storage field fits the salt length: %s chars',strlen($salt)));
140142
}elseif ($bcryptWithoutEmptySalt) {
141-
$io->note('Bcrypt encoder used: the encoder generated its own built-in salt.');
143+
$errorIo->note('Bcrypt encoder used: the encoder generated its own built-in salt.');
142144
}
143145

144-
$io->success('Password encoding succeeded');
146+
$errorIo->success('Password encoding succeeded');
145147
}
146148

147149
/**

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp