@@ -14,26 +14,16 @@ class HtmlCommentsExtension extends AbstractExtension
14
14
{
15
15
protected const ENABLE_FLAG_COOKIE_ID = 'twig_inspector_is_active ' ;
16
16
17
- /** @var string */
18
- private $ previousContent ;
17
+ private ?string $ previousContent = null ;
19
18
20
- /** @var int */
21
- private $ nestingLevel = 0 ;
19
+ private int $ nestingLevel = 0 ;
22
20
23
- /** @var RequestStack */
24
- private $ requestStack ;
21
+ private RequestStack $ requestStack ;
25
22
26
- /** @var UrlGeneratorInterface */
27
- private $ urlGenerator ;
23
+ private UrlGeneratorInterface $ urlGenerator ;
28
24
29
- /** @var BoxDrawings */
30
- private $ boxDrawings ;
25
+ private BoxDrawings $ boxDrawings ;
31
26
32
- /**
33
- * @param RequestStack $requestStack
34
- * @param UrlGeneratorInterface $urlGenerator
35
- * @param BoxDrawings $boxDrawings
36
- */
37
27
public function __construct (
38
28
RequestStack $ requestStack ,
39
29
UrlGeneratorInterface $ urlGenerator ,
@@ -44,9 +34,6 @@ public function __construct(
44
34
$ this ->boxDrawings = $ boxDrawings ;
45
35
}
46
36
47
- /**
48
- * @param NodeReference $ref
49
- */
50
37
public function start (NodeReference $ ref ): void
51
38
{
52
39
if (!$ this ->isEnabled ($ ref )) {
@@ -55,9 +42,6 @@ public function start(NodeReference $ref): void
55
42
ob_start ();
56
43
}
57
44
58
- /**
59
- * @param NodeReference $ref
60
- */
61
45
public function end (NodeReference $ ref ): void
62
46
{
63
47
if (!$ this ->isEnabled ($ ref )) {
@@ -84,10 +68,6 @@ public function end(NodeReference $ref): void
84
68
echo $ content ;
85
69
}
86
70
87
- /**
88
- * @param NodeReference $ref
89
- * @return bool
90
- */
91
71
protected function isEnabled (NodeReference $ ref ): bool
92
72
{
93
73
$ request = $ this ->requestStack ->getCurrentRequest ();
@@ -99,10 +79,6 @@ protected function isEnabled(NodeReference $ref): bool
99
79
return '.html.twig ' === substr ($ ref ->getTemplate (), -10 );
100
80
}
101
81
102
- /**
103
- * @param string $string
104
- * @return bool
105
- */
106
82
protected function isSupported (string $ string ): bool
107
83
{
108
84
// has HTML tags
@@ -123,44 +99,27 @@ protected function isSupported(string $string): bool
123
99
return true ;
124
100
}
125
101
126
- /**
127
- * @param NodeReference $ref
128
- * @return string
129
- */
130
102
private function getStartComment (NodeReference $ ref ): string
131
103
{
132
104
$ prefix = $ this ->boxDrawings ->getStartCommentPrefix ();
133
105
134
106
return $ this ->getComment ($ prefix , $ ref );
135
107
}
136
108
137
- /**
138
- * @param NodeReference $ref
139
- * @return string
140
- */
141
109
private function getEndComment (NodeReference $ ref ): string
142
110
{
143
111
$ prefix = $ this ->boxDrawings ->getEndCommentPrefix ();
144
112
145
113
return $ this ->getComment ($ prefix , $ ref );
146
114
}
147
115
148
- /**
149
- * @param string $prefix
150
- * @param NodeReference $ref
151
- * @return string
152
- */
153
116
protected function getComment (string $ prefix , NodeReference $ ref ): string
154
117
{
155
118
$ link = $ this ->getLink ($ ref );
156
119
157
120
return '<!-- ' .$ prefix .' ' .$ ref ->getName ().' [ ' .$ link .'] # ' .$ ref ->getId ().'--> ' ;
158
121
}
159
122
160
- /**
161
- * @param NodeReference $ref
162
- * @return string
163
- */
164
123
protected function getLink (NodeReference $ ref ): string
165
124
{
166
125
return $ this ->urlGenerator ->generate (
0 commit comments