Exemple #1
1
 /**
  * {@inheritdoc}
  */
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     list($value, $reflector) = $this->getTargetAndReflector($input->getArgument('value'));
     $doc = $this->getManualDoc($reflector) ?: DocblockFormatter::format($reflector);
     $output->page(function ($output) use($reflector, $doc) {
         $output->writeln(SignatureFormatter::format($reflector));
         if (empty($doc) && !$this->getApplication()->getManualDb()) {
             $output->writeln('');
             $output->writeln('<warning>PHP manual not found</warning>');
             $output->writeln('    To document core PHP functionality, download the PHP reference manual:');
             $output->writeln('    https://github.com/bobthecow/psysh#downloading-the-manual');
         } else {
             $output->writeln('');
             $output->writeln($doc);
         }
     });
 }
    public function testFormat()
    {
        $expected = <<<EOS
<comment>Description:</comment>
  This is a docblock!

<comment>Throws:</comment>
  <info>InvalidArgumentException </info> if \$foo is empty.

<comment>Param:</comment>
  <info>mixed </info> <strong>\$foo </strong> It's a foo thing.
  <info>int   </info> <strong>\$bar </strong> This is definitely bar.

<comment>Return:</comment>
  <info>string </info> A string of no consequence.

<comment>Author:</comment> Justin Hileman \\<*****@*****.**>
EOS;
        $this->assertEquals($expected, DocblockFormatter::format(new \ReflectionMethod($this, 'methodWithDocblock')));
    }