summaryrefslogtreecommitdiffstats
path: root/Mustache
diff options
context:
space:
mode:
authorSimon Rettberg2023-11-14 14:47:55 +0100
committerSimon Rettberg2023-11-14 14:47:55 +0100
commit06bff0b9b84d47c43f9bc8aff06a29d85ebb7ed0 (patch)
tree7e5493b102074672d8cfd8fe1a61e49f080edbe8 /Mustache
parentUpdate phpstorm config (diff)
downloadslx-admin-06bff0b9b84d47c43f9bc8aff06a29d85ebb7ed0.tar.gz
slx-admin-06bff0b9b84d47c43f9bc8aff06a29d85ebb7ed0.tar.xz
slx-admin-06bff0b9b84d47c43f9bc8aff06a29d85ebb7ed0.zip
Add function param/return types, fix a lot more phpstorm complaints
Diffstat (limited to 'Mustache')
-rw-r--r--Mustache/Compiler.php14
-rw-r--r--Mustache/Engine.php1
-rw-r--r--Mustache/Parser.php11
3 files changed, 14 insertions, 12 deletions
diff --git a/Mustache/Compiler.php b/Mustache/Compiler.php
index 2b0d1f93..fd93741a 100644
--- a/Mustache/Compiler.php
+++ b/Mustache/Compiler.php
@@ -96,7 +96,7 @@ class Mustache_Compiler
$code .= $this->section(
$node[Mustache_Tokenizer::NODES],
$node[Mustache_Tokenizer::NAME],
- isset($node[Mustache_Tokenizer::FILTERS]) ? $node[Mustache_Tokenizer::FILTERS] : array(),
+ $node[Mustache_Tokenizer::FILTERS] ?? array(),
$node[Mustache_Tokenizer::INDEX],
$node[Mustache_Tokenizer::END],
$node[Mustache_Tokenizer::OTAG],
@@ -109,7 +109,7 @@ class Mustache_Compiler
$code .= $this->invertedSection(
$node[Mustache_Tokenizer::NODES],
$node[Mustache_Tokenizer::NAME],
- isset($node[Mustache_Tokenizer::FILTERS]) ? $node[Mustache_Tokenizer::FILTERS] : array(),
+ $node[Mustache_Tokenizer::FILTERS] ?? array(),
$level
);
break;
@@ -117,8 +117,8 @@ class Mustache_Compiler
case Mustache_Tokenizer::T_PARTIAL:
$code .= $this->partial(
$node[Mustache_Tokenizer::NAME],
- isset($node[Mustache_Tokenizer::DYNAMIC]) ? $node[Mustache_Tokenizer::DYNAMIC] : false,
- isset($node[Mustache_Tokenizer::INDENT]) ? $node[Mustache_Tokenizer::INDENT] : '',
+ $node[Mustache_Tokenizer::DYNAMIC] ?? false,
+ $node[Mustache_Tokenizer::INDENT] ?? '',
$level
);
break;
@@ -126,8 +126,8 @@ class Mustache_Compiler
case Mustache_Tokenizer::T_PARENT:
$code .= $this->parent(
$node[Mustache_Tokenizer::NAME],
- isset($node[Mustache_Tokenizer::DYNAMIC]) ? $node[Mustache_Tokenizer::DYNAMIC] : false,
- isset($node[Mustache_Tokenizer::INDENT]) ? $node[Mustache_Tokenizer::INDENT] : '',
+ $node[Mustache_Tokenizer::DYNAMIC] ?? false,
+ $node[Mustache_Tokenizer::INDENT] ?? '',
$node[Mustache_Tokenizer::NODES],
$level
);
@@ -165,7 +165,7 @@ class Mustache_Compiler
case Mustache_Tokenizer::T_UNESCAPED_2:
$code .= $this->variable(
$node[Mustache_Tokenizer::NAME],
- isset($node[Mustache_Tokenizer::FILTERS]) ? $node[Mustache_Tokenizer::FILTERS] : array(),
+ $node[Mustache_Tokenizer::FILTERS] ?? array(),
$node[Mustache_Tokenizer::TYPE] === Mustache_Tokenizer::T_ESCAPED,
$level
);
diff --git a/Mustache/Engine.php b/Mustache/Engine.php
index 7a31ac03..0ac2a738 100644
--- a/Mustache/Engine.php
+++ b/Mustache/Engine.php
@@ -689,6 +689,7 @@ class Mustache_Engine
array('name' => $e->getTemplateName())
);
}
+ return null;
}
/**
diff --git a/Mustache/Parser.php b/Mustache/Parser.php
index 5db58244..e5523b24 100644
--- a/Mustache/Parser.php
+++ b/Mustache/Parser.php
@@ -222,7 +222,7 @@ class Mustache_Parser
{
if ($this->lineTokens > 1) {
// this is the third or later node on this line, so it can't be standalone
- return;
+ return null;
}
$prev = null;
@@ -231,7 +231,7 @@ class Mustache_Parser
// unless the previous node is whitespace.
if ($prev = end($nodes)) {
if (!$this->tokenIsWhitespace($prev)) {
- return;
+ return null;
}
}
}
@@ -239,19 +239,19 @@ class Mustache_Parser
if ($next = reset($tokens)) {
// If we're on a new line, bail.
if ($next[Mustache_Tokenizer::LINE] !== $this->lineNum) {
- return;
+ return null;
}
// If the next token isn't whitespace, bail.
if (!$this->tokenIsWhitespace($next)) {
- return;
+ return null;
}
if (count($tokens) !== 1) {
// Unless it's the last token in the template, the next token
// must end in newline for this to be standalone.
if (substr($next[Mustache_Tokenizer::VALUE], -1) !== "\n") {
- return;
+ return null;
}
}
@@ -263,6 +263,7 @@ class Mustache_Parser
// Return the whitespace prefix, if any
return array_pop($nodes);
}
+ return null;
}
/**