summaryrefslogtreecommitdiff
path: root/src/Renderer
diff options
context:
space:
mode:
Diffstat (limited to 'src/Renderer')
-rw-r--r--src/Renderer/Engine.php2
-rw-r--r--src/Renderer/EngineInterface.php2
-rw-r--r--src/Renderer/Renderer.php4
-rw-r--r--src/Renderer/Twig/Extensions/Assets.php6
-rw-r--r--src/Renderer/Twig/Extensions/Authentication.php6
-rw-r--r--src/Renderer/Twig/Extensions/Config.php2
-rw-r--r--src/Renderer/Twig/Extensions/Csrf.php6
-rw-r--r--src/Renderer/Twig/Extensions/Globals.php2
-rw-r--r--src/Renderer/Twig/Extensions/Legacy.php4
-rw-r--r--src/Renderer/Twig/Extensions/Markdown.php2
-rw-r--r--src/Renderer/Twig/Extensions/Session.php2
-rw-r--r--src/Renderer/Twig/Extensions/Translation.php4
-rw-r--r--src/Renderer/Twig/Extensions/Url.php6
-rw-r--r--src/Renderer/TwigLoader.php4
-rw-r--r--src/Renderer/TwigServiceProvider.php2
15 files changed, 27 insertions, 27 deletions
diff --git a/src/Renderer/Engine.php b/src/Renderer/Engine.php
index 60f1d686..e2ff23f2 100644
--- a/src/Renderer/Engine.php
+++ b/src/Renderer/Engine.php
@@ -11,7 +11,7 @@ abstract class Engine implements EngineInterface
* @param mixed[]|string $key
* @param null $value
*/
- public function share($key, $value = null)
+ public function share($key, $value = null): void
{
if (!is_array($key)) {
$key = [$key => $value];
diff --git a/src/Renderer/EngineInterface.php b/src/Renderer/EngineInterface.php
index 3bce9c02..dd713029 100644
--- a/src/Renderer/EngineInterface.php
+++ b/src/Renderer/EngineInterface.php
@@ -23,5 +23,5 @@ interface EngineInterface
* @param string|mixed[] $key
* @param mixed $value
*/
- public function share($key, $value = null);
+ public function share($key, $value = null): void;
}
diff --git a/src/Renderer/Renderer.php b/src/Renderer/Renderer.php
index de31ca74..ccda6881 100644
--- a/src/Renderer/Renderer.php
+++ b/src/Renderer/Renderer.php
@@ -18,7 +18,7 @@ class Renderer
* @param mixed[] $data
* @return string
*/
- public function render($template, $data = [])
+ public function render(string $template, array $data = []): string
{
foreach ($this->renderer as $renderer) {
if (!$renderer->canRender($template)) {
@@ -40,7 +40,7 @@ class Renderer
*
* @param EngineInterface $renderer
*/
- public function addRenderer(EngineInterface $renderer)
+ public function addRenderer(EngineInterface $renderer): void
{
$this->renderer[] = $renderer;
}
diff --git a/src/Renderer/Twig/Extensions/Assets.php b/src/Renderer/Twig/Extensions/Assets.php
index b77e4755..04d6c9c8 100644
--- a/src/Renderer/Twig/Extensions/Assets.php
+++ b/src/Renderer/Twig/Extensions/Assets.php
@@ -22,7 +22,7 @@ class Assets extends TwigExtension
/**
* @return TwigFunction[]
*/
- public function getFunctions()
+ public function getFunctions(): array
{
return [
new TwigFunction('asset', [$this, 'getAsset']),
@@ -31,9 +31,9 @@ class Assets extends TwigExtension
/**
* @param string $path
- * @return UrlGenerator|string
+ * @return string
*/
- public function getAsset($path)
+ public function getAsset(string $path): string
{
$path = ltrim($path, '/');
diff --git a/src/Renderer/Twig/Extensions/Authentication.php b/src/Renderer/Twig/Extensions/Authentication.php
index 33268ee6..061a9018 100644
--- a/src/Renderer/Twig/Extensions/Authentication.php
+++ b/src/Renderer/Twig/Extensions/Authentication.php
@@ -22,7 +22,7 @@ class Authentication extends TwigExtension
/**
* @return TwigFunction[]
*/
- public function getFunctions()
+ public function getFunctions(): array
{
return [
new TwigFunction('is_user', [$this, 'isAuthenticated']),
@@ -34,7 +34,7 @@ class Authentication extends TwigExtension
/**
* @return bool
*/
- public function isAuthenticated()
+ public function isAuthenticated(): bool
{
return (bool)$this->auth->user();
}
@@ -42,7 +42,7 @@ class Authentication extends TwigExtension
/**
* @return bool
*/
- public function isGuest()
+ public function isGuest(): bool
{
return !$this->isAuthenticated();
}
diff --git a/src/Renderer/Twig/Extensions/Config.php b/src/Renderer/Twig/Extensions/Config.php
index a82d2f73..da106957 100644
--- a/src/Renderer/Twig/Extensions/Config.php
+++ b/src/Renderer/Twig/Extensions/Config.php
@@ -22,7 +22,7 @@ class Config extends TwigExtension
/**
* @return TwigFunction[]
*/
- public function getFunctions()
+ public function getFunctions(): array
{
return [
new TwigFunction('config', [$this->config, 'get']),
diff --git a/src/Renderer/Twig/Extensions/Csrf.php b/src/Renderer/Twig/Extensions/Csrf.php
index 6e326824..fee1c1f9 100644
--- a/src/Renderer/Twig/Extensions/Csrf.php
+++ b/src/Renderer/Twig/Extensions/Csrf.php
@@ -22,7 +22,7 @@ class Csrf extends TwigExtension
/**
* @return TwigFunction[]
*/
- public function getFunctions()
+ public function getFunctions(): array
{
return [
new TwigFunction('csrf', [$this, 'getCsrfField'], ['is_safe' => ['html']]),
@@ -33,7 +33,7 @@ class Csrf extends TwigExtension
/**
* @return string
*/
- public function getCsrfField()
+ public function getCsrfField(): string
{
return sprintf('<input type="hidden" name="_token" value="%s">', $this->getCsrfToken());
}
@@ -41,7 +41,7 @@ class Csrf extends TwigExtension
/**
* @return string
*/
- public function getCsrfToken()
+ public function getCsrfToken(): string
{
return $this->session->get('_token');
}
diff --git a/src/Renderer/Twig/Extensions/Globals.php b/src/Renderer/Twig/Extensions/Globals.php
index a7914623..a809682c 100644
--- a/src/Renderer/Twig/Extensions/Globals.php
+++ b/src/Renderer/Twig/Extensions/Globals.php
@@ -24,7 +24,7 @@ class Globals extends TwigExtension implements GlobalsInterface
*
* @return array An array of global variables
*/
- public function getGlobals()
+ public function getGlobals(): array
{
$user = $this->auth->user();
diff --git a/src/Renderer/Twig/Extensions/Legacy.php b/src/Renderer/Twig/Extensions/Legacy.php
index 41b00468..dc0c4775 100644
--- a/src/Renderer/Twig/Extensions/Legacy.php
+++ b/src/Renderer/Twig/Extensions/Legacy.php
@@ -22,7 +22,7 @@ class Legacy extends TwigExtension
/**
* @return TwigFunction[]
*/
- public function getFunctions()
+ public function getFunctions(): array
{
$isSafeHtml = ['is_safe' => ['html']];
return [
@@ -39,7 +39,7 @@ class Legacy extends TwigExtension
/**
* @return string
*/
- public function getPage()
+ public function getPage(): string
{
if ($this->request->has('p')) {
return $this->request->get('p');
diff --git a/src/Renderer/Twig/Extensions/Markdown.php b/src/Renderer/Twig/Extensions/Markdown.php
index 3d523f57..c23a0031 100644
--- a/src/Renderer/Twig/Extensions/Markdown.php
+++ b/src/Renderer/Twig/Extensions/Markdown.php
@@ -36,7 +36,7 @@ class Markdown extends TwigExtension
* @param string $text
* @return string
*/
- public function render($text): string
+ public function render(string $text): string
{
return $this->renderer->text(htmlspecialchars($text));
}
diff --git a/src/Renderer/Twig/Extensions/Session.php b/src/Renderer/Twig/Extensions/Session.php
index 378e977e..77b5b55a 100644
--- a/src/Renderer/Twig/Extensions/Session.php
+++ b/src/Renderer/Twig/Extensions/Session.php
@@ -22,7 +22,7 @@ class Session extends TwigExtension
/**
* @return TwigFunction[]
*/
- public function getFunctions()
+ public function getFunctions(): array
{
return [
new TwigFunction('session_get', [$this->session, 'get']),
diff --git a/src/Renderer/Twig/Extensions/Translation.php b/src/Renderer/Twig/Extensions/Translation.php
index 63b6fa5e..fff3bfa9 100644
--- a/src/Renderer/Twig/Extensions/Translation.php
+++ b/src/Renderer/Twig/Extensions/Translation.php
@@ -23,7 +23,7 @@ class Translation extends TwigExtension
/**
* @return array
*/
- public function getFilters()
+ public function getFilters(): array
{
return [
new TwigFilter('trans', [$this->translator, 'translate']),
@@ -33,7 +33,7 @@ class Translation extends TwigExtension
/**
* @return TwigFunction[]
*/
- public function getFunctions()
+ public function getFunctions(): array
{
return [
new TwigFunction('__', [$this->translator, 'translate']),
diff --git a/src/Renderer/Twig/Extensions/Url.php b/src/Renderer/Twig/Extensions/Url.php
index 84c6aa4d..17fd6ff0 100644
--- a/src/Renderer/Twig/Extensions/Url.php
+++ b/src/Renderer/Twig/Extensions/Url.php
@@ -22,7 +22,7 @@ class Url extends TwigExtension
/**
* @return TwigFunction[]
*/
- public function getFunctions()
+ public function getFunctions(): array
{
return [
new TwigFunction('url', [$this, 'getUrl']),
@@ -32,9 +32,9 @@ class Url extends TwigExtension
/**
* @param string $path
* @param array $parameters
- * @return UrlGenerator|string
+ * @return string
*/
- public function getUrl($path, $parameters = [])
+ public function getUrl(string $path, array $parameters = []): string
{
$path = str_replace('_', '-', $path);
diff --git a/src/Renderer/TwigLoader.php b/src/Renderer/TwigLoader.php
index 3c4c8ab8..1bcbbd71 100644
--- a/src/Renderer/TwigLoader.php
+++ b/src/Renderer/TwigLoader.php
@@ -10,10 +10,10 @@ class TwigLoader extends FilesystemLoader
/**
* @param string $name
* @param bool $throw
- * @return string|false|null
+ * @return string|null
* @throws ErrorLoader
*/
- public function findTemplate($name, $throw = true)
+ public function findTemplate(string $name, bool $throw = true): ?string
{
$extension = '.twig';
$extensionLength = mb_strlen($extension);
diff --git a/src/Renderer/TwigServiceProvider.php b/src/Renderer/TwigServiceProvider.php
index 3a365a5e..d4e4a939 100644
--- a/src/Renderer/TwigServiceProvider.php
+++ b/src/Renderer/TwigServiceProvider.php
@@ -95,7 +95,7 @@ class TwigServiceProvider extends ServiceProvider
* @param string $class
* @param string $alias
*/
- protected function registerTwigExtensions($class, $alias)
+ protected function registerTwigExtensions(string $class, string $alias)
{
$alias = 'twig.extension.' . $alias;