3535 */
3636class NamespacedTwigProfileCollector extends DataCollector implements Renderable, AssetProvider
3737{
38- /**
39- * @var Profile
40- */
41- private $ profile ;
38+ private Profile $ profile ;
4239
43- /**
44- * @var LoaderInterface|Environment|null
45- */
46- private $ loader ;
40+ private LoaderInterface |Environment |null $ loader ;
4741
48- /**
49- * @var int
50- */
51- private $ templateCount ;
5242
53- /**
54- * @var int
55- */
56- private $ blockCount ;
43+ private int $ templateCount = 0 ;
44+
45+ private int $ blockCount = 0 ;
46+
47+ private int $ macroCount = 0 ;
5748
58- /**
59- * @var int
60- */
61- private $ macroCount ;
6249 /**
6350 * @var array[] {
6451 * @var string $name
@@ -70,13 +57,7 @@ class NamespacedTwigProfileCollector extends DataCollector implements Renderable
7057 */
7158 private $ templates ;
7259
73- /**
74- * TwigProfileCollector constructor.
75- *
76- * @param Profile $profile
77- * @param LoaderInterface|Environment $loaderOrEnv
78- */
79- public function __construct (Profile $ profile , $ loaderOrEnv = null )
60+ public function __construct (Profile $ profile , LoaderInterface |Environment |null $ loaderOrEnv = null )
8061 {
8162 $ this ->profile = $ profile ;
8263 $ this ->setLoaderOrEnv ($ loaderOrEnv );
@@ -100,7 +81,7 @@ public function setLoaderOrEnv($loaderOrEnv)
10081 *
10182 * @return array
10283 */
103- public function getWidgets ()
84+ public function getWidgets (): array
10485 {
10586 return [
10687 'twig ' => [
@@ -119,7 +100,7 @@ public function getWidgets()
119100 /**
120101 * @return array
121102 */
122- public function getAssets ()
103+ public function getAssets (): array
123104 {
124105 return [
125106 'css ' => 'widgets/templates/widget.css ' ,
@@ -132,7 +113,7 @@ public function getAssets()
132113 *
133114 * @return array Collected data
134115 */
135- public function collect ()
116+ public function collect (): array
136117 {
137118 $ this ->templateCount = $ this ->blockCount = $ this ->macroCount = 0 ;
138119 $ this ->templates = [];
@@ -163,12 +144,12 @@ public function collect()
163144 *
164145 * @return string
165146 */
166- public function getName ()
147+ public function getName (): string
167148 {
168149 return 'twig ' ;
169150 }
170151
171- public function getHtmlCallGraph ()
152+ public function getHtmlCallGraph (): string
172153 {
173154 $ dumper = new HtmlDumper ();
174155 return $ dumper ->dump ($ this ->profile );
@@ -182,7 +163,7 @@ public function getHtmlCallGraph()
182163 * @var bool ajax
183164 * }
184165 */
185- public function getXdebugLink ($ template , $ line = 1 )
166+ public function getXdebugLink (string $ template , ? int $ line = 1 ): ? array
186167 {
187168 if (is_null ($ this ->loader )) {
188169 return null ;
0 commit comments