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); }
/** * @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))); }