@@ -27,9 +27,8 @@ final class CacheMacro implements Latte\IMacro
27
27
28
28
/**
29
29
* Initializes before template parsing.
30
- * @return void
31
30
*/
32
- public function initialize ()
31
+ public function initialize (): void
33
32
{
34
33
$ this ->used = false ;
35
34
}
@@ -39,19 +38,16 @@ public function initialize()
39
38
* Finishes template parsing.
40
39
* @return array(prolog, epilog)
41
40
*/
42
- public function finalize ()
41
+ public function finalize (): ? array
43
42
{
44
- if ($ this ->used ) {
45
- return ['Nette\Bridges\CacheLatte\CacheMacro::initRuntime($this); ' ];
46
- }
43
+ return $ this ->used ? ['Nette\Bridges\CacheLatte\CacheMacro::initRuntime($this); ' ] : null ;
47
44
}
48
45
49
46
50
47
/**
51
48
* New node is found.
52
- * @return bool
53
49
*/
54
- public function nodeOpened (Latte \MacroNode $ node )
50
+ public function nodeOpened (Latte \MacroNode $ node ): ? bool
55
51
{
56
52
if ($ node ->modifiers ) {
57
53
throw new Latte \CompileException ('Modifiers are not allowed in ' . $ node ->getNotation ());
@@ -62,14 +58,14 @@ public function nodeOpened(Latte\MacroNode $node)
62
58
->write ('<?php if (Nette\Bridges\CacheLatte\CacheMacro::createCache($this->global->cacheStorage, %var, $this->global->cacheStack, %node.array?)) { ?> ' ,
63
59
Nette \Utils \Random::generate ()
64
60
);
61
+ return null ;
65
62
}
66
63
67
64
68
65
/**
69
66
* Node is closed.
70
- * @return void
71
67
*/
72
- public function nodeClosed (Latte \MacroNode $ node )
68
+ public function nodeClosed (Latte \MacroNode $ node ): void
73
69
{
74
70
$ node ->closingCode = Latte \PhpWriter::using ($ node )
75
71
->write ('<?php Nette\Bridges\CacheLatte\CacheMacro::endCache($this->global->cacheStack, %node.array?); } ?> ' );
0 commit comments