Added return and argument type for LoaderInterface

This commit is contained in:
René Backhaus
2020-08-01 09:02:27 +02:00
committed by GitHub
parent 57ca24c5f3
commit 5521e03471
+4 -4
View File
@@ -400,7 +400,7 @@ Now, let's define a loader able to use this database::
$this->dbh = $dbh;
}
public function getSourceContext($name)
public function getSourceContext(string $name): Source
{
if (false === $source = $this->getValue('source', $name)) {
throw new \Twig\Error\LoaderError(sprintf('Template "%s" does not exist.', $name));
@@ -409,17 +409,17 @@ Now, let's define a loader able to use this database::
return new \Twig\Source($source, $name);
}
public function exists($name)
public function exists(string $name)
{
return $name === $this->getValue('name', $name);
}
public function getCacheKey($name)
public function getCacheKey(string $name): string
{
return $name;
}
public function isFresh($name, $time)
public function isFresh(string $name, int $time): bool
{
if (false === $lastModified = $this->getValue('last_modified', $name)) {
return false;