@@ -63,7 +63,7 @@ public function __construct(TemplateNameParserInterface $parser, LoaderInterface
6363 *
6464 * @throws \InvalidArgumentException if the template does not exist
6565 */
66- public function render ($ name , array $ parameters = [])
66+ public function render (string | TemplateReferenceInterface $ name , array $ parameters = [])
6767 {
6868 $ storage = $ this ->load ($ name );
6969 $ key = hash ('sha256 ' , serialize ($ storage ));
@@ -94,7 +94,7 @@ public function render($name, array $parameters = [])
9494 /**
9595 * {@inheritdoc}
9696 */
97- public function exists ($ name )
97+ public function exists (string | TemplateReferenceInterface $ name )
9898 {
9999 try {
100100 $ this ->load ($ name );
@@ -108,7 +108,7 @@ public function exists($name)
108108 /**
109109 * {@inheritdoc}
110110 */
111- public function supports ($ name )
111+ public function supports (string | TemplateReferenceInterface $ name )
112112 {
113113 $ template = $ this ->parser ->parse ($ name );
114114
@@ -165,48 +165,39 @@ protected function evaluate(Storage $template, array $parameters = [])
165165 /**
166166 * Gets a helper value.
167167 *
168- * @param string $name The helper name
169- *
170168 * @return HelperInterface The helper value
171169 *
172170 * @throws \InvalidArgumentException if the helper is not defined
173171 */
174- public function offsetGet ($ name )
172+ public function offsetGet (mixed $ name )
175173 {
176174 return $ this ->get ($ name );
177175 }
178176
179177 /**
180178 * Returns true if the helper is defined.
181179 *
182- * @param string $name The helper name
183- *
184180 * @return bool true if the helper is defined, false otherwise
185181 */
186- public function offsetExists ($ name )
182+ public function offsetExists (mixed $ name )
187183 {
188184 return isset ($ this ->helpers [$ name ]);
189185 }
190186
191187 /**
192188 * Sets a helper.
193- *
194- * @param HelperInterface $name The helper instance
195- * @param string $value An alias
196189 */
197- public function offsetSet ($ name , $ value )
190+ public function offsetSet (mixed $ name , mixed $ value )
198191 {
199192 $ this ->set ($ name , $ value );
200193 }
201194
202195 /**
203196 * Removes a helper.
204197 *
205- * @param string $name The helper name
206- *
207198 * @throws \LogicException
208199 */
209- public function offsetUnset ($ name )
200+ public function offsetUnset (mixed $ name )
210201 {
211202 throw new \LogicException (sprintf ('You can \'t unset a helper (%s). ' , $ name ));
212203 }
@@ -272,8 +263,6 @@ public function get(string $name)
272263
273264 /**
274265 * Decorates the current template with another one.
275- *
276- * @param string $template The decorator logical name
277266 */
278267 public function extend (string $ template )
279268 {
@@ -283,11 +272,9 @@ public function extend(string $template)
283272 /**
284273 * Escapes a string by using the current charset.
285274 *
286- * @param mixed $value A variable to escape
287- *
288275 * @return mixed The escaped value
289276 */
290- public function escape ($ value , string $ context = 'html ' )
277+ public function escape (mixed $ value , string $ context = 'html ' )
291278 {
292279 if (is_numeric ($ value )) {
293280 return $ value ;
@@ -356,10 +343,7 @@ public function getEscaper(string $context)
356343 return $ this ->escapers [$ context ];
357344 }
358345
359- /**
360- * @param mixed $value
361- */
362- public function addGlobal (string $ name , $ value )
346+ public function addGlobal (string $ name , mixed $ value )
363347 {
364348 $ this ->globals [$ name ] = $ value ;
365349 }
@@ -466,13 +450,11 @@ public function getLoader()
466450 /**
467451 * Loads the given template.
468452 *
469- * @param string|TemplateReferenceInterface $name A template name or a TemplateReferenceInterface instance
470- *
471453 * @return Storage A Storage instance
472454 *
473455 * @throws \InvalidArgumentException if the template cannot be found
474456 */
475- protected function load ($ name )
457+ protected function load (string | TemplateReferenceInterface $ name )
476458 {
477459 $ template = $ this ->parser ->parse ($ name );
478460
0 commit comments