From 81699ca6ca1ed61f276ee29f00d9d3d5c6fc6095 Mon Sep 17 00:00:00 2001 From: Fabien Potencier Date: Wed, 16 Apr 2014 09:47:00 +0200 Subject: [PATCH] made types consistent with the ones of Hack --- lib/Twig/Autoloader.php | 2 +- lib/Twig/Compiler.php | 6 ++-- lib/Twig/Environment.php | 14 +++++----- lib/Twig/Error.php | 6 ++-- lib/Twig/ExistsLoaderInterface.php | 2 +- lib/Twig/ExpressionParser.php | 4 +- lib/Twig/Extension/Core.php | 48 ++++++++++++++++++------------------ lib/Twig/LoaderInterface.php | 2 +- lib/Twig/Node.php | 6 ++-- lib/Twig/Node/Include.php | 2 +- lib/Twig/NodeVisitor/Optimizer.php | 2 +- lib/Twig/NodeVisitorInterface.php | 2 +- lib/Twig/Template.php | 12 ++++---- lib/Twig/Token.php | 18 ++++++------ lib/Twig/TokenStream.php | 6 ++-- 15 files changed, 66 insertions(+), 66 deletions(-) diff --git a/lib/Twig/Autoloader.php b/lib/Twig/Autoloader.php index 0ae1127..42f16f0 100644 --- a/lib/Twig/Autoloader.php +++ b/lib/Twig/Autoloader.php @@ -19,7 +19,7 @@ class Twig_Autoloader /** * Registers Twig_Autoloader as an SPL autoloader. * - * @param Boolean $prepend Whether to prepend the autoloader or not. + * @param bool $prepend Whether to prepend the autoloader or not. */ public static function register($prepend = false) { diff --git a/lib/Twig/Compiler.php b/lib/Twig/Compiler.php index bb6b129..ee00519 100644 --- a/lib/Twig/Compiler.php +++ b/lib/Twig/Compiler.php @@ -66,7 +66,7 @@ class Twig_Compiler implements Twig_CompilerInterface * Compiles a node. * * @param Twig_NodeInterface $node The node to compile - * @param integer $indentation The current indentation + * @param int $indentation The current indentation * * @return Twig_Compiler The current compiler instance */ @@ -236,7 +236,7 @@ class Twig_Compiler implements Twig_CompilerInterface /** * Indents the generated code. * - * @param integer $step The number of indentation to add + * @param int $step The number of indentation to add * * @return Twig_Compiler The current compiler instance */ @@ -250,7 +250,7 @@ class Twig_Compiler implements Twig_CompilerInterface /** * Outdents the generated code. * - * @param integer $step The number of indentation to remove + * @param int $step The number of indentation to remove * * @return Twig_Compiler The current compiler instance * diff --git a/lib/Twig/Environment.php b/lib/Twig/Environment.php index 3c29c4d..636aa89 100644 --- a/lib/Twig/Environment.php +++ b/lib/Twig/Environment.php @@ -154,7 +154,7 @@ class Twig_Environment /** * Checks if debug mode is enabled. * - * @return Boolean true if debug mode is enabled, false otherwise + * @return bool true if debug mode is enabled, false otherwise */ public function isDebug() { @@ -180,7 +180,7 @@ class Twig_Environment /** * Checks if the auto_reload option is enabled. * - * @return Boolean true if auto_reload is enabled, false otherwise + * @return bool true if auto_reload is enabled, false otherwise */ public function isAutoReload() { @@ -206,7 +206,7 @@ class Twig_Environment /** * Checks if the strict_variables option is enabled. * - * @return Boolean true if strict_variables is enabled, false otherwise + * @return bool true if strict_variables is enabled, false otherwise */ public function isStrictVariables() { @@ -256,7 +256,7 @@ class Twig_Environment * Gets the template class associated with the given string. * * @param string $name The name for which to calculate the template class name - * @param integer $index The index if it is an embedded template + * @param int $index The index if it is an embedded template * * @return string The template class name */ @@ -311,7 +311,7 @@ class Twig_Environment * Loads a template by name. * * @param string $name The template name - * @param integer $index The index if it is an embedded template + * @param int $index The index if it is an embedded template * * @return Twig_TemplateInterface A template instance representing the given template name * @@ -355,7 +355,7 @@ class Twig_Environment * @param string $name The template name * @param timestamp $time The last modification time of the cached template * - * @return Boolean true if the template is fresh, false otherwise + * @return bool true if the template is fresh, false otherwise */ public function isTemplateFresh($name, $time) { @@ -626,7 +626,7 @@ class Twig_Environment * * @param string $name The extension name * - * @return Boolean Whether the extension is registered or not + * @return bool Whether the extension is registered or not */ public function hasExtension($name) { diff --git a/lib/Twig/Error.php b/lib/Twig/Error.php index 914b3ed..6772887 100644 --- a/lib/Twig/Error.php +++ b/lib/Twig/Error.php @@ -51,7 +51,7 @@ class Twig_Error extends Exception * By default, automatic guessing is enabled. * * @param string $message The error message - * @param integer $lineno The template line where the error occurred + * @param int $lineno The template line where the error occurred * @param string $filename The template file name where the error occurred * @param Exception $previous The previous exception */ @@ -111,7 +111,7 @@ class Twig_Error extends Exception /** * Gets the template line where the error occurred. * - * @return integer The template line + * @return int The template line */ public function getTemplateLine() { @@ -121,7 +121,7 @@ class Twig_Error extends Exception /** * Sets the template line where the error occurred. * - * @param integer $lineno The template line + * @param int $lineno The template line */ public function setTemplateLine($lineno) { diff --git a/lib/Twig/ExistsLoaderInterface.php b/lib/Twig/ExistsLoaderInterface.php index da05a54..de4dff7 100644 --- a/lib/Twig/ExistsLoaderInterface.php +++ b/lib/Twig/ExistsLoaderInterface.php @@ -22,7 +22,7 @@ interface Twig_ExistsLoaderInterface * * @param string $name The name of the template to check if we can load * - * @return Boolean If the template source code is handled by this loader or not + * @return bool If the template source code is handled by this loader or not */ public function exists($name); } diff --git a/lib/Twig/ExpressionParser.php b/lib/Twig/ExpressionParser.php index 25f47a1..01594f7 100644 --- a/lib/Twig/ExpressionParser.php +++ b/lib/Twig/ExpressionParser.php @@ -451,8 +451,8 @@ class Twig_ExpressionParser /** * Parses arguments. * - * @param Boolean $namedArguments Whether to allow named arguments or not - * @param Boolean $definition Whether we are parsing arguments for a function definition + * @param bool $namedArguments Whether to allow named arguments or not + * @param bool $definition Whether we are parsing arguments for a function definition */ public function parseArguments($namedArguments = false, $definition = false) { diff --git a/lib/Twig/Extension/Core.php b/lib/Twig/Extension/Core.php index 922b5ea..8b2c6fc 100644 --- a/lib/Twig/Extension/Core.php +++ b/lib/Twig/Extension/Core.php @@ -95,7 +95,7 @@ class Twig_Extension_Core extends Twig_Extension /** * Sets the default format to be used by the number_format filter. * - * @param integer $decimal The number of decimal places to use. + * @param int $decimal The number of decimal places to use. * @param string $decimalPoint The character(s) to use for the decimal point. * @param string $thousandSep The character(s) to use for the thousands separator. */ @@ -357,7 +357,7 @@ class Twig_Extension_Core extends Twig_Extension * Cycles over a value. * * @param ArrayAccess|array $values An array or an ArrayAccess instance - * @param integer $position The cycle position + * @param int $position The cycle position * * @return string The next value in the cycle */ @@ -377,7 +377,7 @@ function twig_cycle($values, $position) * - a random integer between 0 and the integer parameter * * @param Twig_Environment $env A Twig_Environment instance - * @param Traversable|array|integer|string $values The values to pick a random item from + * @param Traversable|array|int|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). * @@ -534,11 +534,11 @@ function twig_date_converter(Twig_Environment $env, $date = null, $timezone = nu /** * Rounds a number. * - * @param integer|float $value The value to round - * @param integer|float $precision The rounding precision + * @param int|float $value The value to round + * @param int|float $precision The rounding precision * @param string $method The method to use for rounding * - * @return integer|float The rounded number + * @return int|float The rounded number */ function twig_round($value, $precision = 0, $method = 'common') { @@ -562,7 +562,7 @@ function twig_round($value, $precision = 0, $method = 'common') * * @param Twig_Environment $env A Twig_Environment instance * @param mixed $number A float/int/string of the number to format - * @param integer $decimal The number of decimal points to display. + * @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. * @@ -590,7 +590,7 @@ function twig_number_format_filter(Twig_Environment $env, $number, $decimal = nu * URL encodes a string as a path segment or an array as a query string. * * @param string|array $url A URL or an array of query parameters - * @param Boolean $raw true to use rawurlencode() instead of urlencode + * @param bool $raw true to use rawurlencode() instead of urlencode * * @return string The URL encoded value */ @@ -612,7 +612,7 @@ if (version_compare(PHP_VERSION, '5.3.0', '<')) { * JSON encodes a variable. * * @param mixed $value The value to encode. - * @param integer $options Not used on PHP 5.2.x + * @param int $options Not used on PHP 5.2.x * * @return mixed The JSON encoded value */ @@ -631,7 +631,7 @@ if (version_compare(PHP_VERSION, '5.3.0', '<')) { * JSON encodes a variable. * * @param mixed $value The value to encode. - * @param integer $options Bitmask consisting of JSON_HEX_QUOT, JSON_HEX_TAG, JSON_HEX_AMP, JSON_HEX_APOS, JSON_NUMERIC_CHECK, JSON_PRETTY_PRINT, JSON_UNESCAPED_SLASHES, JSON_FORCE_OBJECT + * @param int $options Bitmask consisting of JSON_HEX_QUOT, JSON_HEX_TAG, JSON_HEX_AMP, JSON_HEX_APOS, JSON_NUMERIC_CHECK, JSON_PRETTY_PRINT, JSON_UNESCAPED_SLASHES, JSON_FORCE_OBJECT * * @return mixed The JSON encoded value */ @@ -684,9 +684,9 @@ function twig_array_merge($arr1, $arr2) * * @param Twig_Environment $env A Twig_Environment instance * @param mixed $item A variable - * @param integer $start Start of the slice - * @param integer $length Size of the slice - * @param Boolean $preserveKeys Whether to preserve key or not (when the input is an array) + * @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 */ @@ -785,7 +785,7 @@ function twig_join_filter($value, $glue = '') * * @param string $value A string * @param string $delimiter The delimiter - * @param integer $limit The limit + * @param int $limit The limit * * @return array The split string as an array */ @@ -843,7 +843,7 @@ function twig_get_array_keys_filter($array) * * @param Twig_Environment $env A Twig_Environment instance * @param array|Traversable|string $item An array, a Traversable instance, or a string - * @param Boolean $preserveKeys Whether to preserve key or not + * @param bool $preserveKeys Whether to preserve key or not * * @return mixed The reversed input */ @@ -915,7 +915,7 @@ function twig_in_filter($value, $compare) * @param string $string The value to be escaped * @param string $strategy The escaping strategy * @param string $charset The charset - * @param Boolean $autoescape Whether the function is called by the auto-escaping feature (true) or by the developer (false) + * @param bool $autoescape Whether the function is called by the auto-escaping feature (true) or by the developer (false) */ function twig_escape_filter(Twig_Environment $env, $string, $strategy = 'html', $charset = null, $autoescape = false) { @@ -1192,7 +1192,7 @@ if (function_exists('mb_get_info')) { * @param Twig_Environment $env A Twig_Environment instance * @param mixed $thing A variable * - * @return integer The length of the value + * @return int The length of the value */ function twig_length_filter(Twig_Environment $env, $thing) { @@ -1276,7 +1276,7 @@ else { * @param Twig_Environment $env A Twig_Environment instance * @param mixed $thing A variable * - * @return integer The length of the value + * @return int The length of the value */ function twig_length_filter(Twig_Environment $env, $thing) { @@ -1332,7 +1332,7 @@ function twig_ensure_traversable($seq) * * @param mixed $value A variable * - * @return Boolean true if the value is empty, false otherwise + * @return bool true if the value is empty, false otherwise */ function twig_test_empty($value) { @@ -1355,7 +1355,7 @@ function twig_test_empty($value) * * @param mixed $value A variable * - * @return Boolean true if the value is traversable + * @return bool true if the value is traversable */ function twig_test_iterable($value) { @@ -1367,9 +1367,9 @@ function twig_test_iterable($value) * * @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 Boolean $with_context Whether to pass the current context variables or not - * @param Boolean $ignore_missing Whether to ignore missing templates or not - * @param Boolean $sandboxed Whether to sandbox the template or not + * @param bool $with_context Whether to pass the current context variables or not + * @param bool $ignore_missing Whether to ignore missing templates or not + * @param bool $sandboxed Whether to sandbox the template or not * * @return string The rendered template */ @@ -1434,7 +1434,7 @@ function twig_constant($constant, $object = null) * Batches item. * * @param array $items An array of items - * @param integer $size The size of the batch + * @param int $size The size of the batch * @param mixed $fill A value used to fill missing items * * @return array diff --git a/lib/Twig/LoaderInterface.php b/lib/Twig/LoaderInterface.php index 927786d..4405291 100644 --- a/lib/Twig/LoaderInterface.php +++ b/lib/Twig/LoaderInterface.php @@ -44,7 +44,7 @@ interface Twig_LoaderInterface * @param string $name The template name * @param timestamp $time The last modification time of the cached template * - * @return Boolean true if the template is fresh, false otherwise + * @return bool true if the template is fresh, false otherwise * * @throws Twig_Error_Loader When $name is not found */ diff --git a/lib/Twig/Node.php b/lib/Twig/Node.php index 931b463..978e766 100644 --- a/lib/Twig/Node.php +++ b/lib/Twig/Node.php @@ -30,7 +30,7 @@ class Twig_Node implements Twig_NodeInterface * * @param array $nodes An array of named nodes * @param array $attributes An array of attributes (should not be nodes) - * @param integer $lineno The line number + * @param int $lineno The line number * @param string $tag The tag name associated with the Node */ public function __construct(array $nodes = array(), array $attributes = array(), $lineno = 0, $tag = null) @@ -121,7 +121,7 @@ class Twig_Node implements Twig_NodeInterface * * @param string The attribute name * - * @return Boolean true if the attribute is defined, false otherwise + * @return bool true if the attribute is defined, false otherwise */ public function hasAttribute($name) { @@ -170,7 +170,7 @@ class Twig_Node implements Twig_NodeInterface * * @param string The node name * - * @return Boolean true if the node with the given name exists, false otherwise + * @return bool true if the node with the given name exists, false otherwise */ public function hasNode($name) { diff --git a/lib/Twig/Node/Include.php b/lib/Twig/Node/Include.php index ed4a375..860aedf 100644 --- a/lib/Twig/Node/Include.php +++ b/lib/Twig/Node/Include.php @@ -19,7 +19,7 @@ class Twig_Node_Include extends Twig_Node implements Twig_NodeOutputInterface { public function __construct(Twig_Node_Expression $expr, Twig_Node_Expression $variables = null, $only = false, $ignoreMissing = false, $lineno, $tag = null) { - parent::__construct(array('expr' => $expr, 'variables' => $variables), array('only' => (Boolean) $only, 'ignore_missing' => (Boolean) $ignoreMissing), $lineno, $tag); + parent::__construct(array('expr' => $expr, 'variables' => $variables), array('only' => (bool) $only, 'ignore_missing' => (bool) $ignoreMissing), $lineno, $tag); } /** diff --git a/lib/Twig/NodeVisitor/Optimizer.php b/lib/Twig/NodeVisitor/Optimizer.php index 5bf8eb0..06f69db 100644 --- a/lib/Twig/NodeVisitor/Optimizer.php +++ b/lib/Twig/NodeVisitor/Optimizer.php @@ -35,7 +35,7 @@ class Twig_NodeVisitor_Optimizer implements Twig_NodeVisitorInterface /** * Constructor. * - * @param integer $optimizers The optimizer mode + * @param int $optimizers The optimizer mode */ public function __construct($optimizers = -1) { diff --git a/lib/Twig/NodeVisitorInterface.php b/lib/Twig/NodeVisitorInterface.php index f33c13f..608aded 100644 --- a/lib/Twig/NodeVisitorInterface.php +++ b/lib/Twig/NodeVisitorInterface.php @@ -41,7 +41,7 @@ interface Twig_NodeVisitorInterface * * Priority should be between -10 and 10 (0 is the default). * - * @return integer The priority level + * @return int The priority level */ public function getPriority(); } diff --git a/lib/Twig/Template.php b/lib/Twig/Template.php index 1fe203f..55c1cdb 100644 --- a/lib/Twig/Template.php +++ b/lib/Twig/Template.php @@ -122,7 +122,7 @@ abstract class Twig_Template implements Twig_TemplateInterface * @param string $name The block name to display * @param array $context The context * @param array $blocks The current set of blocks - * @param Boolean $useBlocks Whether to use the current set of blocks + * @param bool $useBlocks Whether to use the current set of blocks */ public function displayBlock($name, array $context, array $blocks = array(), $useBlocks = true) { @@ -181,7 +181,7 @@ abstract class Twig_Template implements Twig_TemplateInterface * @param string $name The block name to render * @param array $context The context * @param array $blocks The current set of blocks - * @param Boolean $useBlocks Whether to use the current set of blocks + * @param bool $useBlocks Whether to use the current set of blocks * * @return string The rendered block */ @@ -208,7 +208,7 @@ abstract class Twig_Template implements Twig_TemplateInterface * * @param string $name The block name * - * @return Boolean true if the block exists, false otherwise + * @return bool true if the block exists, false otherwise */ public function hasBlock($name) { @@ -316,7 +316,7 @@ abstract class Twig_Template implements Twig_TemplateInterface * * @param array $context The context * @param string $item The variable to return from the context - * @param Boolean $ignoreStrictCheck Whether to ignore the strict variable check or not + * @param bool $ignoreStrictCheck Whether to ignore the strict variable check or not * * @return The content of the context variable * @@ -342,8 +342,8 @@ abstract class Twig_Template implements Twig_TemplateInterface * @param mixed $item The item to get from the array or object * @param array $arguments An array of arguments to pass if the item is an object method * @param string $type The type of attribute (@see Twig_Template constants) - * @param Boolean $isDefinedTest Whether this is only a defined check - * @param Boolean $ignoreStrictCheck Whether to ignore the strict attribute check or not + * @param bool $isDefinedTest Whether this is only a defined check + * @param bool $ignoreStrictCheck Whether to ignore the strict attribute check or not * * @return mixed The attribute value, or a Boolean when $isDefinedTest is true, or null when the attribute is not set and $ignoreStrictCheck is true * diff --git a/lib/Twig/Token.php b/lib/Twig/Token.php index 4411d7b..599f9f5 100644 --- a/lib/Twig/Token.php +++ b/lib/Twig/Token.php @@ -38,9 +38,9 @@ class Twig_Token /** * Constructor. * - * @param integer $type The type of the token + * @param int $type The type of the token * @param string $value The token value - * @param integer $lineno The line position in the source + * @param int $lineno The line position in the source */ public function __construct($type, $value, $lineno) { @@ -67,10 +67,10 @@ class Twig_Token * * type and value (or array of possible values) * * just value (or array of possible values) (NAME_TYPE is used as type) * - * @param array|integer $type The type to test + * @param array|int $type The type to test * @param array|string|null $values The token value * - * @return Boolean + * @return bool */ public function test($type, $values = null) { @@ -89,7 +89,7 @@ class Twig_Token /** * Gets the line. * - * @return integer The source line + * @return int The source line */ public function getLine() { @@ -99,7 +99,7 @@ class Twig_Token /** * Gets the token type. * - * @return integer The token type + * @return int The token type */ public function getType() { @@ -119,8 +119,8 @@ class Twig_Token /** * Returns the constant representation (internal) of a given type. * - * @param integer $type The type as an integer - * @param Boolean $short Whether to return a short representation or not + * @param int $type The type as an integer + * @param bool $short Whether to return a short representation or not * * @return string The string representation */ @@ -176,7 +176,7 @@ class Twig_Token /** * Returns the english representation of a given type. * - * @param integer $type The type as an integer + * @param int $type The type as an integer * * @return string The string representation */ diff --git a/lib/Twig/TokenStream.php b/lib/Twig/TokenStream.php index 22f0428..44440da 100644 --- a/lib/Twig/TokenStream.php +++ b/lib/Twig/TokenStream.php @@ -101,7 +101,7 @@ class Twig_TokenStream /** * Looks at the next token. * - * @param integer $number + * @param int $number * * @return Twig_Token */ @@ -117,7 +117,7 @@ class Twig_TokenStream /** * Tests the current token * - * @return Boolean + * @return bool */ public function test($primary, $secondary = null) { @@ -127,7 +127,7 @@ class Twig_TokenStream /** * Checks if end of stream was reached * - * @return Boolean + * @return bool */ public function isEOF() { -- 1.7.2.5