@@ -118,7 +118,7 @@ |
||
118 | 118 | $errorMessage = $this->errorMessage; |
119 | 119 | $multiselect = $this->multiselect; |
120 | 120 | |
121 | - return function ($selected) use ($choices, $errorMessage, $multiselect) { |
|
121 | + return function($selected) use ($choices, $errorMessage, $multiselect) { |
|
122 | 122 | // Collapse all spaces. |
123 | 123 | $selectedChoices = str_replace(' ', '', $selected); |
124 | 124 |
@@ -40,7 +40,7 @@ |
||
40 | 40 | { |
41 | 41 | $default = $this->getDefault(); |
42 | 42 | |
43 | - return function ($answer) use ($default) { |
|
43 | + return function($answer) use ($default) { |
|
44 | 44 | if (is_bool($answer)) { |
45 | 45 | return $answer; |
46 | 46 | } |
@@ -45,7 +45,7 @@ discard block |
||
45 | 45 | { |
46 | 46 | $this->hasReadline = function_exists('readline'); |
47 | 47 | $this->application = $application; |
48 | - $this->history = getenv('HOME').'/.history_'.$application->getName(); |
|
48 | + $this->history = getenv('HOME') . '/.history_' . $application->getName(); |
|
49 | 49 | $this->output = new ConsoleOutput(); |
50 | 50 | } |
51 | 51 | |
@@ -103,7 +103,7 @@ discard block |
||
103 | 103 | ; |
104 | 104 | |
105 | 105 | $output = $this->output; |
106 | - $process->run(function ($type, $data) use ($output) { |
|
106 | + $process->run(function($type, $data) use ($output) { |
|
107 | 107 | $output->writeln($data); |
108 | 108 | }); |
109 | 109 | |
@@ -145,7 +145,7 @@ discard block |
||
145 | 145 | protected function getPrompt() |
146 | 146 | { |
147 | 147 | // using the formatter here is required when using readline |
148 | - return $this->output->getFormatter()->format($this->application->getName().' > '); |
|
148 | + return $this->output->getFormatter()->format($this->application->getName() . ' > '); |
|
149 | 149 | } |
150 | 150 | |
151 | 151 | protected function getOutput() |
@@ -188,7 +188,7 @@ discard block |
||
188 | 188 | |
189 | 189 | $list = array('--help'); |
190 | 190 | foreach ($command->getDefinition()->getOptions() as $option) { |
191 | - $list[] = '--'.$option->getName(); |
|
191 | + $list[] = '--' . $option->getName(); |
|
192 | 192 | } |
193 | 193 | |
194 | 194 | return $list; |
@@ -268,8 +268,8 @@ |
||
268 | 268 | |
269 | 269 | $command = $this->getMock('TestCommand', array('execute')); |
270 | 270 | $command->expects($this->once()) |
271 | - ->method('execute') |
|
272 | - ->will($this->returnValue('2.3')); |
|
271 | + ->method('execute') |
|
272 | + ->will($this->returnValue('2.3')); |
|
273 | 273 | $exitCode = $command->run(new StringInput(''), new NullOutput()); |
274 | 274 | $this->assertSame(2, $exitCode, '->run() returns integer exit code (casts numeric to int)'); |
275 | 275 | } |
@@ -29,8 +29,8 @@ discard block |
||
29 | 29 | |
30 | 30 | public static function setUpBeforeClass() |
31 | 31 | { |
32 | - self::$fixturesPath = __DIR__.'/../Fixtures/'; |
|
33 | - require_once self::$fixturesPath.'/TestCommand.php'; |
|
32 | + self::$fixturesPath = __DIR__ . '/../Fixtures/'; |
|
33 | + require_once self::$fixturesPath . '/TestCommand.php'; |
|
34 | 34 | } |
35 | 35 | |
36 | 36 | public function testConstructor() |
@@ -227,7 +227,7 @@ discard block |
||
227 | 227 | |
228 | 228 | $tester->execute(array(), array('interactive' => true)); |
229 | 229 | |
230 | - $this->assertEquals('interact called'.PHP_EOL.'execute called'.PHP_EOL, $tester->getDisplay(), '->run() calls the interact() method if the input is interactive'); |
|
230 | + $this->assertEquals('interact called' . PHP_EOL . 'execute called' . PHP_EOL, $tester->getDisplay(), '->run() calls the interact() method if the input is interactive'); |
|
231 | 231 | } |
232 | 232 | |
233 | 233 | public function testRunNonInteractive() |
@@ -236,7 +236,7 @@ discard block |
||
236 | 236 | |
237 | 237 | $tester->execute(array(), array('interactive' => false)); |
238 | 238 | |
239 | - $this->assertEquals('execute called'.PHP_EOL, $tester->getDisplay(), '->run() does not call the interact() method if the input is not interactive'); |
|
239 | + $this->assertEquals('execute called' . PHP_EOL, $tester->getDisplay(), '->run() does not call the interact() method if the input is not interactive'); |
|
240 | 240 | } |
241 | 241 | |
242 | 242 | /** |
@@ -284,13 +284,13 @@ discard block |
||
284 | 284 | public function testSetCode() |
285 | 285 | { |
286 | 286 | $command = new \TestCommand(); |
287 | - $ret = $command->setCode(function (InputInterface $input, OutputInterface $output) { |
|
287 | + $ret = $command->setCode(function(InputInterface $input, OutputInterface $output) { |
|
288 | 288 | $output->writeln('from the code...'); |
289 | 289 | }); |
290 | 290 | $this->assertEquals($command, $ret, '->setCode() implements a fluent interface'); |
291 | 291 | $tester = new CommandTester($command); |
292 | 292 | $tester->execute(array()); |
293 | - $this->assertEquals('interact called'.PHP_EOL.'from the code...'.PHP_EOL, $tester->getDisplay()); |
|
293 | + $this->assertEquals('interact called' . PHP_EOL . 'from the code...' . PHP_EOL, $tester->getDisplay()); |
|
294 | 294 | } |
295 | 295 | |
296 | 296 | public function testSetCodeWithNonClosureCallable() |
@@ -300,7 +300,7 @@ discard block |
||
300 | 300 | $this->assertEquals($command, $ret, '->setCode() implements a fluent interface'); |
301 | 301 | $tester = new CommandTester($command); |
302 | 302 | $tester->execute(array()); |
303 | - $this->assertEquals('interact called'.PHP_EOL.'from the code...'.PHP_EOL, $tester->getDisplay()); |
|
303 | + $this->assertEquals('interact called' . PHP_EOL . 'from the code...' . PHP_EOL, $tester->getDisplay()); |
|
304 | 304 | } |
305 | 305 | |
306 | 306 | /** |
@@ -329,7 +329,7 @@ discard block |
||
329 | 329 | $command->setApplication(new Application()); |
330 | 330 | $tester = new CommandTester($command); |
331 | 331 | $tester->execute(array('command' => $command->getName())); |
332 | - $this->assertStringEqualsFile(self::$fixturesPath.'/command_astext.txt', $command->asText(), '->asText() returns a text representation of the command'); |
|
332 | + $this->assertStringEqualsFile(self::$fixturesPath . '/command_astext.txt', $command->asText(), '->asText() returns a text representation of the command'); |
|
333 | 333 | } |
334 | 334 | |
335 | 335 | /** |
@@ -343,6 +343,6 @@ discard block |
||
343 | 343 | $command->setApplication(new Application()); |
344 | 344 | $tester = new CommandTester($command); |
345 | 345 | $tester->execute(array('command' => $command->getName())); |
346 | - $this->assertXmlStringEqualsXmlFile(self::$fixturesPath.'/command_asxml.txt', $command->asXml(), '->asXml() returns an XML representation of the command'); |
|
346 | + $this->assertXmlStringEqualsXmlFile(self::$fixturesPath . '/command_asxml.txt', $command->asXml(), '->asXml() returns an XML representation of the command'); |
|
347 | 347 | } |
348 | 348 | } |
@@ -49,7 +49,7 @@ |
||
49 | 49 | |
50 | 50 | public function testExecuteListsCommandsWithNamespaceArgument() |
51 | 51 | { |
52 | - require_once realpath(__DIR__.'/../Fixtures/FooCommand.php'); |
|
52 | + require_once realpath(__DIR__ . '/../Fixtures/FooCommand.php'); |
|
53 | 53 | $application = new Application(); |
54 | 54 | $application->add(new \FooCommand()); |
55 | 55 | $commandTester = new CommandTester($command = $application->get('list')); |
@@ -99,12 +99,12 @@ discard block |
||
99 | 99 | |
100 | 100 | $this->assertEquals( |
101 | 101 | "(\033[32mz>=2.0,<a2.3\033[39m)", |
102 | - $formatter->format('(<info>'.$formatter->escape('z>=2.0,<a2.3').'</info>)') |
|
102 | + $formatter->format('(<info>' . $formatter->escape('z>=2.0,<a2.3') . '</info>)') |
|
103 | 103 | ); |
104 | 104 | |
105 | 105 | $this->assertEquals( |
106 | 106 | "\033[32m<error>some error</error>\033[39m", |
107 | - $formatter->format('<info>'.$formatter->escape('<error>some error</error>').'</info>') |
|
107 | + $formatter->format('<info>' . $formatter->escape('<error>some error</error>') . '</info>') |
|
108 | 108 | ); |
109 | 109 | } |
110 | 110 | |
@@ -163,7 +163,7 @@ discard block |
||
163 | 163 | { |
164 | 164 | $formatter = new OutputFormatter(true); |
165 | 165 | $long = str_repeat("\\", 14000); |
166 | - $this->assertEquals("\033[37;41msome error\033[39;49m".$long, $formatter->format('<error>some error</error>'.$long)); |
|
166 | + $this->assertEquals("\033[37;41msome error\033[39;49m" . $long, $formatter->format('<error>some error</error>' . $long)); |
|
167 | 167 | } |
168 | 168 | |
169 | 169 | public function testNotDecoratedFormatter() |
@@ -37,15 +37,15 @@ discard block |
||
37 | 37 | ); |
38 | 38 | |
39 | 39 | $this->assertEquals( |
40 | - '<error> Some text to display </error>'."\n". |
|
40 | + '<error> Some text to display </error>' . "\n" . |
|
41 | 41 | '<error> foo bar </error>', |
42 | 42 | $formatter->formatBlock(array('Some text to display', 'foo bar'), 'error'), |
43 | 43 | '::formatBlock() formats a message in a block' |
44 | 44 | ); |
45 | 45 | |
46 | 46 | $this->assertEquals( |
47 | - '<error> </error>'."\n". |
|
48 | - '<error> Some text to display </error>'."\n". |
|
47 | + '<error> </error>' . "\n" . |
|
48 | + '<error> Some text to display </error>' . "\n" . |
|
49 | 49 | '<error> </error>', |
50 | 50 | $formatter->formatBlock('Some text to display', 'error', true), |
51 | 51 | '::formatBlock() formats a message in a block' |
@@ -61,8 +61,8 @@ discard block |
||
61 | 61 | $formatter = new FormatterHelper(); |
62 | 62 | |
63 | 63 | $this->assertEquals( |
64 | - '<error> </error>'."\n". |
|
65 | - '<error> Du texte à afficher </error>'."\n". |
|
64 | + '<error> </error>' . "\n" . |
|
65 | + '<error> Du texte à afficher </error>' . "\n" . |
|
66 | 66 | '<error> </error>', |
67 | 67 | $formatter->formatBlock('Du texte à afficher', 'error', true), |
68 | 68 | '::formatBlock() formats a message in a block' |
@@ -76,8 +76,8 @@ discard block |
||
76 | 76 | } |
77 | 77 | $formatter = new FormatterHelper(); |
78 | 78 | $this->assertEquals( |
79 | - '<error> </error>'."\n". |
|
80 | - '<error> 表示するテキスト </error>'."\n". |
|
79 | + '<error> </error>' . "\n" . |
|
80 | + '<error> 表示するテキスト </error>' . "\n" . |
|
81 | 81 | '<error> </error>', |
82 | 82 | $formatter->formatBlock('表示するテキスト', 'error', true), |
83 | 83 | '::formatBlock() formats a message in a block' |
@@ -89,8 +89,8 @@ discard block |
||
89 | 89 | $formatter = new FormatterHelper(); |
90 | 90 | |
91 | 91 | $this->assertEquals( |
92 | - '<error> </error>'."\n". |
|
93 | - '<error> \<info>some info\</info> </error>'."\n". |
|
92 | + '<error> </error>' . "\n" . |
|
93 | + '<error> \<info>some info\</info> </error>' . "\n" . |
|
94 | 94 | '<error> </error>', |
95 | 95 | $formatter->formatBlock('<info>some info</info>', 'error', true), |
96 | 96 | '::formatBlock() escapes \'<\' chars' |
@@ -148,7 +148,7 @@ |
||
148 | 148 | { |
149 | 149 | $progress = $this->getMock('Symfony\Component\Console\Helper\ProgressHelper', array('display')); |
150 | 150 | $progress->expects($this->exactly(4)) |
151 | - ->method('display'); |
|
151 | + ->method('display'); |
|
152 | 152 | |
153 | 153 | $progress->setRedrawFrequency(2); |
154 | 154 |
@@ -52,7 +52,7 @@ discard block |
||
52 | 52 | $progress->advance(2); |
53 | 53 | |
54 | 54 | rewind($output->getStream()); |
55 | - $this->assertEquals($this->generateOutput(' 3 [--->------------------------]').$this->generateOutput(' 5 [----->----------------------]'), stream_get_contents($output->getStream())); |
|
55 | + $this->assertEquals($this->generateOutput(' 3 [--->------------------------]') . $this->generateOutput(' 5 [----->----------------------]'), stream_get_contents($output->getStream())); |
|
56 | 56 | } |
57 | 57 | |
58 | 58 | public function testCustomizations() |
@@ -79,7 +79,7 @@ discard block |
||
79 | 79 | $progress->advance(); |
80 | 80 | |
81 | 81 | rewind($output->getStream()); |
82 | - $this->assertEquals($this->generateOutput(' 0/50 [>---------------------------] 0%').$this->generateOutput(' 1/50 [>---------------------------] 2%').$this->generateOutput(' 2/50 [=>--------------------------] 4%'), stream_get_contents($output->getStream())); |
|
82 | + $this->assertEquals($this->generateOutput(' 0/50 [>---------------------------] 0%') . $this->generateOutput(' 1/50 [>---------------------------] 2%') . $this->generateOutput(' 2/50 [=>--------------------------] 4%'), stream_get_contents($output->getStream())); |
|
83 | 83 | } |
84 | 84 | |
85 | 85 | public function testOverwriteWithShorterLine() |
@@ -96,8 +96,8 @@ discard block |
||
96 | 96 | |
97 | 97 | rewind($output->getStream()); |
98 | 98 | $this->assertEquals( |
99 | - $this->generateOutput(' 0/50 [>---------------------------] 0%'). |
|
100 | - $this->generateOutput(' 1/50 [>---------------------------] 2%'). |
|
99 | + $this->generateOutput(' 0/50 [>---------------------------] 0%') . |
|
100 | + $this->generateOutput(' 1/50 [>---------------------------] 2%') . |
|
101 | 101 | $this->generateOutput(' 2/50 [=>--------------------------] '), |
102 | 102 | stream_get_contents($output->getStream()) |
103 | 103 | ); |
@@ -114,9 +114,9 @@ discard block |
||
114 | 114 | |
115 | 115 | rewind($output->getStream()); |
116 | 116 | $this->assertEquals( |
117 | - $this->generateOutput(' 0/50 [>---------------------------] 0%'). |
|
118 | - $this->generateOutput(' 1/50 [>---------------------------] 2%'). |
|
119 | - $this->generateOutput(' 15/50 [========>-------------------] 30%'). |
|
117 | + $this->generateOutput(' 0/50 [>---------------------------] 0%') . |
|
118 | + $this->generateOutput(' 1/50 [>---------------------------] 2%') . |
|
119 | + $this->generateOutput(' 15/50 [========>-------------------] 30%') . |
|
120 | 120 | $this->generateOutput(' 25/50 [==============>-------------] 50%'), |
121 | 121 | stream_get_contents($output->getStream()) |
122 | 122 | ); |
@@ -183,7 +183,7 @@ discard block |
||
183 | 183 | |
184 | 184 | rewind($output->getStream()); |
185 | 185 | $this->assertEquals( |
186 | - $this->generateOutput(' 25/50 [==============>-------------] 50%').$this->generateOutput(''), |
|
186 | + $this->generateOutput(' 25/50 [==============>-------------] 50%') . $this->generateOutput(''), |
|
187 | 187 | stream_get_contents($output->getStream()) |
188 | 188 | ); |
189 | 189 | } |
@@ -197,7 +197,7 @@ discard block |
||
197 | 197 | $progress->advance(); |
198 | 198 | |
199 | 199 | rewind($output->getStream()); |
200 | - $this->assertEquals($this->generateOutput(' 0/200 [>---------------------------] 0%').$this->generateOutput(' 199/200 [===========================>] 99%').$this->generateOutput(' 200/200 [============================] 100%'), stream_get_contents($output->getStream())); |
|
200 | + $this->assertEquals($this->generateOutput(' 0/200 [>---------------------------] 0%') . $this->generateOutput(' 199/200 [===========================>] 99%') . $this->generateOutput(' 200/200 [============================] 100%'), stream_get_contents($output->getStream())); |
|
201 | 201 | } |
202 | 202 | |
203 | 203 | public function testNonDecoratedOutput() |
@@ -227,6 +227,6 @@ discard block |
||
227 | 227 | |
228 | 228 | $this->lastMessagesLength = strlen($expectedout); |
229 | 229 | |
230 | - return "\x0D".$expectedout; |
|
230 | + return "\x0D" . $expectedout; |
|
231 | 231 | } |
232 | 232 | } |
@@ -589,6 +589,9 @@ |
||
589 | 589 | return new StreamOutput(fopen('php://memory', 'r+', false), $verbosity, $decorated); |
590 | 590 | } |
591 | 591 | |
592 | + /** |
|
593 | + * @param string $expected |
|
594 | + */ |
|
592 | 595 | protected function generateOutput($expected) |
593 | 596 | { |
594 | 597 | $count = substr_count($expected, "\n"); |
@@ -39,7 +39,7 @@ discard block |
||
39 | 39 | $output = $this->getOutputStream(StreamOutput::VERBOSITY_NORMAL); |
40 | 40 | |
41 | 41 | $executed = false; |
42 | - $callback = function () use (&$executed) { $executed = true; }; |
|
42 | + $callback = function() use (&$executed) { $executed = true; }; |
|
43 | 43 | |
44 | 44 | $helper->run($output, 'php -r "echo 42;"', null, $callback); |
45 | 45 | $this->assertTrue($executed); |
@@ -96,9 +96,9 @@ discard block |
||
96 | 96 | array('', 'php -r "syntax error"', StreamOutput::VERBOSITY_VERBOSE, null), |
97 | 97 | array($syntaxErrorOutputVerbose, 'php -r "fwrite(STDERR, \'error message\');usleep(50000);fwrite(STDOUT, \'out message\');exit(252);"', StreamOutput::VERBOSITY_VERY_VERBOSE, null), |
98 | 98 | array($syntaxErrorOutputDebug, 'php -r "fwrite(STDERR, \'error message\');usleep(50000);fwrite(STDOUT, \'out message\');exit(252);"', StreamOutput::VERBOSITY_DEBUG, null), |
99 | - array($errorMessage.PHP_EOL, 'php -r "fwrite(STDERR, \'error message\');usleep(50000);fwrite(STDOUT, \'out message\');exit(252);"', StreamOutput::VERBOSITY_VERBOSE, $errorMessage), |
|
100 | - array($syntaxErrorOutputVerbose.$errorMessage.PHP_EOL, 'php -r "fwrite(STDERR, \'error message\');usleep(50000);fwrite(STDOUT, \'out message\');exit(252);"', StreamOutput::VERBOSITY_VERY_VERBOSE, $errorMessage), |
|
101 | - array($syntaxErrorOutputDebug.$errorMessage.PHP_EOL, 'php -r "fwrite(STDERR, \'error message\');usleep(50000);fwrite(STDOUT, \'out message\');exit(252);"', StreamOutput::VERBOSITY_DEBUG, $errorMessage), |
|
99 | + array($errorMessage . PHP_EOL, 'php -r "fwrite(STDERR, \'error message\');usleep(50000);fwrite(STDOUT, \'out message\');exit(252);"', StreamOutput::VERBOSITY_VERBOSE, $errorMessage), |
|
100 | + array($syntaxErrorOutputVerbose . $errorMessage . PHP_EOL, 'php -r "fwrite(STDERR, \'error message\');usleep(50000);fwrite(STDOUT, \'out message\');exit(252);"', StreamOutput::VERBOSITY_VERY_VERBOSE, $errorMessage), |
|
101 | + array($syntaxErrorOutputDebug . $errorMessage . PHP_EOL, 'php -r "fwrite(STDERR, \'error message\');usleep(50000);fwrite(STDOUT, \'out message\');exit(252);"', StreamOutput::VERBOSITY_DEBUG, $errorMessage), |
|
102 | 102 | array($successOutputProcessDebug, array('php', '-r', 'echo 42;'), StreamOutput::VERBOSITY_DEBUG, null), |
103 | 103 | array($successOutputDebug, new Process('php -r "echo 42;"'), StreamOutput::VERBOSITY_DEBUG, null), |
104 | 104 | ); |