Skip to content
Permalink
Browse files

SnippetBridge: added typehints

  • Loading branch information
dg committed Feb 20, 2019
1 parent 4e17a29 commit 28b85e9d78786cefa581736121fd4e41c42fa673
Showing with 13 additions and 13 deletions.
  1. +1 −1 composer.json
  2. +7 −7 src/Latte/Runtime/SnippetBridge.php
  3. +5 −5 tests/Latte/mocks/SnippetBridge.php
@@ -33,7 +33,7 @@
"nette/php-generator": "to use tag {templatePrint}"
},
"conflict": {
"nette/application": "<2.4.1"
"nette/application": "<3.0"
},
"autoload": {
"classmap": ["src/"]
@@ -16,19 +16,19 @@
*/
interface SnippetBridge
{
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;
}


@@ -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;
}

0 comments on commit 28b85e9

Please sign in to comment.
You can’t perform that action at this time.