added type hints

This commit is contained in:
Fabien Potencier
2019-03-19 14:08:46 +01:00
parent 3ada819420
commit 54cec4e3b8
141 changed files with 519 additions and 860 deletions
+4 -4
View File
@@ -30,7 +30,7 @@ use Twig\Token;
*/
final class IfTokenParser extends AbstractTokenParser
{
public function parse(Token $token)
public function parse(Token $token): Node
{
$lineno = $token->getLine();
$expr = $this->parser->getExpressionParser()->parseExpression();
@@ -70,17 +70,17 @@ final class IfTokenParser extends AbstractTokenParser
return new IfNode(new Node($tests), $else, $lineno, $this->getTag());
}
public function decideIfFork(Token $token)
public function decideIfFork(Token $token): bool
{
return $token->test(['elseif', 'else', 'endif']);
}
public function decideIfEnd(Token $token)
public function decideIfEnd(Token $token): bool
{
return $token->test(['endif']);
}
public function getTag()
public function getTag(): string
{
return 'if';
}