Skip to content

Commit cc3bad6

Browse files
committed
compatibility with latte/latte 3.0
1 parent c18b823 commit cc3bad6

File tree

4 files changed

+13
-13
lines changed

4 files changed

+13
-13
lines changed

composer.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,15 +29,15 @@
2929
"nette/forms": "^3.0",
3030
"nette/robot-loader": "^2.4.2 || ^3.0",
3131
"nette/security": "^3.0",
32-
"latte/latte": "^2.4.3",
32+
"latte/latte": "^3.0",
3333
"tracy/tracy": "^2.4",
3434
"mockery/mockery": "^1.0"
3535
},
3636
"conflict": {
3737
"nette/nette": "<2.2",
3838
"nette/di": "<2.4",
3939
"nette/forms": "<3.0",
40-
"nette/latte": "<2.4"
40+
"nette/latte": "<3.0"
4141
},
4242
"autoload": {
4343
"classmap": ["src/"],

src/Bridges/ApplicationLatte/SnippetBridge.php

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -35,39 +35,39 @@ public function __construct(Control $control)
3535
}
3636

3737

38-
public function isSnippetMode()
38+
public function isSnippetMode(): bool
3939
{
40-
return $this->control->snippetMode;
40+
return (bool) $this->control->snippetMode;
4141
}
4242

4343

44-
public function setSnippetMode($snippetMode)
44+
public function setSnippetMode(bool $snippetMode)
4545
{
4646
$this->control->snippetMode = $snippetMode;
4747
}
4848

4949

50-
public function needsRedraw($name)
50+
public function needsRedraw(string $name): bool
5151
{
5252
return $this->control->isControlInvalid($name);
5353
}
5454

5555

56-
public function markRedrawn($name)
56+
public function markRedrawn(string $name): void
5757
{
5858
if ($name !== '') {
5959
$this->control->redrawControl($name, FALSE);
6060
}
6161
}
6262

6363

64-
public function getHtmlId($name)
64+
public function getHtmlId(string $name): string
6565
{
6666
return $this->control->getSnippetId($name);
6767
}
6868

6969

70-
public function addSnippet($name, $content)
70+
public function addSnippet(string $name, string $content): void
7171
{
7272
if ($this->payload === NULL) {
7373
$this->payload = $this->control->getPresenter()->getPayload();
@@ -76,7 +76,7 @@ public function addSnippet($name, $content)
7676
}
7777

7878

79-
public function renderChildren()
79+
public function renderChildren(): void
8080
{
8181
$queue = [$this->control];
8282
do {

tests/Bridges.Latte/UIMacros.control.phpt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,11 +18,11 @@ UIMacros::install($compiler);
1818

1919
// {control ...}
2020
Assert::match('<?php %a% $this->global->uiControl->getComponent("form"); %a%->render(); ?>', $compiler->expandMacro('control', 'form', '')->openingCode);
21-
Assert::match('<?php %a% $this->global->uiControl->getComponent("form"); %a%->render(); echo call_user_func($this->filters->filter, %a%); ?>', $compiler->expandMacro('control', 'form', 'filter')->openingCode);
21+
Assert::match('<?php %a% $this->global->uiControl->getComponent("form"); %a%->render(); echo ($this->filters->filter)(%a%); ?>', $compiler->expandMacro('control', 'form', 'filter')->openingCode);
2222
Assert::match('<?php %a% if (is_object($form)) %a% else %a% $this->global->uiControl->getComponent($form); %a%->render(); ?>', $compiler->expandMacro('control', '$form', '')->openingCode);
2323
Assert::match('<?php %a% $this->global->uiControl->getComponent("form"); %a%->renderType(); ?>', $compiler->expandMacro('control', 'form:type', '')->openingCode);
2424
Assert::match('<?php %a% $this->global->uiControl->getComponent("form"); %a%->{"render$type"}(); ?>', $compiler->expandMacro('control', 'form:$type', '')->openingCode);
2525
Assert::match('<?php %a% $this->global->uiControl->getComponent("form"); %a%->renderType(\'param\'); ?>', $compiler->expandMacro('control', 'form:type param', '')->openingCode);
2626
Assert::match('<?php %a% $this->global->uiControl->getComponent("form"); %a%->renderType([\'param\' => 123]); ?>', $compiler->expandMacro('control', 'form:type param => 123', '')->openingCode);
2727
Assert::match('<?php %a% $this->global->uiControl->getComponent("form"); %a%->renderType([\'param\' => 123]); ?>', $compiler->expandMacro('control', 'form:type, param => 123', '')->openingCode);
28-
Assert::match('<?php %a% $this->global->uiControl->getComponent("form"); %a%->render(); echo call_user_func($this->filters->striptags, %a%); ?>', $compiler->expandMacro('control', 'form', 'striptags')->openingCode);
28+
Assert::match('<?php %a% $this->global->uiControl->getComponent("form"); %a%->render(); echo ($this->filters->striptags)(%a%); ?>', $compiler->expandMacro('control', 'form', 'striptags')->openingCode);

tests/Bridges.Latte/UIMacros.link.phpt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ UIMacros::install($compiler);
1919

2020
// {link ...}
2121
Assert::same('<?php echo $this->global->uiControl->link("p") ?>', $compiler->expandMacro('link', 'p', '')->openingCode);
22-
Assert::same('<?php echo call_user_func($this->filters->filter, $this->global->uiControl->link("p")) ?>', $compiler->expandMacro('link', 'p', 'filter')->openingCode);
22+
Assert::same('<?php echo ($this->filters->filter)($this->global->uiControl->link("p")) ?>', $compiler->expandMacro('link', 'p', 'filter')->openingCode);
2323
Assert::same('<?php echo $this->global->uiControl->link("p:a") ?>', $compiler->expandMacro('link', 'p:a', '')->openingCode);
2424
Assert::same('<?php echo $this->global->uiControl->link($dest) ?>', $compiler->expandMacro('link', '$dest', '')->openingCode);
2525
Assert::same('<?php echo $this->global->uiControl->link($p:$a) ?>', $compiler->expandMacro('link', '$p:$a', '')->openingCode);

0 commit comments

Comments
 (0)