-
-
Notifications
You must be signed in to change notification settings - Fork 108
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Blueprint::printClass() rewritten (BC break)
- Loading branch information
Showing
7 changed files
with
140 additions
and
72 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
use Tester\Assert; | ||
|
||
require __DIR__ . '/../bootstrap.php'; | ||
|
||
|
||
$latte = new Latte\Engine; | ||
$latte->setLoader(new Latte\Loaders\StringLoader); | ||
$latte->addFunction('Abc', function (stdClass $a, $b = 132) {}); | ||
|
||
|
||
class ParentTemplate | ||
{ | ||
public $int; | ||
} | ||
|
||
$params = ['int' => 123, 'unknown' => null]; | ||
|
||
$blueprint = new Latte\Essential\Blueprint; | ||
ob_start(); | ||
$blueprint->printClass($blueprint->generateTemplateClass($params)); | ||
$res = ob_get_clean(); | ||
|
||
Assert::match( | ||
<<<'XX' | ||
%A%class Template | ||
{ | ||
public int $int; | ||
public mixed $unknown; | ||
} | ||
%A% | ||
XX, | ||
$res, | ||
); | ||
|
||
|
||
ob_start(); | ||
$blueprint->printClass($blueprint->generateTemplateClass($params, name: Foo\Template::class, extends: ParentTemplate::class)); | ||
$res = ob_get_clean(); | ||
|
||
Assert::match( | ||
<<<'XX' | ||
%A%namespace Foo; | ||
class Template extends \ParentTemplate | ||
{ | ||
public mixed $unknown; | ||
} | ||
%A% | ||
XX, | ||
$res, | ||
); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters