@@ -48,6 +48,9 @@ |
||
| 48 | 48 | } |
| 49 | 49 | } |
| 50 | 50 | |
| 51 | + /** |
|
| 52 | + * @param string $plainTextPassword |
|
| 53 | + */ |
|
| 51 | 54 | private static function pwCheck($plainTextPassword, $storedPassword) |
| 52 | 55 | { |
| 53 | 56 | if (!password_verify($plainTextPassword, $storedPassword)) |
@@ -108,6 +108,9 @@ |
||
| 108 | 108 | return (substr($haystack, 0, $length) === $needle); |
| 109 | 109 | } |
| 110 | 110 | |
| 111 | + /** |
|
| 112 | + * @param string $needle |
|
| 113 | + */ |
|
| 111 | 114 | public static function endsWith($haystack, $needle) |
| 112 | 115 | { |
| 113 | 116 | return substr($haystack, -strlen($needle)) === $needle; |
@@ -341,6 +341,10 @@ |
||
| 341 | 341 | return $file; |
| 342 | 342 | } |
| 343 | 343 | |
| 344 | + /** |
|
| 345 | + * @param string $class |
|
| 346 | + * @param string $ext |
|
| 347 | + */ |
|
| 344 | 348 | private function findFileWithExtension($class, $ext) |
| 345 | 349 | { |
| 346 | 350 | // PSR-4 lookup |
@@ -351,9 +351,8 @@ discard block |
||
| 351 | 351 | * |
| 352 | 352 | * This method should not be used as a generic way to load templates. |
| 353 | 353 | * |
| 354 | - * @param string $name The template name |
|
| 355 | - * @param int $index The index if it is an embedded template |
|
| 356 | 354 | * |
| 355 | + * @param string $template |
|
| 357 | 356 | * @return Twig_Template A template instance representing the given template name |
| 358 | 357 | * |
| 359 | 358 | * @throws Twig_Error_Loader When the template cannot be found |
@@ -964,7 +963,7 @@ discard block |
||
| 964 | 963 | /** |
| 965 | 964 | * Registers a Function. |
| 966 | 965 | * |
| 967 | - * @param string|Twig_SimpleFunction $name The function name or a Twig_SimpleFunction instance |
|
| 966 | + * @param Twig_SimpleFunction $name The function name or a Twig_SimpleFunction instance |
|
| 968 | 967 | * @param Twig_FunctionInterface|Twig_SimpleFunction $function A Twig_FunctionInterface instance or a Twig_SimpleFunction instance |
| 969 | 968 | */ |
| 970 | 969 | public function addFunction($name, $function = null) |
@@ -1057,7 +1056,7 @@ discard block |
||
| 1057 | 1056 | * but after, you can only update existing globals. |
| 1058 | 1057 | * |
| 1059 | 1058 | * @param string $name The global name |
| 1060 | - * @param mixed $value The global value |
|
| 1059 | + * @param string $value The global value |
|
| 1061 | 1060 | */ |
| 1062 | 1061 | public function addGlobal($name, $value) |
| 1063 | 1062 | { |
@@ -1147,6 +1146,9 @@ discard block |
||
| 1147 | 1146 | return $this->binaryOperators; |
| 1148 | 1147 | } |
| 1149 | 1148 | |
| 1149 | + /** |
|
| 1150 | + * @param integer[] $items |
|
| 1151 | + */ |
|
| 1150 | 1152 | public function computeAlternatives($name, $items) |
| 1151 | 1153 | { |
| 1152 | 1154 | $alternatives = array(); |
@@ -1264,6 +1266,10 @@ discard block |
||
| 1264 | 1266 | } |
| 1265 | 1267 | } |
| 1266 | 1268 | |
| 1269 | + /** |
|
| 1270 | + * @param string $file |
|
| 1271 | + * @param string $content |
|
| 1272 | + */ |
|
| 1267 | 1273 | protected function writeCacheFile($file, $content) |
| 1268 | 1274 | { |
| 1269 | 1275 | $dir = dirname($file); |
@@ -115,6 +115,9 @@ discard block |
||
| 115 | 115 | return $token->test(Twig_Token::OPERATOR_TYPE) && isset($this->binaryOperators[$token->getValue()]); |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | + /** |
|
| 119 | + * @return Twig_NodeInterface |
|
| 120 | + */ |
|
| 118 | 121 | public function parsePrimaryExpression() |
| 119 | 122 | { |
| 120 | 123 | $token = $this->parser->getCurrentToken(); |
@@ -311,6 +314,10 @@ discard block |
||
| 311 | 314 | return $node; |
| 312 | 315 | } |
| 313 | 316 | |
| 317 | + /** |
|
| 318 | + * @param string $name |
|
| 319 | + * @param integer $line |
|
| 320 | + */ |
|
| 314 | 321 | public function getFunctionNode($name, $line) |
| 315 | 322 | { |
| 316 | 323 | switch ($name) { |
@@ -437,6 +444,11 @@ discard block |
||
| 437 | 444 | return $this->parseFilterExpressionRaw($node); |
| 438 | 445 | } |
| 439 | 446 | |
| 447 | + /** |
|
| 448 | + * @param string $tag |
|
| 449 | + * |
|
| 450 | + * @return Twig_Node_Expression |
|
| 451 | + */ |
|
| 440 | 452 | public function parseFilterExpressionRaw($node, $tag = null) |
| 441 | 453 | { |
| 442 | 454 | while (true) { |
@@ -575,6 +587,9 @@ discard block |
||
| 575 | 587 | return $function instanceof Twig_Function_Node ? $function->getClass() : 'Twig_Node_Expression_Function'; |
| 576 | 588 | } |
| 577 | 589 | |
| 590 | + /** |
|
| 591 | + * @param integer $line |
|
| 592 | + */ |
|
| 578 | 593 | protected function getFilterNodeClass($name, $line) |
| 579 | 594 | { |
| 580 | 595 | $env = $this->parser->getEnvironment(); |
@@ -143,7 +143,7 @@ discard block |
||
| 143 | 143 | /** |
| 144 | 144 | * Returns a list of filters to add to the existing list. |
| 145 | 145 | * |
| 146 | - * @return array An array of filters |
|
| 146 | + * @return Twig_SimpleFilter[] An array of filters |
|
| 147 | 147 | */ |
| 148 | 148 | public function getFilters() |
| 149 | 149 | { |
@@ -205,7 +205,7 @@ discard block |
||
| 205 | 205 | /** |
| 206 | 206 | * Returns a list of global functions to add to the existing list. |
| 207 | 207 | * |
| 208 | - * @return array An array of global functions |
|
| 208 | + * @return Twig_SimpleFunction[] An array of global functions |
|
| 209 | 209 | */ |
| 210 | 210 | public function getFunctions() |
| 211 | 211 | { |
@@ -225,7 +225,7 @@ discard block |
||
| 225 | 225 | /** |
| 226 | 226 | * Returns a list of tests to add to the existing list. |
| 227 | 227 | * |
| 228 | - * @return array An array of tests |
|
| 228 | + * @return Twig_SimpleTest[] An array of tests |
|
| 229 | 229 | */ |
| 230 | 230 | public function getTests() |
| 231 | 231 | { |
@@ -338,6 +338,9 @@ discard block |
||
| 338 | 338 | throw new Twig_Error_Syntax($message, $line, $parser->getFilename()); |
| 339 | 339 | } |
| 340 | 340 | |
| 341 | + /** |
|
| 342 | + * @param string $name |
|
| 343 | + */ |
|
| 341 | 344 | protected function getTestNodeClass(Twig_Parser $parser, $name) |
| 342 | 345 | { |
| 343 | 346 | $env = $parser->getEnvironment(); |
@@ -546,7 +549,7 @@ discard block |
||
| 546 | 549 | * Rounds a number. |
| 547 | 550 | * |
| 548 | 551 | * @param int|float $value The value to round |
| 549 | - * @param int|float $precision The rounding precision |
|
| 552 | + * @param integer $precision The rounding precision |
|
| 550 | 553 | * @param string $method The method to use for rounding |
| 551 | 554 | * |
| 552 | 555 | * @return int|float The rounded number |
@@ -624,7 +627,7 @@ discard block |
||
| 624 | 627 | * @param mixed $value The value to encode. |
| 625 | 628 | * @param int $options Not used on PHP 5.2.x |
| 626 | 629 | * |
| 627 | - * @return mixed The JSON encoded value |
|
| 630 | + * @return string The JSON encoded value |
|
| 628 | 631 | */ |
| 629 | 632 | function twig_jsonencode_filter($value, $options = 0) |
| 630 | 633 | { |
@@ -643,7 +646,7 @@ discard block |
||
| 643 | 646 | * @param mixed $value The value to encode. |
| 644 | 647 | * @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 |
| 645 | 648 | * |
| 646 | - * @return mixed The JSON encoded value |
|
| 649 | + * @return string The JSON encoded value |
|
| 647 | 650 | */ |
| 648 | 651 | function twig_jsonencode_filter($value, $options = 0) |
| 649 | 652 | { |
@@ -1113,16 +1116,31 @@ discard block |
||
| 1113 | 1116 | } |
| 1114 | 1117 | |
| 1115 | 1118 | if (function_exists('mb_convert_encoding')) { |
| 1119 | + |
|
| 1120 | + /** |
|
| 1121 | + * @param string $to |
|
| 1122 | + * @param string $from |
|
| 1123 | + */ |
|
| 1116 | 1124 | function twig_convert_encoding($string, $to, $from) |
| 1117 | 1125 | { |
| 1118 | 1126 | return mb_convert_encoding($string, $to, $from); |
| 1119 | 1127 | } |
| 1120 | 1128 | } elseif (function_exists('iconv')) { |
| 1129 | + |
|
| 1130 | + /** |
|
| 1131 | + * @param string $to |
|
| 1132 | + * @param string $from |
|
| 1133 | + */ |
|
| 1121 | 1134 | function twig_convert_encoding($string, $to, $from) |
| 1122 | 1135 | { |
| 1123 | 1136 | return iconv($from, $to, $string); |
| 1124 | 1137 | } |
| 1125 | 1138 | } else { |
| 1139 | + |
|
| 1140 | + /** |
|
| 1141 | + * @param string $to |
|
| 1142 | + * @param string $from |
|
| 1143 | + */ |
|
| 1126 | 1144 | function twig_convert_encoding($string, $to, $from) |
| 1127 | 1145 | { |
| 1128 | 1146 | throw new Twig_Error_Runtime('No suitable convert encoding function (use UTF-8 as your encoding or install the iconv or mbstring extension).'); |
@@ -1402,8 +1420,8 @@ discard block |
||
| 1402 | 1420 | * |
| 1403 | 1421 | * @param string|array $template The template to render or an array of templates to try consecutively |
| 1404 | 1422 | * @param array $variables The variables to pass to the template |
| 1405 | - * @param bool $with_context Whether to pass the current context variables or not |
|
| 1406 | - * @param bool $ignore_missing Whether to ignore missing templates or not |
|
| 1423 | + * @param bool $withContext Whether to pass the current context variables or not |
|
| 1424 | + * @param bool $ignoreMissing Whether to ignore missing templates or not |
|
| 1407 | 1425 | * @param bool $sandboxed Whether to sandbox the template or not |
| 1408 | 1426 | * |
| 1409 | 1427 | * @return string The rendered template |
@@ -13,7 +13,7 @@ |
||
| 13 | 13 | /** |
| 14 | 14 | * Returns a list of global functions to add to the existing list. |
| 15 | 15 | * |
| 16 | - * @return array An array of global functions |
|
| 16 | + * @return Twig_SimpleFunction[] An array of global functions |
|
| 17 | 17 | */ |
| 18 | 18 | public function getFunctions() |
| 19 | 19 | { |
@@ -20,7 +20,7 @@ discard block |
||
| 20 | 20 | /** |
| 21 | 21 | * Returns the token parser instances to add to the existing list. |
| 22 | 22 | * |
| 23 | - * @return array An array of Twig_TokenParserInterface or Twig_TokenParserBrokerInterface instances |
|
| 23 | + * @return Twig_TokenParser_AutoEscape[] An array of Twig_TokenParserInterface or Twig_TokenParserBrokerInterface instances |
|
| 24 | 24 | */ |
| 25 | 25 | public function getTokenParsers() |
| 26 | 26 | { |
@@ -30,7 +30,7 @@ discard block |
||
| 30 | 30 | /** |
| 31 | 31 | * Returns the node visitor instances to add to the existing list. |
| 32 | 32 | * |
| 33 | - * @return Twig_NodeVisitorInterface[] An array of Twig_NodeVisitorInterface instances |
|
| 33 | + * @return Twig_NodeVisitor_Escaper[] An array of Twig_NodeVisitorInterface instances |
|
| 34 | 34 | */ |
| 35 | 35 | public function getNodeVisitors() |
| 36 | 36 | { |
@@ -40,7 +40,7 @@ discard block |
||
| 40 | 40 | /** |
| 41 | 41 | * Returns a list of filters to add to the existing list. |
| 42 | 42 | * |
| 43 | - * @return array An array of filters |
|
| 43 | + * @return Twig_SimpleFilter[] An array of filters |
|
| 44 | 44 | */ |
| 45 | 45 | public function getFilters() |
| 46 | 46 | { |
@@ -55,7 +55,7 @@ discard block |
||
| 55 | 55 | * The strategy can be a valid PHP callback that takes the template |
| 56 | 56 | * "filename" as an argument and returns the strategy to use. |
| 57 | 57 | * |
| 58 | - * @param mixed $defaultStrategy An escaping strategy |
|
| 58 | + * @param string $defaultStrategy An escaping strategy |
|
| 59 | 59 | */ |
| 60 | 60 | public function setDefaultStrategy($defaultStrategy) |
| 61 | 61 | { |
@@ -23,7 +23,7 @@ discard block |
||
| 23 | 23 | /** |
| 24 | 24 | * Returns the token parser instances to add to the existing list. |
| 25 | 25 | * |
| 26 | - * @return array An array of Twig_TokenParserInterface or Twig_TokenParserBrokerInterface instances |
|
| 26 | + * @return Twig_TokenParser_Sandbox[] An array of Twig_TokenParserInterface or Twig_TokenParserBrokerInterface instances |
|
| 27 | 27 | */ |
| 28 | 28 | public function getTokenParsers() |
| 29 | 29 | { |
@@ -33,7 +33,7 @@ discard block |
||
| 33 | 33 | /** |
| 34 | 34 | * Returns the node visitor instances to add to the existing list. |
| 35 | 35 | * |
| 36 | - * @return Twig_NodeVisitorInterface[] An array of Twig_NodeVisitorInterface instances |
|
| 36 | + * @return Twig_NodeVisitor_Sandbox[] An array of Twig_NodeVisitorInterface instances |
|
| 37 | 37 | */ |
| 38 | 38 | public function getNodeVisitors() |
| 39 | 39 | { |