diff --git a/src/Symfony/Component/Templating/Helper/Helper.php b/src/Symfony/Component/Templating/Helper/Helper.php index 2f34fb22d2..d8f924d0a7 100644 --- a/src/Symfony/Component/Templating/Helper/Helper.php +++ b/src/Symfony/Component/Templating/Helper/Helper.php @@ -25,10 +25,8 @@ abstract class Helper implements HelperInterface /** * Sets the default charset. - * - * @param string $charset The charset */ - public function setCharset($charset) + public function setCharset(string $charset) { $this->charset = $charset; } diff --git a/src/Symfony/Component/Templating/Helper/HelperInterface.php b/src/Symfony/Component/Templating/Helper/HelperInterface.php index ce67c4ac70..57c4b392e7 100644 --- a/src/Symfony/Component/Templating/Helper/HelperInterface.php +++ b/src/Symfony/Component/Templating/Helper/HelperInterface.php @@ -27,10 +27,8 @@ interface HelperInterface /** * Sets the default charset. - * - * @param string $charset The charset */ - public function setCharset($charset); + public function setCharset(string $charset); /** * Gets the default charset. diff --git a/src/Symfony/Component/Templating/Helper/SlotsHelper.php b/src/Symfony/Component/Templating/Helper/SlotsHelper.php index 80acdc93b6..0ccd511601 100644 --- a/src/Symfony/Component/Templating/Helper/SlotsHelper.php +++ b/src/Symfony/Component/Templating/Helper/SlotsHelper.php @@ -27,11 +27,9 @@ class SlotsHelper extends Helper * This method starts an output buffer that will be * closed when the stop() method is called. * - * @param string $name The slot name - * * @throws \InvalidArgumentException if a slot with the same name is already started */ - public function start($name) + public function start(string $name) { if (\in_array($name, $this->openSlots)) { throw new \InvalidArgumentException(sprintf('A slot named "%s" is already started.', $name)); @@ -63,11 +61,9 @@ class SlotsHelper extends Helper /** * Returns true if the slot exists. * - * @param string $name The slot name - * * @return bool */ - public function has($name) + public function has(string $name) { return isset($this->slots[$name]); } @@ -75,23 +71,19 @@ class SlotsHelper extends Helper /** * Gets the slot value. * - * @param string $name The slot name * @param bool|string $default The default slot content * * @return string The slot content */ - public function get($name, $default = false) + public function get(string $name, $default = false) { return isset($this->slots[$name]) ? $this->slots[$name] : $default; } /** * Sets a slot value. - * - * @param string $name The slot name - * @param string $content The slot content */ - public function set($name, $content) + public function set(string $name, string $content) { $this->slots[$name] = $content; } @@ -99,12 +91,11 @@ class SlotsHelper extends Helper /** * Outputs a slot. * - * @param string $name The slot name * @param bool|string $default The default slot content * * @return bool true if the slot is defined or if a default content has been provided, false otherwise */ - public function output($name, $default = false) + public function output(string $name, $default = false) { if (!isset($this->slots[$name])) { if (false !== $default) { diff --git a/src/Symfony/Component/Templating/Loader/CacheLoader.php b/src/Symfony/Component/Templating/Loader/CacheLoader.php index 0e00ef06f7..8d63a6729c 100644 --- a/src/Symfony/Component/Templating/Loader/CacheLoader.php +++ b/src/Symfony/Component/Templating/Loader/CacheLoader.php @@ -81,12 +81,11 @@ class CacheLoader extends Loader /** * Returns true if the template is still fresh. * - * @param TemplateReferenceInterface $template A template - * @param int $time The last modification time of the cached template (timestamp) + * @param int $time The last modification time of the cached template (timestamp) * * @return bool */ - public function isFresh(TemplateReferenceInterface $template, $time) + public function isFresh(TemplateReferenceInterface $template, int $time) { return $this->loader->isFresh($template, $time); } diff --git a/src/Symfony/Component/Templating/Loader/ChainLoader.php b/src/Symfony/Component/Templating/Loader/ChainLoader.php index 3e5f375cb7..c85fdedd90 100644 --- a/src/Symfony/Component/Templating/Loader/ChainLoader.php +++ b/src/Symfony/Component/Templating/Loader/ChainLoader.php @@ -60,12 +60,11 @@ class ChainLoader extends Loader /** * Returns true if the template is still fresh. * - * @param TemplateReferenceInterface $template A template - * @param int $time The last modification time of the cached template (timestamp) + * @param int $time The last modification time of the cached template (timestamp) * * @return bool */ - public function isFresh(TemplateReferenceInterface $template, $time) + public function isFresh(TemplateReferenceInterface $template, int $time) { foreach ($this->loaders as $loader) { return $loader->isFresh($template, $time); diff --git a/src/Symfony/Component/Templating/Loader/FilesystemLoader.php b/src/Symfony/Component/Templating/Loader/FilesystemLoader.php index 016018cf1b..66aa3ca77f 100644 --- a/src/Symfony/Component/Templating/Loader/FilesystemLoader.php +++ b/src/Symfony/Component/Templating/Loader/FilesystemLoader.php @@ -78,12 +78,11 @@ class FilesystemLoader extends Loader /** * Returns true if the template is still fresh. * - * @param TemplateReferenceInterface $template A template - * @param int $time The last modification time of the cached template (timestamp) + * @param int $time The last modification time of the cached template (timestamp) * * @return bool true if the template is still fresh, false otherwise */ - public function isFresh(TemplateReferenceInterface $template, $time) + public function isFresh(TemplateReferenceInterface $template, int $time) { if (false === $storage = $this->load($template)) { return false; @@ -95,11 +94,9 @@ class FilesystemLoader extends Loader /** * Returns true if the file is an existing absolute path. * - * @param string $file A path - * * @return bool true if the path exists and is absolute, false otherwise */ - protected static function isAbsolutePath($file) + protected static function isAbsolutePath(string $file) { if ('/' == $file[0] || '\\' == $file[0] || (\strlen($file) > 3 && ctype_alpha($file[0]) diff --git a/src/Symfony/Component/Templating/Loader/LoaderInterface.php b/src/Symfony/Component/Templating/Loader/LoaderInterface.php index 0deb231bc0..487fc49d7f 100644 --- a/src/Symfony/Component/Templating/Loader/LoaderInterface.php +++ b/src/Symfony/Component/Templating/Loader/LoaderInterface.php @@ -31,10 +31,9 @@ interface LoaderInterface /** * Returns true if the template is still fresh. * - * @param TemplateReferenceInterface $template A template - * @param int $time The last modification time of the cached template (timestamp) + * @param int $time The last modification time of the cached template (timestamp) * * @return bool */ - public function isFresh(TemplateReferenceInterface $template, $time); + public function isFresh(TemplateReferenceInterface $template, int $time); } diff --git a/src/Symfony/Component/Templating/PhpEngine.php b/src/Symfony/Component/Templating/PhpEngine.php index 9da98266b9..4442deded4 100644 --- a/src/Symfony/Component/Templating/PhpEngine.php +++ b/src/Symfony/Component/Templating/PhpEngine.php @@ -43,9 +43,7 @@ class PhpEngine implements EngineInterface, \ArrayAccess private $evalParameters; /** - * @param TemplateNameParserInterface $parser A TemplateNameParserInterface instance - * @param LoaderInterface $loader A loader instance - * @param HelperInterface[] $helpers An array of helper instances + * @param HelperInterface[] $helpers An array of helper instances */ public function __construct(TemplateNameParserInterface $parser, LoaderInterface $loader, array $helpers = []) { @@ -120,9 +118,6 @@ class PhpEngine implements EngineInterface, \ArrayAccess /** * Evaluates a template. * - * @param Storage $template The template to render - * @param array $parameters An array of parameters to pass to the template - * * @return string|false The evaluated template, or false if the engine is unable to render the template * * @throws \InvalidArgumentException @@ -241,11 +236,8 @@ class PhpEngine implements EngineInterface, \ArrayAccess /** * Sets a helper. - * - * @param HelperInterface $helper The helper instance - * @param string $alias An alias */ - public function set(HelperInterface $helper, $alias = null) + public function set(HelperInterface $helper, string $alias = null) { $this->helpers[$helper->getName()] = $helper; if (null !== $alias) { @@ -258,11 +250,9 @@ class PhpEngine implements EngineInterface, \ArrayAccess /** * Returns true if the helper if defined. * - * @param string $name The helper name - * * @return bool true if the helper is defined, false otherwise */ - public function has($name) + public function has(string $name) { return isset($this->helpers[$name]); } @@ -270,13 +260,11 @@ class PhpEngine implements EngineInterface, \ArrayAccess /** * Gets a helper value. * - * @param string $name The helper name - * * @return HelperInterface The helper instance * * @throws \InvalidArgumentException if the helper is not defined */ - public function get($name) + public function get(string $name) { if (!isset($this->helpers[$name])) { throw new \InvalidArgumentException(sprintf('The helper "%s" is not defined.', $name)); @@ -290,7 +278,7 @@ class PhpEngine implements EngineInterface, \ArrayAccess * * @param string $template The decorator logical name */ - public function extend($template) + public function extend(string $template) { $this->parents[$this->current] = $template; } @@ -298,12 +286,11 @@ class PhpEngine implements EngineInterface, \ArrayAccess /** * Escapes a string by using the current charset. * - * @param mixed $value A variable to escape - * @param string $context The context name + * @param mixed $value A variable to escape * * @return string The escaped value */ - public function escape($value, $context = 'html') + public function escape($value, string $context = 'html') { if (is_numeric($value)) { return $value; @@ -324,10 +311,8 @@ class PhpEngine implements EngineInterface, \ArrayAccess /** * Sets the charset to use. - * - * @param string $charset The charset */ - public function setCharset($charset) + public function setCharset(string $charset) { if ('UTF8' === $charset = strtoupper($charset)) { $charset = 'UTF-8'; // iconv on Windows requires "UTF-8" instead of "UTF8" @@ -351,11 +336,8 @@ class PhpEngine implements EngineInterface, \ArrayAccess /** * Adds an escaper for the given context. - * - * @param string $context The escaper context (html, js, ...) - * @param callable $escaper A PHP callable */ - public function setEscaper($context, callable $escaper) + public function setEscaper(string $context, callable $escaper) { $this->escapers[$context] = $escaper; self::$escaperCache[$context] = []; @@ -364,13 +346,11 @@ class PhpEngine implements EngineInterface, \ArrayAccess /** * Gets an escaper for a given context. * - * @param string $context The context name - * * @return callable A PHP callable * * @throws \InvalidArgumentException */ - public function getEscaper($context) + public function getEscaper(string $context) { if (!isset($this->escapers[$context])) { throw new \InvalidArgumentException(sprintf('No registered escaper for context "%s".', $context)); @@ -380,10 +360,9 @@ class PhpEngine implements EngineInterface, \ArrayAccess } /** - * @param string $name - * @param mixed $value + * @param mixed $value */ - public function addGlobal($name, $value) + public function addGlobal(string $name, $value) { $this->globals[$name] = $value; } diff --git a/src/Symfony/Component/Templating/TemplateReference.php b/src/Symfony/Component/Templating/TemplateReference.php index ddff4db857..ab370b2c29 100644 --- a/src/Symfony/Component/Templating/TemplateReference.php +++ b/src/Symfony/Component/Templating/TemplateReference.php @@ -39,7 +39,7 @@ class TemplateReference implements TemplateReferenceInterface /** * {@inheritdoc} */ - public function set($name, $value) + public function set(string $name, string $value) { if (\array_key_exists($name, $this->parameters)) { $this->parameters[$name] = $value; @@ -53,7 +53,7 @@ class TemplateReference implements TemplateReferenceInterface /** * {@inheritdoc} */ - public function get($name) + public function get(string $name) { if (\array_key_exists($name, $this->parameters)) { return $this->parameters[$name]; diff --git a/src/Symfony/Component/Templating/TemplateReferenceInterface.php b/src/Symfony/Component/Templating/TemplateReferenceInterface.php index 45d9421f6b..7f23fafae0 100644 --- a/src/Symfony/Component/Templating/TemplateReferenceInterface.php +++ b/src/Symfony/Component/Templating/TemplateReferenceInterface.php @@ -28,25 +28,20 @@ interface TemplateReferenceInterface /** * Sets a template parameter. * - * @param string $name The parameter name - * @param string $value The parameter value - * * @return $this * * @throws \InvalidArgumentException if the parameter name is not supported */ - public function set($name, $value); + public function set(string $name, string $value); /** * Gets a template parameter. * - * @param string $name The parameter name - * * @return string The parameter value * * @throws \InvalidArgumentException if the parameter name is not supported */ - public function get($name); + public function get(string $name); /** * Returns the path to the template. diff --git a/src/Symfony/Component/Templating/Tests/Loader/CacheLoaderTest.php b/src/Symfony/Component/Templating/Tests/Loader/CacheLoaderTest.php index e66d62398a..dfe1c328c4 100644 --- a/src/Symfony/Component/Templating/Tests/Loader/CacheLoaderTest.php +++ b/src/Symfony/Component/Templating/Tests/Loader/CacheLoaderTest.php @@ -87,7 +87,7 @@ class ProjectTemplateLoaderVar extends Loader return false; } - public function isFresh(TemplateReferenceInterface $template, $time) + public function isFresh(TemplateReferenceInterface $template, int $time) { return false; } diff --git a/src/Symfony/Component/Templating/Tests/Loader/LoaderTest.php b/src/Symfony/Component/Templating/Tests/Loader/LoaderTest.php index da8c04caa4..f9af71ee7a 100644 --- a/src/Symfony/Component/Templating/Tests/Loader/LoaderTest.php +++ b/src/Symfony/Component/Templating/Tests/Loader/LoaderTest.php @@ -42,7 +42,7 @@ class ProjectTemplateLoader4 extends Loader return $this->debugger; } - public function isFresh(TemplateReferenceInterface $template, $time) + public function isFresh(TemplateReferenceInterface $template, int $time) { return false; } diff --git a/src/Symfony/Component/Templating/Tests/PhpEngineTest.php b/src/Symfony/Component/Templating/Tests/PhpEngineTest.php index 5b62100035..4c7e747e6e 100644 --- a/src/Symfony/Component/Templating/Tests/PhpEngineTest.php +++ b/src/Symfony/Component/Templating/Tests/PhpEngineTest.php @@ -219,7 +219,7 @@ class ProjectTemplateLoader extends Loader return false; } - public function isFresh(TemplateReferenceInterface $template, $time) + public function isFresh(TemplateReferenceInterface $template, int $time) { return false; }