@@ -267,9 +267,9 @@ discard block |
||
| 267 | 267 | */ |
| 268 | 268 | public function getTemplateClass($name, $index = null) |
| 269 | 269 | { |
| 270 | - $key = $this->getLoader()->getCacheKey($name).$this->optionsHash; |
|
| 270 | + $key = $this->getLoader()->getCacheKey($name) . $this->optionsHash; |
|
| 271 | 271 | |
| 272 | - return $this->templateClassPrefix.hash('sha256', $key).(null === $index ? '' : '_'.$index); |
|
| 272 | + return $this->templateClassPrefix . hash('sha256', $key) . (null === $index ? '' : '_' . $index); |
|
| 273 | 273 | } |
| 274 | 274 | |
| 275 | 275 | /** |
@@ -349,7 +349,7 @@ discard block |
||
| 349 | 349 | { |
| 350 | 350 | $cls = $mainCls = $this->getTemplateClass($name); |
| 351 | 351 | if (null !== $index) { |
| 352 | - $cls .= '_'.$index; |
|
| 352 | + $cls .= '_' . $index; |
|
| 353 | 353 | } |
| 354 | 354 | |
| 355 | 355 | if (isset($this->loadedTemplates[$cls])) { |
@@ -375,7 +375,7 @@ discard block |
||
| 375 | 375 | * where the cache was cleared between the above calls to write to and load from |
| 376 | 376 | * the cache. |
| 377 | 377 | */ |
| 378 | - eval('?>'.$content); |
|
| 378 | + eval('?>' . $content); |
|
| 379 | 379 | } |
| 380 | 380 | |
| 381 | 381 | if (!class_exists($cls, false)) { |
@@ -424,7 +424,7 @@ discard block |
||
| 424 | 424 | |
| 425 | 425 | $asString = (string) $date; |
| 426 | 426 | if (ctype_digit($asString) || (!empty($asString) && '-' === $asString[0] && ctype_digit(substr($asString, 1)))) { |
| 427 | - $date = new DateTime('@'.$date); |
|
| 427 | + $date = new DateTime('@' . $date); |
|
| 428 | 428 | } else { |
| 429 | 429 | $date = new DateTime($date, $env->getExtension('Twig_Extension_Core')->getTimezone()); |
| 430 | 430 | } |
@@ -931,18 +931,18 @@ discard block |
||
| 931 | 931 | ); |
| 932 | 932 | |
| 933 | 933 | if (isset($htmlspecialcharsCharsets[$charset])) { |
| 934 | - return htmlspecialchars($string, ENT_QUOTES | ENT_SUBSTITUTE, $charset); |
|
| 934 | + return htmlspecialchars($string, ENT_QUOTES|ENT_SUBSTITUTE, $charset); |
|
| 935 | 935 | } |
| 936 | 936 | |
| 937 | 937 | if (isset($htmlspecialcharsCharsets[strtoupper($charset)])) { |
| 938 | 938 | // cache the lowercase variant for future iterations |
| 939 | 939 | $htmlspecialcharsCharsets[$charset] = true; |
| 940 | 940 | |
| 941 | - return htmlspecialchars($string, ENT_QUOTES | ENT_SUBSTITUTE, $charset); |
|
| 941 | + return htmlspecialchars($string, ENT_QUOTES|ENT_SUBSTITUTE, $charset); |
|
| 942 | 942 | } |
| 943 | 943 | |
| 944 | 944 | $string = iconv($charset, 'UTF-8', $string); |
| 945 | - $string = htmlspecialchars($string, ENT_QUOTES | ENT_SUBSTITUTE, 'UTF-8'); |
|
| 945 | + $string = htmlspecialchars($string, ENT_QUOTES|ENT_SUBSTITUTE, 'UTF-8'); |
|
| 946 | 946 | |
| 947 | 947 | return iconv('UTF-8', $charset, $string); |
| 948 | 948 | |
@@ -957,12 +957,12 @@ discard block |
||
| 957 | 957 | throw new Twig_Error_Runtime('The string to escape is not a valid UTF-8 string.'); |
| 958 | 958 | } |
| 959 | 959 | |
| 960 | - $string = preg_replace_callback('#[^a-zA-Z0-9,\._]#Su', function ($matches) { |
|
| 960 | + $string = preg_replace_callback('#[^a-zA-Z0-9,\._]#Su', function($matches) { |
|
| 961 | 961 | $char = $matches[0]; |
| 962 | 962 | |
| 963 | 963 | // \xHH |
| 964 | 964 | if (!isset($char[1])) { |
| 965 | - return '\\x'.strtoupper(substr('00'.bin2hex($char), -2)); |
|
| 965 | + return '\\x' . strtoupper(substr('00' . bin2hex($char), -2)); |
|
| 966 | 966 | } |
| 967 | 967 | |
| 968 | 968 | // \uHHHH |
@@ -991,7 +991,7 @@ discard block |
||
| 991 | 991 | throw new Twig_Error_Runtime('The string to escape is not a valid UTF-8 string.'); |
| 992 | 992 | } |
| 993 | 993 | |
| 994 | - $string = preg_replace_callback('#[^a-zA-Z0-9]#Su', function ($matches) { |
|
| 994 | + $string = preg_replace_callback('#[^a-zA-Z0-9]#Su', function($matches) { |
|
| 995 | 995 | $char = $matches[0]; |
| 996 | 996 | |
| 997 | 997 | // \xHH |
@@ -1001,13 +1001,13 @@ discard block |
||
| 1001 | 1001 | $hex = '0'; |
| 1002 | 1002 | } |
| 1003 | 1003 | |
| 1004 | - return '\\'.$hex.' '; |
|
| 1004 | + return '\\' . $hex . ' '; |
|
| 1005 | 1005 | } |
| 1006 | 1006 | |
| 1007 | 1007 | // \uHHHH |
| 1008 | 1008 | $char = twig_convert_encoding($char, 'UTF-16BE', 'UTF-8'); |
| 1009 | 1009 | |
| 1010 | - return '\\'.ltrim(strtoupper(bin2hex($char)), '0').' '; |
|
| 1010 | + return '\\' . ltrim(strtoupper(bin2hex($char)), '0') . ' '; |
|
| 1011 | 1011 | }, $string); |
| 1012 | 1012 | |
| 1013 | 1013 | if ('UTF-8' !== $charset) { |
@@ -1025,7 +1025,7 @@ discard block |
||
| 1025 | 1025 | throw new Twig_Error_Runtime('The string to escape is not a valid UTF-8 string.'); |
| 1026 | 1026 | } |
| 1027 | 1027 | |
| 1028 | - $string = preg_replace_callback('#[^a-zA-Z0-9,\.\-_]#Su', function ($matches) { |
|
| 1028 | + $string = preg_replace_callback('#[^a-zA-Z0-9,\.\-_]#Su', function($matches) { |
|
| 1029 | 1029 | /** |
| 1030 | 1030 | * This function is adapted from code coming from Zend Framework. |
| 1031 | 1031 | * |
@@ -1040,9 +1040,9 @@ discard block |
||
| 1040 | 1040 | */ |
| 1041 | 1041 | static $entityMap = array( |
| 1042 | 1042 | 34 => 'quot', /* quotation mark */ |
| 1043 | - 38 => 'amp', /* ampersand */ |
|
| 1044 | - 60 => 'lt', /* less-than sign */ |
|
| 1045 | - 62 => 'gt', /* greater-than sign */ |
|
| 1043 | + 38 => 'amp', /* ampersand */ |
|
| 1044 | + 60 => 'lt', /* less-than sign */ |
|
| 1045 | + 62 => 'gt', /* greater-than sign */ |
|
| 1046 | 1046 | ); |
| 1047 | 1047 | |
| 1048 | 1048 | $chr = $matches[0]; |
@@ -1061,10 +1061,10 @@ discard block |
||
| 1061 | 1061 | * replace it with while grabbing the hex value of the character. |
| 1062 | 1062 | */ |
| 1063 | 1063 | if (1 == strlen($chr)) { |
| 1064 | - $hex = strtoupper(substr('00'.bin2hex($chr), -2)); |
|
| 1064 | + $hex = strtoupper(substr('00' . bin2hex($chr), -2)); |
|
| 1065 | 1065 | } else { |
| 1066 | 1066 | $chr = twig_convert_encoding($chr, 'UTF-16BE', 'UTF-8'); |
| 1067 | - $hex = strtoupper(substr('0000'.bin2hex($chr), -4)); |
|
| 1067 | + $hex = strtoupper(substr('0000' . bin2hex($chr), -4)); |
|
| 1068 | 1068 | } |
| 1069 | 1069 | |
| 1070 | 1070 | $int = hexdec($hex); |
@@ -1214,7 +1214,7 @@ discard block |
||
| 1214 | 1214 | { |
| 1215 | 1215 | $charset = $env->getCharset(); |
| 1216 | 1216 | |
| 1217 | - return mb_strtoupper(mb_substr($string, 0, 1, $charset), $charset).mb_strtolower(mb_substr($string, 1, null, $charset), $charset); |
|
| 1217 | + return mb_strtoupper(mb_substr($string, 0, 1, $charset), $charset) . mb_strtolower(mb_substr($string, 1, null, $charset), $charset); |
|
| 1218 | 1218 | } |
| 1219 | 1219 | |
| 1220 | 1220 | /** |
@@ -1361,7 +1361,7 @@ discard block |
||
| 1361 | 1361 | function twig_constant($constant, $object = null) |
| 1362 | 1362 | { |
| 1363 | 1363 | if (null !== $object) { |
| 1364 | - $constant = get_class($object).'::'.$constant; |
|
| 1364 | + $constant = get_class($object) . '::' . $constant; |
|
| 1365 | 1365 | } |
| 1366 | 1366 | |
| 1367 | 1367 | return constant($constant); |
@@ -1378,7 +1378,7 @@ discard block |
||
| 1378 | 1378 | function twig_constant_is_defined($constant, $object = null) |
| 1379 | 1379 | { |
| 1380 | 1380 | if (null !== $object) { |
| 1381 | - $constant = get_class($object).'::'.$constant; |
|
| 1381 | + $constant = get_class($object) . '::' . $constant; |
|
| 1382 | 1382 | } |
| 1383 | 1383 | |
| 1384 | 1384 | return defined($constant); |
@@ -1546,7 +1546,7 @@ discard block |
||
| 1546 | 1546 | } elseif ('h' === $lcName[0] && 0 === strpos($lcName, 'has')) { |
| 1547 | 1547 | $name = substr($method, 3); |
| 1548 | 1548 | $lcName = substr($lcName, 3); |
| 1549 | - if (in_array('is'.$lcName, $lcMethods)) { |
|
| 1549 | + if (in_array('is' . $lcName, $lcMethods)) { |
|
| 1550 | 1550 | continue; |
| 1551 | 1551 | } |
| 1552 | 1552 | } else { |
@@ -55,14 +55,14 @@ |
||
| 55 | 55 | $attributes[] = sprintf('%s: %s', $name, str_replace("\n", '', var_export($value, true))); |
| 56 | 56 | } |
| 57 | 57 | |
| 58 | - $repr = array(get_class($this).'('.implode(', ', $attributes)); |
|
| 58 | + $repr = array(get_class($this) . '(' . implode(', ', $attributes)); |
|
| 59 | 59 | |
| 60 | 60 | if (count($this->nodes)) { |
| 61 | 61 | foreach ($this->nodes as $name => $node) { |
| 62 | 62 | $len = strlen($name) + 4; |
| 63 | 63 | $noderepr = array(); |
| 64 | 64 | foreach (explode("\n", (string) $node) as $line) { |
| 65 | - $noderepr[] = str_repeat(' ', $len).$line; |
|
| 65 | + $noderepr[] = str_repeat(' ', $len) . $line; |
|
| 66 | 66 | } |
| 67 | 67 | |
| 68 | 68 | $repr[] = sprintf(' %s: %s', $name, ltrim(implode("\n", $noderepr))); |
@@ -110,10 +110,10 @@ discard block |
||
| 110 | 110 | $exception = false; |
| 111 | 111 | preg_match_all('/--DATA--(.*?)(?:--CONFIG--(.*?))?--EXPECT--(.*?)(?=\-\-DATA\-\-|$)/s', $test, $outputs, PREG_SET_ORDER); |
| 112 | 112 | } else { |
| 113 | - throw new InvalidArgumentException(sprintf('Test "%s" is not valid.', str_replace($fixturesDir.'/', '', $file))); |
|
| 113 | + throw new InvalidArgumentException(sprintf('Test "%s" is not valid.', str_replace($fixturesDir . '/', '', $file))); |
|
| 114 | 114 | } |
| 115 | 115 | |
| 116 | - $tests[] = array(str_replace($fixturesDir.'/', '', $file), $message, $condition, $templates, $exception, $outputs); |
|
| 116 | + $tests[] = array(str_replace($fixturesDir . '/', '', $file), $message, $condition, $templates, $exception, $outputs); |
|
| 117 | 117 | } |
| 118 | 118 | |
| 119 | 119 | if ($legacyTests && empty($tests)) { |
@@ -136,7 +136,7 @@ discard block |
||
| 136 | 136 | } |
| 137 | 137 | |
| 138 | 138 | if ($condition) { |
| 139 | - eval('$ret = '.$condition.';'); |
|
| 139 | + eval('$ret = ' . $condition . ';'); |
|
| 140 | 140 | if (!$ret) { |
| 141 | 141 | $this->markTestSkipped($condition); |
| 142 | 142 | } |
@@ -148,7 +148,7 @@ discard block |
||
| 148 | 148 | $config = array_merge(array( |
| 149 | 149 | 'cache' => false, |
| 150 | 150 | 'strict_variables' => true, |
| 151 | - ), $match[2] ? eval($match[2].';') : array()); |
|
| 151 | + ), $match[2] ? eval($match[2] . ';') : array()); |
|
| 152 | 152 | $twig = new Twig_Environment($loader, $config); |
| 153 | 153 | $twig->addGlobal('global', 'global'); |
| 154 | 154 | foreach ($this->getRuntimeLoaders() as $runtimeLoader) { |
@@ -174,7 +174,7 @@ discard block |
||
| 174 | 174 | // avoid using the same PHP class name for different cases |
| 175 | 175 | $p = new ReflectionProperty($twig, 'templateClassPrefix'); |
| 176 | 176 | $p->setAccessible(true); |
| 177 | - $p->setValue($twig, '__TwigTemplate_'.hash('sha256', uniqid(mt_rand(), true), false).'_'); |
|
| 177 | + $p->setValue($twig, '__TwigTemplate_' . hash('sha256', uniqid(mt_rand(), true), false) . '_'); |
|
| 178 | 178 | |
| 179 | 179 | try { |
| 180 | 180 | $template = $twig->loadTemplate('index.twig'); |
@@ -192,7 +192,7 @@ discard block |
||
| 192 | 192 | } |
| 193 | 193 | |
| 194 | 194 | try { |
| 195 | - $output = trim($template->render(eval($match[1].';')), "\n "); |
|
| 195 | + $output = trim($template->render(eval($match[1] . ';')), "\n "); |
|
| 196 | 196 | } catch (Exception $e) { |
| 197 | 197 | if (false !== $exception) { |
| 198 | 198 | $this->assertSame(trim($exception), trim(sprintf('%s: %s', get_class($e), $e->getMessage()))); |
@@ -221,7 +221,7 @@ discard block |
||
| 221 | 221 | echo $twig->compile($twig->parse($twig->tokenize($twig->getLoader()->getSourceContext($name)))); |
| 222 | 222 | } |
| 223 | 223 | } |
| 224 | - $this->assertEquals($expected, $output, $message.' (in '.$file.')'); |
|
| 224 | + $this->assertEquals($expected, $output, $message . ' (in ' . $file . ')'); |
|
| 225 | 225 | } |
| 226 | 226 | } |
| 227 | 227 | |
@@ -59,16 +59,16 @@ discard block |
||
| 59 | 59 | ), $options); |
| 60 | 60 | |
| 61 | 61 | $this->regexes = array( |
| 62 | - 'lex_var' => '/\s*'.preg_quote($this->options['whitespace_trim'].$this->options['tag_variable'][1], '/').'\s*|\s*'.preg_quote($this->options['tag_variable'][1], '/').'/A', |
|
| 63 | - 'lex_block' => '/\s*(?:'.preg_quote($this->options['whitespace_trim'].$this->options['tag_block'][1], '/').'\s*|\s*'.preg_quote($this->options['tag_block'][1], '/').')\n?/A', |
|
| 64 | - 'lex_raw_data' => '/('.preg_quote($this->options['tag_block'][0].$this->options['whitespace_trim'], '/').'|'.preg_quote($this->options['tag_block'][0], '/').')\s*(?:endverbatim)\s*(?:'.preg_quote($this->options['whitespace_trim'].$this->options['tag_block'][1], '/').'\s*|\s*'.preg_quote($this->options['tag_block'][1], '/').')/s', |
|
| 62 | + 'lex_var' => '/\s*' . preg_quote($this->options['whitespace_trim'] . $this->options['tag_variable'][1], '/') . '\s*|\s*' . preg_quote($this->options['tag_variable'][1], '/') . '/A', |
|
| 63 | + 'lex_block' => '/\s*(?:' . preg_quote($this->options['whitespace_trim'] . $this->options['tag_block'][1], '/') . '\s*|\s*' . preg_quote($this->options['tag_block'][1], '/') . ')\n?/A', |
|
| 64 | + 'lex_raw_data' => '/(' . preg_quote($this->options['tag_block'][0] . $this->options['whitespace_trim'], '/') . '|' . preg_quote($this->options['tag_block'][0], '/') . ')\s*(?:endverbatim)\s*(?:' . preg_quote($this->options['whitespace_trim'] . $this->options['tag_block'][1], '/') . '\s*|\s*' . preg_quote($this->options['tag_block'][1], '/') . ')/s', |
|
| 65 | 65 | 'operator' => $this->getOperatorRegex(), |
| 66 | - 'lex_comment' => '/(?:'.preg_quote($this->options['whitespace_trim'], '/').preg_quote($this->options['tag_comment'][1], '/').'\s*|'.preg_quote($this->options['tag_comment'][1], '/').')\n?/s', |
|
| 67 | - 'lex_block_raw' => '/\s*verbatim\s*(?:'.preg_quote($this->options['whitespace_trim'].$this->options['tag_block'][1], '/').'\s*|\s*'.preg_quote($this->options['tag_block'][1], '/').')/As', |
|
| 68 | - 'lex_block_line' => '/\s*line\s+(\d+)\s*'.preg_quote($this->options['tag_block'][1], '/').'/As', |
|
| 69 | - 'lex_tokens_start' => '/('.preg_quote($this->options['tag_variable'][0], '/').'|'.preg_quote($this->options['tag_block'][0], '/').'|'.preg_quote($this->options['tag_comment'][0], '/').')('.preg_quote($this->options['whitespace_trim'], '/').')?/s', |
|
| 70 | - 'interpolation_start' => '/'.preg_quote($this->options['interpolation'][0], '/').'\s*/A', |
|
| 71 | - 'interpolation_end' => '/\s*'.preg_quote($this->options['interpolation'][1], '/').'/A', |
|
| 66 | + 'lex_comment' => '/(?:' . preg_quote($this->options['whitespace_trim'], '/') . preg_quote($this->options['tag_comment'][1], '/') . '\s*|' . preg_quote($this->options['tag_comment'][1], '/') . ')\n?/s', |
|
| 67 | + 'lex_block_raw' => '/\s*verbatim\s*(?:' . preg_quote($this->options['whitespace_trim'] . $this->options['tag_block'][1], '/') . '\s*|\s*' . preg_quote($this->options['tag_block'][1], '/') . ')/As', |
|
| 68 | + 'lex_block_line' => '/\s*line\s+(\d+)\s*' . preg_quote($this->options['tag_block'][1], '/') . '/As', |
|
| 69 | + 'lex_tokens_start' => '/(' . preg_quote($this->options['tag_variable'][0], '/') . '|' . preg_quote($this->options['tag_block'][0], '/') . '|' . preg_quote($this->options['tag_comment'][0], '/') . ')(' . preg_quote($this->options['whitespace_trim'], '/') . ')?/s', |
|
| 70 | + 'interpolation_start' => '/' . preg_quote($this->options['interpolation'][0], '/') . '\s*/A', |
|
| 71 | + 'interpolation_end' => '/\s*' . preg_quote($this->options['interpolation'][1], '/') . '/A', |
|
| 72 | 72 | ); |
| 73 | 73 | } |
| 74 | 74 | |
@@ -150,7 +150,7 @@ discard block |
||
| 150 | 150 | $text = rtrim($text); |
| 151 | 151 | } |
| 152 | 152 | $this->pushToken(Twig_Token::TEXT_TYPE, $text); |
| 153 | - $this->moveCursor($textContent.$position[0]); |
|
| 153 | + $this->moveCursor($textContent . $position[0]); |
|
| 154 | 154 | |
| 155 | 155 | switch ($this->positions[1][$this->position][0]) { |
| 156 | 156 | case $this->options['tag_comment'][0]: |
@@ -226,7 +226,7 @@ discard block |
||
| 226 | 226 | } |
| 227 | 227 | // numbers |
| 228 | 228 | elseif (preg_match(self::REGEX_NUMBER, $this->code, $match, null, $this->cursor)) { |
| 229 | - $number = (float) $match[0]; // floats |
|
| 229 | + $number = (float) $match[0]; // floats |
|
| 230 | 230 | if (ctype_digit($match[0]) && $number <= PHP_INT_MAX) { |
| 231 | 231 | $number = (int) $match[0]; // integers lower than the maximum |
| 232 | 232 | } |
@@ -278,7 +278,7 @@ discard block |
||
| 278 | 278 | } |
| 279 | 279 | |
| 280 | 280 | $text = substr($this->code, $this->cursor, $match[0][1] - $this->cursor); |
| 281 | - $this->moveCursor($text.$match[0][0]); |
|
| 281 | + $this->moveCursor($text . $match[0][0]); |
|
| 282 | 282 | |
| 283 | 283 | if (false !== strpos($match[1][0], $this->options['whitespace_trim'])) { |
| 284 | 284 | $text = rtrim($text); |
@@ -293,7 +293,7 @@ discard block |
||
| 293 | 293 | throw new Twig_Error_Syntax('Unclosed comment.', $this->lineno, $this->source); |
| 294 | 294 | } |
| 295 | 295 | |
| 296 | - $this->moveCursor(substr($this->code, $this->cursor, $match[0][1] - $this->cursor).$match[0][0]); |
|
| 296 | + $this->moveCursor(substr($this->code, $this->cursor, $match[0][1] - $this->cursor) . $match[0][0]); |
|
| 297 | 297 | } |
| 298 | 298 | |
| 299 | 299 | private function lexString() |
@@ -362,7 +362,7 @@ discard block |
||
| 362 | 362 | // an operator that ends with a character must be followed by |
| 363 | 363 | // a whitespace or a parenthesis |
| 364 | 364 | if (ctype_alpha($operator[$length - 1])) { |
| 365 | - $r = preg_quote($operator, '/').'(?=[\s()])'; |
|
| 365 | + $r = preg_quote($operator, '/') . '(?=[\s()])'; |
|
| 366 | 366 | } else { |
| 367 | 367 | $r = preg_quote($operator, '/'); |
| 368 | 368 | } |
@@ -373,7 +373,7 @@ discard block |
||
| 373 | 373 | $regex[] = $r; |
| 374 | 374 | } |
| 375 | 375 | |
| 376 | - return '/'.implode('|', $regex).'/A'; |
|
| 376 | + return '/' . implode('|', $regex) . '/A'; |
|
| 377 | 377 | } |
| 378 | 378 | |
| 379 | 379 | private function pushState($state) |
@@ -201,7 +201,7 @@ discard block |
||
| 201 | 201 | foreach ($this->functions as $pattern => $function) { |
| 202 | 202 | $pattern = str_replace('\\*', '(.*?)', preg_quote($pattern, '#'), $count); |
| 203 | 203 | |
| 204 | - if ($count && preg_match('#^'.$pattern.'$#', $name, $matches)) { |
|
| 204 | + if ($count && preg_match('#^' . $pattern . '$#', $name, $matches)) { |
|
| 205 | 205 | array_shift($matches); |
| 206 | 206 | $function->setArguments($matches); |
| 207 | 207 | |
@@ -264,7 +264,7 @@ discard block |
||
| 264 | 264 | foreach ($this->filters as $pattern => $filter) { |
| 265 | 265 | $pattern = str_replace('\\*', '(.*?)', preg_quote($pattern, '#'), $count); |
| 266 | 266 | |
| 267 | - if ($count && preg_match('#^'.$pattern.'$#', $name, $matches)) { |
|
| 267 | + if ($count && preg_match('#^' . $pattern . '$#', $name, $matches)) { |
|
| 268 | 268 | array_shift($matches); |
| 269 | 269 | $filter->setArguments($matches); |
| 270 | 270 | |
@@ -467,7 +467,7 @@ discard block |
||
| 467 | 467 | // operators |
| 468 | 468 | if ($operators = $extension->getOperators()) { |
| 469 | 469 | if (!is_array($operators)) { |
| 470 | - throw new InvalidArgumentException(sprintf('"%s::getOperators()" must return an array with operators, got "%s".', get_class($extension), is_object($operators) ? get_class($operators) : gettype($operators).(is_resource($operators) ? '' : '#'.$operators))); |
|
| 470 | + throw new InvalidArgumentException(sprintf('"%s::getOperators()" must return an array with operators, got "%s".', get_class($extension), is_object($operators) ? get_class($operators) : gettype($operators) . (is_resource($operators) ? '' : '#' . $operators))); |
|
| 471 | 471 | } |
| 472 | 472 | |
| 473 | 473 | if (2 !== count($operators)) { |
@@ -108,7 +108,7 @@ discard block |
||
| 108 | 108 | public function write(...$strings) |
| 109 | 109 | { |
| 110 | 110 | foreach ($strings as $string) { |
| 111 | - $this->source .= str_repeat(' ', $this->indentation * 4).$string; |
|
| 111 | + $this->source .= str_repeat(' ', $this->indentation * 4) . $string; |
|
| 112 | 112 | } |
| 113 | 113 | |
| 114 | 114 | return $this; |
@@ -235,7 +235,7 @@ discard block |
||
| 235 | 235 | |
| 236 | 236 | public function getVarName() |
| 237 | 237 | { |
| 238 | - return sprintf('__internal_%s', hash('sha256', __METHOD__.$this->varNameSalt++)); |
|
| 238 | + return sprintf('__internal_%s', hash('sha256', __METHOD__ . $this->varNameSalt++)); |
|
| 239 | 239 | } |
| 240 | 240 | } |
| 241 | 241 | |
@@ -157,7 +157,7 @@ |
||
| 157 | 157 | throw new LogicException(sprintf('Token of type "%s" does not exist.', $type)); |
| 158 | 158 | } |
| 159 | 159 | |
| 160 | - return $short ? $name : 'Twig_Token::'.$name; |
|
| 160 | + return $short ? $name : 'Twig_Token::' . $name; |
|
| 161 | 161 | } |
| 162 | 162 | |
| 163 | 163 | /** |
@@ -35,7 +35,7 @@ |
||
| 35 | 35 | public function __construct(string $name, $callable = null, array $options = array()) |
| 36 | 36 | { |
| 37 | 37 | if (__CLASS__ !== get_class($this)) { |
| 38 | - @trigger_error('Overriding '.__CLASS__.' is deprecated since version 2.4.0 and the class will be final in 3.0.', E_USER_DEPRECATED); |
|
| 38 | + @trigger_error('Overriding ' . __CLASS__ . ' is deprecated since version 2.4.0 and the class will be final in 3.0.', E_USER_DEPRECATED); |
|
| 39 | 39 | } |
| 40 | 40 | |
| 41 | 41 | $this->name = $name; |