Ejemplo n.º 1
0
function yay_pretty(string $source) : string
{
    $parser = (new ParserFactory())->create(ParserFactory::PREFER_PHP7);
    $prettyPrinter = new PrettyPrinter\Standard();
    $stmts = $parser->parse($source);
    return $prettyPrinter->prettyPrintFile($stmts);
}
Ejemplo n.º 2
0
 /**
  * @dataProvider provideTestPlaceholderReplacement
  * @covers Template
  */
 public function testPlaceholderReplacement($templateCode, $placeholders, $expectedPrettyPrint)
 {
     $parser = new Parser(new Lexer());
     $prettyPrinter = new PrettyPrinter\Standard();
     $template = new Template($parser, $templateCode);
     $this->assertEquals($expectedPrettyPrint, $prettyPrinter->prettyPrint($template->getStmts($placeholders)));
 }