@@ -122,7 +122,7 @@ |
||
| 122 | 122 | $params = array(); |
| 123 | 123 | foreach ($this->parameters as $param => $val) { |
| 124 | 124 | if ($param && '-' === $param[0]) { |
| 125 | - $params[] = $param.('' != $val ? '='.$this->escapeToken($val) : ''); |
|
| 125 | + $params[] = $param . ('' != $val ? '=' . $this->escapeToken($val) : ''); |
|
| 126 | 126 | } else { |
| 127 | 127 | $params[] = $this->escapeToken($val); |
| 128 | 128 | } |
@@ -398,11 +398,11 @@ |
||
| 398 | 398 | $elements = array(); |
| 399 | 399 | foreach ($this->getOptions() as $option) { |
| 400 | 400 | $shortcut = $option->getShortcut() ? sprintf('-%s|', $option->getShortcut()) : ''; |
| 401 | - $elements[] = sprintf('['.($option->isValueRequired() ? '%s--%s="..."' : ($option->isValueOptional() ? '%s--%s[="..."]' : '%s--%s')).']', $shortcut, $option->getName()); |
|
| 401 | + $elements[] = sprintf('[' . ($option->isValueRequired() ? '%s--%s="..."' : ($option->isValueOptional() ? '%s--%s[="..."]' : '%s--%s')) . ']', $shortcut, $option->getName()); |
|
| 402 | 402 | } |
| 403 | 403 | |
| 404 | 404 | foreach ($this->getArguments() as $argument) { |
| 405 | - $elements[] = sprintf($argument->isRequired() ? '%s' : '[%s]', $argument->getName().($argument->isArray() ? '1' : '')); |
|
| 405 | + $elements[] = sprintf($argument->isRequired() ? '%s' : '[%s]', $argument->getName() . ($argument->isArray() ? '1' : '')); |
|
| 406 | 406 | |
| 407 | 407 | if ($argument->isArray()) { |
| 408 | 408 | $elements[] = sprintf('... [%sN]', $argument->getName()); |
@@ -64,11 +64,11 @@ |
||
| 64 | 64 | $cursor = 0; |
| 65 | 65 | while ($cursor < $length) { |
| 66 | 66 | if (preg_match('/\s+/A', $input, $match, null, $cursor)) { |
| 67 | - } elseif (preg_match('/([^="\'\s]+?)(=?)('.self::REGEX_QUOTED_STRING.'+)/A', $input, $match, null, $cursor)) { |
|
| 68 | - $tokens[] = $match[1].$match[2].stripcslashes(str_replace(array('"\'', '\'"', '\'\'', '""'), '', substr($match[3], 1, strlen($match[3]) - 2))); |
|
| 69 | - } elseif (preg_match('/'.self::REGEX_QUOTED_STRING.'/A', $input, $match, null, $cursor)) { |
|
| 67 | + } elseif (preg_match('/([^="\'\s]+?)(=?)(' . self::REGEX_QUOTED_STRING . '+)/A', $input, $match, null, $cursor)) { |
|
| 68 | + $tokens[] = $match[1] . $match[2] . stripcslashes(str_replace(array('"\'', '\'"', '\'\'', '""'), '', substr($match[3], 1, strlen($match[3]) - 2))); |
|
| 69 | + } elseif (preg_match('/' . self::REGEX_QUOTED_STRING . '/A', $input, $match, null, $cursor)) { |
|
| 70 | 70 | $tokens[] = stripcslashes(substr($match[0], 1, strlen($match[0]) - 2)); |
| 71 | - } elseif (preg_match('/'.self::REGEX_STRING.'/A', $input, $match, null, $cursor)) { |
|
| 71 | + } elseif (preg_match('/' . self::REGEX_STRING . '/A', $input, $match, null, $cursor)) { |
|
| 72 | 72 | $tokens[] = stripcslashes($match[1]); |
| 73 | 73 | } else { |
| 74 | 74 | // should never happen |
@@ -74,7 +74,7 @@ |
||
| 74 | 74 | */ |
| 75 | 75 | protected function doWrite($message, $newline) |
| 76 | 76 | { |
| 77 | - if (false === @fwrite($this->stream, $message.($newline ? PHP_EOL : ''))) { |
|
| 77 | + if (false === @fwrite($this->stream, $message . ($newline ? PHP_EOL : ''))) { |
|
| 78 | 78 | // should never happen |
| 79 | 79 | throw new \RuntimeException('Unable to write output.'); |
| 80 | 80 | } |
@@ -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')); |