Example #1
0
 /**
  * {@inheritdoc}
  */
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     list($value, $reflector) = $this->getTargetAndReflector($input->getArgument('value'));
     $output->page(function (ShellOutput $output) use($reflector) {
         $output->writeln(SignatureFormatter::format($reflector));
         $output->writeln(CodeFormatter::format($reflector), ShellOutput::OUTPUT_RAW);
     });
 }
Example #2
0
 /**
  *
  * {@inheritdoc}
  *
  */
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     list($value, $reflector) = $this->getTargetAndReflector($input->getArgument('value'));
     try {
         $output->page(CodeFormatter::format($reflector), ShellOutput::OUTPUT_RAW);
     } catch (RuntimeException $e) {
         $output->writeln(SignatureFormatter::format($reflector));
         throw $e;
     }
 }
 /**
  * @dataProvider filenames
  * @expectedException Psy\Exception\RuntimeException
  */
 public function testCodeFormatterThrowsException($filename)
 {
     $reflector = $this->getMockBuilder('ReflectionClass')->disableOriginalConstructor()->getMock();
     $reflector->expects($this->once())->method('getFileName')->will($this->returnValue($filename));
     CodeFormatter::format($reflector);
 }