@@ -27,9 +27,8 @@ final class CacheMacro implements Latte\IMacro
2727
2828 /**
2929 * Initializes before template parsing.
30- * @return void
3130 */
32- public function initialize ()
31+ public function initialize (): void
3332 {
3433 $ this ->used = false ;
3534 }
@@ -39,19 +38,16 @@ public function initialize()
3938 * Finishes template parsing.
4039 * @return array(prolog, epilog)
4140 */
42- public function finalize ()
41+ public function finalize (): ? array
4342 {
44- if ($ this ->used ) {
45- return ['Nette\Bridges\CacheLatte\CacheMacro::initRuntime($this); ' ];
46- }
43+ return $ this ->used ? ['Nette\Bridges\CacheLatte\CacheMacro::initRuntime($this); ' ] : null ;
4744 }
4845
4946
5047 /**
5148 * New node is found.
52- * @return bool
5349 */
54- public function nodeOpened (Latte \MacroNode $ node )
50+ public function nodeOpened (Latte \MacroNode $ node ): ? bool
5551 {
5652 if ($ node ->modifiers ) {
5753 throw new Latte \CompileException ('Modifiers are not allowed in ' . $ node ->getNotation ());
@@ -62,14 +58,14 @@ public function nodeOpened(Latte\MacroNode $node)
6258 ->write ('<?php if (Nette\Bridges\CacheLatte\CacheMacro::createCache($this->global->cacheStorage, %var, $this->global->cacheStack, %node.array?)) { ?> ' ,
6359 Nette \Utils \Random::generate ()
6460 );
61+ return null ;
6562 }
6663
6764
6865 /**
6966 * Node is closed.
70- * @return void
7167 */
72- public function nodeClosed (Latte \MacroNode $ node )
68+ public function nodeClosed (Latte \MacroNode $ node ): void
7369 {
7470 $ node ->closingCode = Latte \PhpWriter::using ($ node )
7571 ->write ('<?php Nette\Bridges\CacheLatte\CacheMacro::endCache($this->global->cacheStack, %node.array?); } ?> ' );
0 commit comments