mirror of
https://github.com/getgrav/grav.git
synced 2026-05-06 07:27:03 +02:00
Use return types in Twig node and token classes
This commit is contained in:
@@ -33,7 +33,7 @@ class TwigNodeCache extends Node
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function compile(Compiler $compiler)
|
||||
public function compile(Compiler $compiler): void
|
||||
{
|
||||
$boo = $this->getAttribute('key');
|
||||
$compiler
|
||||
|
||||
@@ -36,7 +36,7 @@ class TwigNodeMarkdown extends Node implements NodeOutputInterface
|
||||
* @param Compiler $compiler A Twig Compiler instance
|
||||
* @return void
|
||||
*/
|
||||
public function compile(Compiler $compiler)
|
||||
public function compile(Compiler $compiler): void
|
||||
{
|
||||
$compiler
|
||||
->addDebugInfo($this)
|
||||
|
||||
@@ -46,7 +46,7 @@ class TwigNodeRender extends Node implements NodeCaptureInterface
|
||||
* @return void
|
||||
* @throws LogicException
|
||||
*/
|
||||
public function compile(Compiler $compiler)
|
||||
public function compile(Compiler $compiler): void
|
||||
{
|
||||
$compiler->addDebugInfo($this);
|
||||
$compiler->write('$object = ')->subcompile($this->getNode('object'))->raw(';' . PHP_EOL);
|
||||
|
||||
@@ -49,7 +49,7 @@ class TwigNodeScript extends Node implements NodeCaptureInterface
|
||||
* @return void
|
||||
* @throws LogicException
|
||||
*/
|
||||
public function compile(Compiler $compiler)
|
||||
public function compile(Compiler $compiler): void
|
||||
{
|
||||
$compiler->addDebugInfo($this);
|
||||
|
||||
|
||||
@@ -48,7 +48,7 @@ class TwigNodeStyle extends Node implements NodeCaptureInterface
|
||||
* @return void
|
||||
* @throws LogicException
|
||||
*/
|
||||
public function compile(Compiler $compiler)
|
||||
public function compile(Compiler $compiler): void
|
||||
{
|
||||
$compiler->addDebugInfo($this);
|
||||
|
||||
|
||||
@@ -40,7 +40,7 @@ class TwigNodeSwitch extends Node
|
||||
* @param Compiler $compiler A Twig Compiler instance
|
||||
* @return void
|
||||
*/
|
||||
public function compile(Compiler $compiler)
|
||||
public function compile(Compiler $compiler): void
|
||||
{
|
||||
$compiler
|
||||
->addDebugInfo($this)
|
||||
|
||||
@@ -38,7 +38,7 @@ class TwigNodeThrow extends Node
|
||||
* @return void
|
||||
* @throws LogicException
|
||||
*/
|
||||
public function compile(Compiler $compiler)
|
||||
public function compile(Compiler $compiler): void
|
||||
{
|
||||
$compiler->addDebugInfo($this);
|
||||
|
||||
|
||||
@@ -41,7 +41,7 @@ class TwigNodeTryCatch extends Node
|
||||
* @return void
|
||||
* @throws LogicException
|
||||
*/
|
||||
public function compile(Compiler $compiler)
|
||||
public function compile(Compiler $compiler): void
|
||||
{
|
||||
$compiler->addDebugInfo($this);
|
||||
|
||||
|
||||
@@ -57,14 +57,14 @@ class TwigTokenParserCache extends AbstractTokenParser
|
||||
* @param Token $token
|
||||
* @return bool
|
||||
*/
|
||||
public function decideCacheEnd(Token $token)
|
||||
public function decideCacheEnd(Token $token): bool
|
||||
{
|
||||
return $token->test('endcache');
|
||||
}
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function getTag()
|
||||
public function getTag(): string
|
||||
{
|
||||
return 'cache';
|
||||
}
|
||||
|
||||
@@ -45,14 +45,14 @@ class TwigTokenParserMarkdown extends AbstractTokenParser
|
||||
* @param Token $token
|
||||
* @return bool
|
||||
*/
|
||||
public function decideMarkdownEnd(Token $token)
|
||||
public function decideMarkdownEnd(Token $token): bool
|
||||
{
|
||||
return $token->test('endmarkdown');
|
||||
}
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getTag()
|
||||
public function getTag(): string
|
||||
{
|
||||
return 'markdown';
|
||||
}
|
||||
|
||||
@@ -40,7 +40,7 @@ class TwigTokenParserRender extends AbstractTokenParser
|
||||
* @param Token $token
|
||||
* @return array
|
||||
*/
|
||||
protected function parseArguments(Token $token)
|
||||
protected function parseArguments(Token $token): array
|
||||
{
|
||||
$stream = $this->parser->getStream();
|
||||
|
||||
@@ -67,7 +67,7 @@ class TwigTokenParserRender extends AbstractTokenParser
|
||||
*
|
||||
* @return string The tag name
|
||||
*/
|
||||
public function getTag()
|
||||
public function getTag(): string
|
||||
{
|
||||
return 'render';
|
||||
}
|
||||
|
||||
@@ -53,7 +53,7 @@ class TwigTokenParserScript extends AbstractTokenParser
|
||||
* @param Token $token
|
||||
* @return array
|
||||
*/
|
||||
protected function parseArguments(Token $token)
|
||||
protected function parseArguments(Token $token): array
|
||||
{
|
||||
$stream = $this->parser->getStream();
|
||||
|
||||
@@ -87,7 +87,7 @@ class TwigTokenParserScript extends AbstractTokenParser
|
||||
* @param Token $token
|
||||
* @return bool
|
||||
*/
|
||||
public function decideBlockEnd(Token $token)
|
||||
public function decideBlockEnd(Token $token): bool
|
||||
{
|
||||
return $token->test('endscript');
|
||||
}
|
||||
@@ -97,7 +97,7 @@ class TwigTokenParserScript extends AbstractTokenParser
|
||||
*
|
||||
* @return string The tag name
|
||||
*/
|
||||
public function getTag()
|
||||
public function getTag(): string
|
||||
{
|
||||
return 'script';
|
||||
}
|
||||
|
||||
@@ -52,7 +52,7 @@ class TwigTokenParserStyle extends AbstractTokenParser
|
||||
* @param Token $token
|
||||
* @return array
|
||||
*/
|
||||
protected function parseArguments(Token $token)
|
||||
protected function parseArguments(Token $token): array
|
||||
{
|
||||
$stream = $this->parser->getStream();
|
||||
|
||||
@@ -86,7 +86,7 @@ class TwigTokenParserStyle extends AbstractTokenParser
|
||||
* @param Token $token
|
||||
* @return bool
|
||||
*/
|
||||
public function decideBlockEnd(Token $token)
|
||||
public function decideBlockEnd(Token $token): bool
|
||||
{
|
||||
return $token->test('endstyle');
|
||||
}
|
||||
@@ -96,7 +96,7 @@ class TwigTokenParserStyle extends AbstractTokenParser
|
||||
*
|
||||
* @return string The tag name
|
||||
*/
|
||||
public function getTag()
|
||||
public function getTag(): string
|
||||
{
|
||||
return 'style';
|
||||
}
|
||||
|
||||
@@ -106,7 +106,7 @@ class TwigTokenParserSwitch extends AbstractTokenParser
|
||||
* @param Token $token
|
||||
* @return bool
|
||||
*/
|
||||
public function decideIfFork(Token $token)
|
||||
public function decideIfFork(Token $token): bool
|
||||
{
|
||||
return $token->test(['case', 'default', 'endswitch']);
|
||||
}
|
||||
@@ -117,7 +117,7 @@ class TwigTokenParserSwitch extends AbstractTokenParser
|
||||
* @param Token $token
|
||||
* @return bool
|
||||
*/
|
||||
public function decideIfEnd(Token $token)
|
||||
public function decideIfEnd(Token $token): bool
|
||||
{
|
||||
return $token->test(['endswitch']);
|
||||
}
|
||||
@@ -125,7 +125,7 @@ class TwigTokenParserSwitch extends AbstractTokenParser
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getTag()
|
||||
public function getTag(): string
|
||||
{
|
||||
return 'switch';
|
||||
}
|
||||
|
||||
@@ -48,7 +48,7 @@ class TwigTokenParserThrow extends AbstractTokenParser
|
||||
*
|
||||
* @return string The tag name
|
||||
*/
|
||||
public function getTag()
|
||||
public function getTag(): string
|
||||
{
|
||||
return 'throw';
|
||||
}
|
||||
|
||||
@@ -55,7 +55,7 @@ class TwigTokenParserTryCatch extends AbstractTokenParser
|
||||
* @param Token $token
|
||||
* @return bool
|
||||
*/
|
||||
public function decideCatch(Token $token)
|
||||
public function decideCatch(Token $token): bool
|
||||
{
|
||||
return $token->test(['catch']);
|
||||
}
|
||||
@@ -64,7 +64,7 @@ class TwigTokenParserTryCatch extends AbstractTokenParser
|
||||
* @param Token $token
|
||||
* @return bool
|
||||
*/
|
||||
public function decideEnd(Token $token)
|
||||
public function decideEnd(Token $token): bool
|
||||
{
|
||||
return $token->test(['endtry']) || $token->test(['endcatch']);
|
||||
}
|
||||
@@ -74,7 +74,7 @@ class TwigTokenParserTryCatch extends AbstractTokenParser
|
||||
*
|
||||
* @return string The tag name
|
||||
*/
|
||||
public function getTag()
|
||||
public function getTag(): string
|
||||
{
|
||||
return 'try';
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user