Skip to content

Commit

Permalink
ISnippetBridge: added typehints
Browse files Browse the repository at this point in the history
  • Loading branch information
dg committed Sep 18, 2019
1 parent 8ed2421 commit 1a297fd
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 13 deletions.
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
"nette/utils": "to use filter |webalize"
},
"conflict": {
"nette/application": "<2.4.1"
"nette/application": "<3.0"
},
"autoload": {
"classmap": ["src/"]
Expand Down
14 changes: 7 additions & 7 deletions src/Latte/Runtime/ISnippetBridge.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,17 +16,17 @@
*/
interface ISnippetBridge
{
function isSnippetMode();
function isSnippetMode(): bool;

function setSnippetMode($snippetMode);
function setSnippetMode(bool $snippetMode);

function needsRedraw($name);
function needsRedraw(string $name): bool;

function markRedrawn($name);
function markRedrawn(string $name): void;

function getHtmlId($name);
function getHtmlId(string $name): string;

function addSnippet($name, $content);
function addSnippet(string $name, string $content): void;

function renderChildren();
function renderChildren(): void;
}
10 changes: 5 additions & 5 deletions tests/Latte/mocks/SnippetBridge.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,33 +18,33 @@ public function isSnippetMode(): bool
}


public function setSnippetMode($snippetMode)
public function setSnippetMode(bool $snippetMode)
{
$this->snippetMode = $snippetMode;
}


public function needsRedraw($name): bool
public function needsRedraw(string $name): bool
{
return $this->invalid === true || isset($this->invalid[$name]);
}


public function markRedrawn($name): void
public function markRedrawn(string $name): void
{
if ($this->invalid !== true) {
unset($this->invalid[$name]);
}
}


public function getHtmlId($name): string
public function getHtmlId(string $name): string
{
return $name;
}


public function addSnippet($name, $content): void
public function addSnippet(string $name, string $content): void
{
$this->payload[$name] = $content;
}
Expand Down

0 comments on commit 1a297fd

Please sign in to comment.