@@ -19,17 +19,28 @@ $latte->setLoader(new Latte\Loaders\StringLoader([
1919 'main3 ' => '{include inc3.latte, a: 10} ' ,
2020 'main4 ' => '{include inc4.latte, a: 10} ' ,
2121 'main5 ' => '{include inc5.latte, a: 10} ' ,
22+ 'main6 ' => '{include inc6.latte, a: 10} ' ,
23+ 'main7 ' => '{include inc7.latte, a: 10} ' ,
24+ 'main8 ' => '{include inc8.latte, a: 10} ' ,
2225
2326 'inc1.latte ' => '{$a ?? "-"} {$b ?? "-"} {$glob ?? "-"} ' ,
2427 'inc2.latte ' => '{parameters $a} {$a ?? "-"} {$b ?? "-"} {$glob ?? "-"} ' ,
2528 'inc3.latte ' => '{parameters int $a = 5} {$a ?? "-"} {$b ?? "-"} {$glob ?? "-"} ' ,
2629 'inc4.latte ' => '{parameters $a, int $b = 5} {$a ?? "-"} {$b ?? "-"} {$glob ?? "-"} ' ,
2730 'inc5.latte ' => '{parameters $glob} {$a ?? "-"} {$b ?? "-"} {$glob ?? "-"} ' ,
31+ 'inc6.latte ' => '{parameters ?\Exception $glob} {$a ?? "-"} {$b ?? "-"} {$glob->getMessage() ?? "-"} ' ,
32+ 'inc7.latte ' => '{parameters $a, int $b = 5} {block x}{$a ?? "-"} {$b ?? "-"} {$glob ?? "-"}{/block} ' ,
33+ 'inc8.latte ' => '{parameters $a, int $b = 5} {define x}{$a ?? "-"} {$b ?? "-"} {$glob ?? "-"}{/define}{include x} ' ,
2834]));
2935
30-
3136Assert::same ('10 - 123 ' , $ latte ->renderToString ('main1 ' , ['glob ' => 123 ]));
3237Assert::same (' 10 - - ' , $ latte ->renderToString ('main2 ' , ['glob ' => 123 ]));
3338Assert::same (' 10 - - ' , $ latte ->renderToString ('main3 ' , ['glob ' => 123 ]));
3439Assert::same (' 10 5 - ' , $ latte ->renderToString ('main4 ' , ['glob ' => 123 ]));
3540Assert::same (' - - 123 ' , $ latte ->renderToString ('main5 ' , ['glob ' => 123 ]));
41+ Assert::same (' - - 123 ' , $ latte ->renderToString ('main6 ' , ['glob ' => new \Exception ("123 " )]));
42+ Assert::same (' 10 5 - ' , $ latte ->renderToString ('main7 ' , ['glob ' => 123 ]));
43+ Assert::same (' 10 5 - ' , $ latte ->renderToString ('main8 ' , ['glob ' => 123 ]));
44+
45+ Assert::contains ('/** @var int $a */ ' , $ latte ->compile ('inc3.latte ' ));
46+ Assert::contains ('/** @var ?\Exception $glob */ ' , $ latte ->compile ('inc6.latte ' ));
0 commit comments