From ceb3c93e28df1c0d6bb789cfdc5fc09fa5631c26 Mon Sep 17 00:00:00 2001 From: Fabien Potencier Date: Fri, 15 Feb 2019 04:20:04 +0100 Subject: [PATCH] simplified some phpdocs --- lib/Twig/Compiler.php | 3 +- lib/Twig/Environment.php | 3 - lib/Twig/Extension/Core.php | 91 +++++++++++------------------ lib/Twig/Extension/StringLoader.php | 3 +- lib/Twig/NodeTraverser.php | 1 - 5 files changed, 37 insertions(+), 64 deletions(-) diff --git a/lib/Twig/Compiler.php b/lib/Twig/Compiler.php index a5a603010..3b8fd5b05 100644 --- a/lib/Twig/Compiler.php +++ b/lib/Twig/Compiler.php @@ -65,8 +65,7 @@ class Twig_Compiler implements Twig_CompilerInterface /** * Compiles a node. * - * @param Twig_NodeInterface $node The node to compile - * @param int $indentation The current indentation + * @param int $indentation The current indentation * * @return $this */ diff --git a/lib/Twig/Environment.php b/lib/Twig/Environment.php index 7cc75015f..405cac208 100644 --- a/lib/Twig/Environment.php +++ b/lib/Twig/Environment.php @@ -94,9 +94,6 @@ class Twig_Environment * * optimizations: A flag that indicates which optimizations to apply * (default to -1 which means that all optimizations are enabled; * set it to 0 to disable). - * - * @param Twig_LoaderInterface $loader - * @param array $options An array of options */ public function __construct(Twig_LoaderInterface $loader = null, $options = []) { diff --git a/lib/Twig/Extension/Core.php b/lib/Twig/Extension/Core.php index 72339b901..8be919850 100644 --- a/lib/Twig/Extension/Core.php +++ b/lib/Twig/Extension/Core.php @@ -300,7 +300,6 @@ function twig_cycle($values, $position) * - a random character from a string * - a random integer between 0 and the integer parameter. * - * @param Twig_Environment $env * @param Traversable|array|int|float|string $values The values to pick a random item from * * @throws Twig_Error_Runtime when $values is an empty array (does not apply to an empty string which is returned as is) @@ -358,7 +357,6 @@ function twig_random(Twig_Environment $env, $values = null) * * {{ post.published_at|date("m/d/Y") }} * - * @param Twig_Environment $env * @param DateTime|DateTimeInterface|DateInterval|string $date A date * @param string|null $format The target format, null to use the default * @param DateTimeZone|string|false|null $timezone The target timezone, null to use the default, false to leave unchanged @@ -384,9 +382,8 @@ function twig_date_format_filter(Twig_Environment $env, $date, $format = null, $ * * {{ post.published_at|date_modify("-1day")|date("m/d/Y") }} * - * @param Twig_Environment $env - * @param DateTime|string $date A date - * @param string $modifier A modifier string + * @param DateTime|string $date A date + * @param string $modifier A modifier string * * @return DateTime A new date object */ @@ -408,7 +405,6 @@ function twig_date_modify_filter(Twig_Environment $env, $date, $modifier) * {# do something #} * {% endif %} * - * @param Twig_Environment $env * @param DateTime|DateTimeInterface|string|null $date A date * @param DateTimeZone|string|false|null $timezone The target timezone, null to use the default, false to leave unchanged * @@ -510,11 +506,10 @@ function twig_round($value, $precision = 0, $method = 'common') * be used. Supplying any of the parameters will override the defaults set in the * environment object. * - * @param Twig_Environment $env - * @param mixed $number A float/int/string of the number to format - * @param int $decimal the number of decimal points to display - * @param string $decimalPoint the character(s) to use for the decimal point - * @param string $thousandSep the character(s) to use for the thousands separator + * @param mixed $number A float/int/string of the number to format + * @param int $decimal the number of decimal points to display + * @param string $decimalPoint the character(s) to use for the decimal point + * @param string $thousandSep the character(s) to use for the thousands separator * * @return string The formatted number */ @@ -616,11 +611,10 @@ function twig_array_merge($arr1, $arr2) /** * Slices a variable. * - * @param Twig_Environment $env - * @param mixed $item A variable - * @param int $start Start of the slice - * @param int $length Size of the slice - * @param bool $preserveKeys Whether to preserve key or not (when the input is an array) + * @param mixed $item A variable + * @param int $start Start of the slice + * @param int $length Size of the slice + * @param bool $preserveKeys Whether to preserve key or not (when the input is an array) * * @return mixed The sliced variable */ @@ -658,8 +652,7 @@ function twig_slice(Twig_Environment $env, $item, $start, $length = null, $prese /** * Returns the first element of the item. * - * @param Twig_Environment $env - * @param mixed $item A variable + * @param mixed $item A variable * * @return mixed The first element of the item */ @@ -673,8 +666,7 @@ function twig_first(Twig_Environment $env, $item) /** * Returns the last element of the item. * - * @param Twig_Environment $env - * @param mixed $item A variable + * @param mixed $item A variable * * @return mixed The last element of the item */ @@ -744,10 +736,9 @@ function twig_join_filter($value, $glue = '', $and = null) * {{ "aabbcc"|split('', 2) }} * {# returns [aa, bb, cc] #} * - * @param Twig_Environment $env - * @param string $value A string - * @param string $delimiter The delimiter - * @param int $limit The limit + * @param string $value A string + * @param string $delimiter The delimiter + * @param int $limit The limit * * @return array The split string as an array */ @@ -842,7 +833,6 @@ function twig_get_array_keys_filter($array) /** * Reverses a variable. * - * @param Twig_Environment $env * @param array|Traversable|string $item An array, a Traversable instance, or a string * @param bool $preserveKeys Whether to preserve key or not * @@ -957,11 +947,10 @@ function twig_trim_filter($string, $characterMask = null, $side = 'both') /** * Escapes a string. * - * @param Twig_Environment $env - * @param mixed $string The value to be escaped - * @param string $strategy The escaping strategy - * @param string $charset The charset - * @param bool $autoescape Whether the function is called by the auto-escaping feature (true) or by the developer (false) + * @param mixed $string The value to be escaped + * @param string $strategy The escaping strategy + * @param string $charset The charset + * @param bool $autoescape Whether the function is called by the auto-escaping feature (true) or by the developer (false) * * @return string */ @@ -1253,8 +1242,7 @@ if (function_exists('mb_get_info')) { /** * Returns the length of a variable. * - * @param Twig_Environment $env - * @param mixed $thing A variable + * @param mixed $thing A variable * * @return int The length of the value */ @@ -1290,8 +1278,7 @@ if (function_exists('mb_get_info')) { /** * Converts a string to uppercase. * - * @param Twig_Environment $env - * @param string $string A string + * @param string $string A string * * @return string The uppercased string */ @@ -1307,8 +1294,7 @@ if (function_exists('mb_get_info')) { /** * Converts a string to lowercase. * - * @param Twig_Environment $env - * @param string $string A string + * @param string $string A string * * @return string The lowercased string */ @@ -1324,8 +1310,7 @@ if (function_exists('mb_get_info')) { /** * Returns a titlecased string. * - * @param Twig_Environment $env - * @param string $string A string + * @param string $string A string * * @return string The titlecased string */ @@ -1341,8 +1326,7 @@ if (function_exists('mb_get_info')) { /** * Returns a capitalized string. * - * @param Twig_Environment $env - * @param string $string A string + * @param string $string A string * * @return string The capitalized string */ @@ -1360,8 +1344,7 @@ else { /** * Returns the length of a variable. * - * @param Twig_Environment $env - * @param mixed $thing A variable + * @param mixed $thing A variable * * @return int The length of the value */ @@ -1397,8 +1380,7 @@ else { /** * Returns a titlecased string. * - * @param Twig_Environment $env - * @param string $string A string + * @param string $string A string * * @return string The titlecased string */ @@ -1410,8 +1392,7 @@ else { /** * Returns a capitalized string. * - * @param Twig_Environment $env - * @param string $string A string + * @param string $string A string * * @return string The capitalized string */ @@ -1478,13 +1459,12 @@ function twig_test_iterable($value) /** * Renders a template. * - * @param Twig_Environment $env - * @param array $context - * @param string|array $template The template to render or an array of templates to try consecutively - * @param array $variables The variables to pass to the template - * @param bool $withContext - * @param bool $ignoreMissing Whether to ignore missing templates or not - * @param bool $sandboxed Whether to sandbox the template or not + * @param array $context + * @param string|array $template The template to render or an array of templates to try consecutively + * @param array $variables The variables to pass to the template + * @param bool $withContext + * @param bool $ignoreMissing Whether to ignore missing templates or not + * @param bool $sandboxed Whether to sandbox the template or not * * @return string The rendered template */ @@ -1538,9 +1518,8 @@ function twig_include(Twig_Environment $env, $context, $template, $variables = [ /** * Returns a template content without rendering it. * - * @param Twig_Environment $env - * @param string $name The template name - * @param bool $ignoreMissing Whether to ignore missing templates or not + * @param string $name The template name + * @param bool $ignoreMissing Whether to ignore missing templates or not * * @return string The template source */ diff --git a/lib/Twig/Extension/StringLoader.php b/lib/Twig/Extension/StringLoader.php index 29cfd2022..0423bcd0d 100644 --- a/lib/Twig/Extension/StringLoader.php +++ b/lib/Twig/Extension/StringLoader.php @@ -32,8 +32,7 @@ class Twig_Extension_StringLoader extends Twig_Extension * * {{ include(template_from_string("Hello {{ name }}")) }} * - * @param Twig_Environment $env A Twig_Environment instance - * @param string $template A template as a string or object implementing __toString() + * @param string $template A template as a string or object implementing __toString() * * @return Twig_Template */ diff --git a/lib/Twig/NodeTraverser.php b/lib/Twig/NodeTraverser.php index 7f80e76b9..4b37b5c22 100644 --- a/lib/Twig/NodeTraverser.php +++ b/lib/Twig/NodeTraverser.php @@ -24,7 +24,6 @@ class Twig_NodeTraverser protected $visitors = []; /** - * @param Twig_Environment $env * @param Twig_NodeVisitorInterface[] $visitors */ public function __construct(Twig_Environment $env, array $visitors = [])