From 8fb996f30538e9d3c70ec9cbb113384ce9d19f05 Mon Sep 17 00:00:00 2001 From: David Grudl <david@grudl.com> Date: Wed, 20 Feb 2019 11:12:13 +0100 Subject: [PATCH] ISnippetBridge: added typehints --- composer.json | 2 +- src/Latte/Runtime/ISnippetBridge.php | 14 +++++++------- tests/Latte/mocks/SnippetBridge.php | 10 +++++----- 3 files changed, 13 insertions(+), 13 deletions(-) diff --git a/composer.json b/composer.json index a2597375a..d9e1125ed 100644 --- a/composer.json +++ b/composer.json @@ -29,7 +29,7 @@ "nette/utils": "to use filter |webalize" }, "conflict": { - "nette/application": "<2.4.1" + "nette/application": "<3.0" }, "autoload": { "classmap": ["src/"] diff --git a/src/Latte/Runtime/ISnippetBridge.php b/src/Latte/Runtime/ISnippetBridge.php index 5829e758f..9c9f3358b 100644 --- a/src/Latte/Runtime/ISnippetBridge.php +++ b/src/Latte/Runtime/ISnippetBridge.php @@ -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; } diff --git a/tests/Latte/mocks/SnippetBridge.php b/tests/Latte/mocks/SnippetBridge.php index 1fced3731..7bf3fcb63 100644 --- a/tests/Latte/mocks/SnippetBridge.php +++ b/tests/Latte/mocks/SnippetBridge.php @@ -18,19 +18,19 @@ 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]); @@ -38,13 +38,13 @@ public function markRedrawn($name): void } - 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; }