Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

fixed CS

  • Loading branch information...
commit a009821dd31fa783269602507542cea978c9714a 1 parent 96b3ce6
@fabpot authored
Showing with 82 additions and 94 deletions.
  1. +2 −2 lib/Twig/Autoloader.php
  2. +2 −2 lib/Twig/CompilerInterface.php
  3. +0 −1  lib/Twig/ExistsLoaderInterface.php
  4. +3 −2 lib/Twig/Extension/Core.php
  5. +0 −1  lib/Twig/Extension/Escaper.php
  6. +9 −9 lib/Twig/ExtensionInterface.php
  7. +8 −8 lib/Twig/FilterInterface.php
  8. +6 −6 lib/Twig/FunctionInterface.php
  9. +1 −1  lib/Twig/LexerInterface.php
  10. +3 −3 lib/Twig/LoaderInterface.php
  11. +1 −1  lib/Twig/Node.php
  12. +1 −1  lib/Twig/Node/Macro.php
  13. +1 −1  lib/Twig/Node/SandboxedModule.php
  14. +3 −3 lib/Twig/NodeInterface.php
  15. +3 −3 lib/Twig/NodeVisitorInterface.php
  16. +1 −1  lib/Twig/ParserInterface.php
  17. +3 −3 lib/Twig/Sandbox/SecurityPolicyInterface.php
  18. +2 −2 lib/Twig/Template.php
  19. +3 −3 lib/Twig/TemplateInterface.php
  20. +2 −2 lib/Twig/Test/IntegrationTestCase.php
  21. +1 −1  lib/Twig/TestInterface.php
  22. +2 −2 lib/Twig/Token.php
  23. +3 −3 lib/Twig/TokenParserBrokerInterface.php
  24. +3 −3 lib/Twig/TokenParserInterface.php
  25. +3 −3 test/Twig/Tests/Extension/SandboxTest.php
  26. +0 −1  test/Twig/Tests/Node/AutoEscapeTest.php
  27. +0 −1  test/Twig/Tests/Node/BlockReferenceTest.php
  28. +0 −1  test/Twig/Tests/Node/BlockTest.php
  29. +0 −1  test/Twig/Tests/Node/DoTest.php
  30. +0 −1  test/Twig/Tests/Node/ForTest.php
  31. +0 −1  test/Twig/Tests/Node/IfTest.php
  32. +0 −1  test/Twig/Tests/Node/ImportTest.php
  33. +0 −1  test/Twig/Tests/Node/IncludeTest.php
  34. +1 −2  test/Twig/Tests/Node/MacroTest.php
  35. +0 −1  test/Twig/Tests/Node/ModuleTest.php
  36. +0 −1  test/Twig/Tests/Node/PrintTest.php
  37. +0 −1  test/Twig/Tests/Node/SandboxTest.php
  38. +4 −3 test/Twig/Tests/Node/SandboxedModuleTest.php
  39. +0 −1  test/Twig/Tests/Node/SandboxedPrintTest.php
  40. +0 −1  test/Twig/Tests/Node/SetTest.php
  41. +0 −1  test/Twig/Tests/Node/SpacelessTest.php
  42. +0 −1  test/Twig/Tests/Node/TextTest.php
  43. +10 −6 test/Twig/Tests/TemplateTest.php
  44. +1 −1  test/Twig/Tests/TokenStreamTest.php
View
4 lib/Twig/Autoloader.php
@@ -20,7 +20,7 @@ class Twig_Autoloader
/**
* Registers Twig_Autoloader as an SPL autoloader.
*/
- static public function register()
+ public static function register()
{
ini_set('unserialize_callback_func', 'spl_autoload_call');
spl_autoload_register(array(new self, 'autoload'));
@@ -31,7 +31,7 @@ static public function register()
*
* @param string $class A class name.
*/
- static public function autoload($class)
+ public static function autoload($class)
{
if (0 !== strpos($class, 'Twig')) {
return;
View
4 lib/Twig/CompilerInterface.php
@@ -24,12 +24,12 @@
*
* @return Twig_CompilerInterface The current compiler instance
*/
- function compile(Twig_NodeInterface $node);
+ public function compile(Twig_NodeInterface $node);
/**
* Gets the current PHP code after compilation.
*
* @return string The PHP code
*/
- function getSource();
+ public function getSource();
}
View
1  lib/Twig/ExistsLoaderInterface.php
@@ -17,7 +17,6 @@
*/
interface Twig_ExistsLoaderInterface
{
-
/**
* Check if we have the source code of a template, given its name.
*
View
5 lib/Twig/Extension/Core.php
@@ -969,6 +969,7 @@ function _twig_escape_css_callback($matches)
if (0 === strlen($hex)) {
$hex = '0';
}
+
return '\\'.$hex.' ';
}
@@ -1030,6 +1031,7 @@ function _twig_escape_html_attr_callback($matches)
* Per OWASP recommendations, we'll use hex entities for any other
* characters where a named entity does not exist.
*/
+
return sprintf('&#x%s;', $hex);
}
@@ -1118,8 +1120,7 @@ function twig_capitalize_string_filter(Twig_Environment $env, $string)
}
}
// and byte fallback
-else
-{
+else {
/**
* Returns the length of a variable.
*
View
1  lib/Twig/Extension/Escaper.php
@@ -105,4 +105,3 @@ function twig_raw_filter($string)
{
return $string;
}
-
View
18 lib/Twig/ExtensionInterface.php
@@ -24,61 +24,61 @@
*
* @param Twig_Environment $environment The current Twig_Environment instance
*/
- function initRuntime(Twig_Environment $environment);
+ public function initRuntime(Twig_Environment $environment);
/**
* Returns the token parser instances to add to the existing list.
*
* @return array An array of Twig_TokenParserInterface or Twig_TokenParserBrokerInterface instances
*/
- function getTokenParsers();
+ public function getTokenParsers();
/**
* Returns the node visitor instances to add to the existing list.
*
* @return array An array of Twig_NodeVisitorInterface instances
*/
- function getNodeVisitors();
+ public function getNodeVisitors();
/**
* Returns a list of filters to add to the existing list.
*
* @return array An array of filters
*/
- function getFilters();
+ public function getFilters();
/**
* Returns a list of tests to add to the existing list.
*
* @return array An array of tests
*/
- function getTests();
+ public function getTests();
/**
* Returns a list of functions to add to the existing list.
*
* @return array An array of functions
*/
- function getFunctions();
+ public function getFunctions();
/**
* Returns a list of operators to add to the existing list.
*
* @return array An array of operators
*/
- function getOperators();
+ public function getOperators();
/**
* Returns a list of global variables to add to the existing list.
*
* @return array An array of global variables
*/
- function getGlobals();
+ public function getGlobals();
/**
* Returns the name of the extension.
*
* @return string The extension name
*/
- function getName();
+ public function getName();
}
View
16 lib/Twig/FilterInterface.php
@@ -22,19 +22,19 @@
*
* @return string The PHP code for the filter
*/
- function compile();
+ public function compile();
- function needsEnvironment();
+ public function needsEnvironment();
- function needsContext();
+ public function needsContext();
- function getSafe(Twig_Node $filterArgs);
+ public function getSafe(Twig_Node $filterArgs);
- function getPreservesSafety();
+ public function getPreservesSafety();
- function getPreEscape();
+ public function getPreEscape();
- function setArguments($arguments);
+ public function setArguments($arguments);
- function getArguments();
+ public function getArguments();
}
View
12 lib/Twig/FunctionInterface.php
@@ -23,15 +23,15 @@
*
* @return string The PHP code for the function
*/
- function compile();
+ public function compile();
- function needsEnvironment();
+ public function needsEnvironment();
- function needsContext();
+ public function needsContext();
- function getSafe(Twig_Node $filterArgs);
+ public function getSafe(Twig_Node $filterArgs);
- function setArguments($arguments);
+ public function setArguments($arguments);
- function getArguments();
+ public function getArguments();
}
View
2  lib/Twig/LexerInterface.php
@@ -25,5 +25,5 @@
*
* @return Twig_TokenStream A token stream instance
*/
- function tokenize($code, $filename = null);
+ public function tokenize($code, $filename = null);
}
View
6 lib/Twig/LoaderInterface.php
@@ -26,7 +26,7 @@
*
* @throws Twig_Error_Loader When $name is not found
*/
- function getSource($name);
+ public function getSource($name);
/**
* Gets the cache key to use for the cache for a given template name.
@@ -37,7 +37,7 @@ function getSource($name);
*
* @throws Twig_Error_Loader When $name is not found
*/
- function getCacheKey($name);
+ public function getCacheKey($name);
/**
* Returns true if the template is still fresh.
@@ -49,5 +49,5 @@ function getCacheKey($name);
*
* @throws Twig_Error_Loader When $name is not found
*/
- function isFresh($name, $time);
+ public function isFresh($name, $time);
}
View
2  lib/Twig/Node.php
@@ -134,7 +134,7 @@ public function hasAttribute($name)
*
* @param string The attribute name
*
- * @return mixed The attribute value
+ * @return mixed The attribute value
*/
public function getAttribute($name)
{
View
2  lib/Twig/Node/Macro.php
@@ -70,7 +70,7 @@ public function compile(Twig_Compiler $compiler)
->indent()
->subcompile($this->getNode('body'))
->outdent()
- ->write("} catch(Exception \$e) {\n")
+ ->write("} catch (Exception \$e) {\n")
->indent()
->write("ob_end_clean();\n\n")
->write("throw \$e;\n")
View
2  lib/Twig/Node/SandboxedModule.php
@@ -45,7 +45,7 @@ protected function compileDisplayFooter(Twig_Compiler $compiler)
parent::compileDisplayFooter($compiler);
$compiler
- ->write("protected function checkSecurity() {\n")
+ ->write("protected function checkSecurity()\n", "{\n")
->indent()
->write("\$this->env->getExtension('sandbox')->checkSecurity(\n")
->indent()
View
6 lib/Twig/NodeInterface.php
@@ -22,9 +22,9 @@
*
* @param Twig_Compiler A Twig_Compiler instance
*/
- function compile(Twig_Compiler $compiler);
+ public function compile(Twig_Compiler $compiler);
- function getLine();
+ public function getLine();
- function getNodeTag();
+ public function getNodeTag();
}
View
6 lib/Twig/NodeVisitorInterface.php
@@ -25,7 +25,7 @@
*
* @return Twig_NodeInterface The modified node
*/
- function enterNode(Twig_NodeInterface $node, Twig_Environment $env);
+ public function enterNode(Twig_NodeInterface $node, Twig_Environment $env);
/**
* Called after child nodes are visited.
@@ -35,7 +35,7 @@ function enterNode(Twig_NodeInterface $node, Twig_Environment $env);
*
* @return Twig_NodeInterface The modified node
*/
- function leaveNode(Twig_NodeInterface $node, Twig_Environment $env);
+ public function leaveNode(Twig_NodeInterface $node, Twig_Environment $env);
/**
* Returns the priority for this visitor.
@@ -44,5 +44,5 @@ function leaveNode(Twig_NodeInterface $node, Twig_Environment $env);
*
* @return integer The priority level
*/
- function getPriority();
+ public function getPriority();
}
View
2  lib/Twig/ParserInterface.php
@@ -24,5 +24,5 @@
*
* @return Twig_Node_Module A node tree
*/
- function parse(Twig_TokenStream $stream);
+ public function parse(Twig_TokenStream $stream);
}
View
6 lib/Twig/Sandbox/SecurityPolicyInterface.php
@@ -17,9 +17,9 @@
*/
interface Twig_Sandbox_SecurityPolicyInterface
{
- function checkSecurity($tags, $filters, $functions);
+ public function checkSecurity($tags, $filters, $functions);
- function checkMethodAllowed($obj, $method);
+ public function checkMethodAllowed($obj, $method);
- function checkPropertyAllowed($obj, $method);
+ public function checkPropertyAllowed($obj, $method);
}
View
4 lib/Twig/Template.php
@@ -18,7 +18,7 @@
*/
abstract class Twig_Template implements Twig_TemplateInterface
{
- static protected $cache = array();
+ protected static $cache = array();
protected $parent;
protected $parents;
@@ -447,7 +447,7 @@ protected function getAttribute($object, $item, array $arguments = array(), $typ
/**
* This method is only useful when testing Twig. Do not use it.
*/
- static public function clearCache()
+ public static function clearCache()
{
self::$cache = array();
}
View
6 lib/Twig/TemplateInterface.php
@@ -28,7 +28,7 @@
*
* @return string The rendered template
*/
- function render(array $context);
+ public function render(array $context);
/**
* Displays the template with the given context.
@@ -36,12 +36,12 @@ function render(array $context);
* @param array $context An array of parameters to pass to the template
* @param array $blocks An array of blocks to pass to the template
*/
- function display(array $context, array $blocks = array());
+ public function display(array $context, array $blocks = array());
/**
* Returns the bound environment for this template.
*
* @return Twig_Environment The current environment
*/
- function getEnvironment();
+ public function getEnvironment();
}
View
4 lib/Twig/Test/IntegrationTestCase.php
@@ -129,10 +129,10 @@ protected function doIntegrationTest($file, $message, $condition, $templates, $e
$expected = trim($match[3], "\n ");
- if ($expected != $output) {
+ if ($expected != $output) {
echo 'Compiled template that failed:';
- foreach (array_keys($templates) as $name) {
+ foreach (array_keys($templates) as $name) {
echo "Template: $name\n";
$source = $loader->getSource($name);
echo $twig->compile($twig->parse($twig->tokenize($source, $name)));
View
2  lib/Twig/TestInterface.php
@@ -22,5 +22,5 @@
*
* @return string The PHP code for the test
*/
- function compile();
+ public function compile();
}
View
4 lib/Twig/Token.php
@@ -126,7 +126,7 @@ public function getValue()
*
* @return string The string representation
*/
- static public function typeToString($type, $short = false, $line = -1)
+ public static function typeToString($type, $short = false, $line = -1)
{
switch ($type) {
case self::EOF_TYPE:
@@ -183,7 +183,7 @@ static public function typeToString($type, $short = false, $line = -1)
*
* @return string The string representation
*/
- static public function typeToEnglish($type, $line = -1)
+ public static function typeToEnglish($type, $line = -1)
{
switch ($type) {
case self::EOF_TYPE:
View
6 lib/Twig/TokenParserBrokerInterface.php
@@ -27,19 +27,19 @@
*
* @return null|Twig_TokenParserInterface A Twig_TokenParserInterface or null if no suitable TokenParser was found
*/
- function getTokenParser($tag);
+ public function getTokenParser($tag);
/**
* Calls Twig_TokenParserInterface::setParser on all parsers the implementation knows of.
*
* @param Twig_ParserInterface $parser A Twig_ParserInterface interface
*/
- function setParser(Twig_ParserInterface $parser);
+ public function setParser(Twig_ParserInterface $parser);
/**
* Gets the Twig_ParserInterface.
*
* @return null|Twig_ParserInterface A Twig_ParserInterface instance or null
*/
- function getParser();
+ public function getParser();
}
View
6 lib/Twig/TokenParserInterface.php
@@ -22,7 +22,7 @@
*
* @param $parser A Twig_Parser instance
*/
- function setParser(Twig_Parser $parser);
+ public function setParser(Twig_Parser $parser);
/**
* Parses a token and returns a node.
@@ -31,12 +31,12 @@ function setParser(Twig_Parser $parser);
*
* @return Twig_NodeInterface A Twig_NodeInterface instance
*/
- function parse(Twig_Token $token);
+ public function parse(Twig_Token $token);
/**
* Gets the tag name associated with this token parser.
*
* @return string The tag name
*/
- function getTag();
+ public function getTag();
}
View
6 test/Twig/Tests/Extension/SandboxTest.php
@@ -11,7 +11,7 @@
class Twig_Tests_Extension_SandboxTest extends PHPUnit_Framework_TestCase
{
- static protected $params, $templates;
+ protected static $params, $templates;
public function setUp()
{
@@ -180,11 +180,11 @@ protected function getEnvironment($sandboxed, $options, $templates, $tags = arra
class FooObject
{
- static public $called = array('__toString' => 0, 'foo' => 0, 'getFooBar' => 0);
+ public static $called = array('__toString' => 0, 'foo' => 0, 'getFooBar' => 0);
public $bar = 'bar';
- static public function reset()
+ public static function reset()
{
self::$called = array('__toString' => 0, 'foo' => 0, 'getFooBar' => 0);
}
View
1  test/Twig/Tests/Node/AutoEscapeTest.php
@@ -9,7 +9,6 @@
* file that was distributed with this source code.
*/
-
class Twig_Tests_Node_AutoEscapeTest extends Twig_Test_NodeTestCase
{
/**
View
1  test/Twig/Tests/Node/BlockReferenceTest.php
@@ -9,7 +9,6 @@
* file that was distributed with this source code.
*/
-
class Twig_Tests_Node_BlockReferenceTest extends Twig_Test_NodeTestCase
{
/**
View
1  test/Twig/Tests/Node/BlockTest.php
@@ -9,7 +9,6 @@
* file that was distributed with this source code.
*/
-
class Twig_Tests_Node_BlockTest extends Twig_Test_NodeTestCase
{
/**
View
1  test/Twig/Tests/Node/DoTest.php
@@ -9,7 +9,6 @@
* file that was distributed with this source code.
*/
-
class Twig_Tests_Node_DoTest extends Twig_Test_NodeTestCase
{
/**
View
1  test/Twig/Tests/Node/ForTest.php
@@ -9,7 +9,6 @@
* file that was distributed with this source code.
*/
-
class Twig_Tests_Node_ForTest extends Twig_Test_NodeTestCase
{
/**
View
1  test/Twig/Tests/Node/IfTest.php
@@ -9,7 +9,6 @@
* file that was distributed with this source code.
*/
-
class Twig_Tests_Node_IfTest extends Twig_Test_NodeTestCase
{
/**
View
1  test/Twig/Tests/Node/ImportTest.php
@@ -9,7 +9,6 @@
* file that was distributed with this source code.
*/
-
class Twig_Tests_Node_ImportTest extends Twig_Test_NodeTestCase
{
/**
View
1  test/Twig/Tests/Node/IncludeTest.php
@@ -9,7 +9,6 @@
* file that was distributed with this source code.
*/
-
class Twig_Tests_Node_IncludeTest extends Twig_Test_NodeTestCase
{
/**
View
3  test/Twig/Tests/Node/MacroTest.php
@@ -9,7 +9,6 @@
* file that was distributed with this source code.
*/
-
class Twig_Tests_Node_MacroTest extends Twig_Test_NodeTestCase
{
/**
@@ -55,7 +54,7 @@ public function getfoo(\$foo = null)
ob_start();
try {
echo "foo";
- } catch(Exception \$e) {
+ } catch (Exception \$e) {
ob_end_clean();
throw \$e;
View
1  test/Twig/Tests/Node/ModuleTest.php
@@ -9,7 +9,6 @@
* file that was distributed with this source code.
*/
-
class Twig_Tests_Node_ModuleTest extends Twig_Test_NodeTestCase
{
/**
View
1  test/Twig/Tests/Node/PrintTest.php
@@ -9,7 +9,6 @@
* file that was distributed with this source code.
*/
-
class Twig_Tests_Node_PrintTest extends Twig_Test_NodeTestCase
{
/**
View
1  test/Twig/Tests/Node/SandboxTest.php
@@ -9,7 +9,6 @@
* file that was distributed with this source code.
*/
-
class Twig_Tests_Node_SandboxTest extends Twig_Test_NodeTestCase
{
/**
View
7 test/Twig/Tests/Node/SandboxedModuleTest.php
@@ -9,7 +9,6 @@
* file that was distributed with this source code.
*/
-
class Twig_Tests_Node_SandboxedModuleTest extends Twig_Test_NodeTestCase
{
/**
@@ -83,7 +82,8 @@ protected function doDisplay(array \$context, array \$blocks = array())
echo "foo";
}
- protected function checkSecurity() {
+ protected function checkSecurity()
+ {
\$this->env->getExtension('sandbox')->checkSecurity(
array('upper'),
array('for'),
@@ -141,7 +141,8 @@ protected function doDisplay(array \$context, array \$blocks = array())
\$this->parent->display(\$context, array_merge(\$this->blocks, \$blocks));
}
- protected function checkSecurity() {
+ protected function checkSecurity()
+ {
\$this->env->getExtension('sandbox')->checkSecurity(
array('upper'),
array('for'),
View
1  test/Twig/Tests/Node/SandboxedPrintTest.php
@@ -9,7 +9,6 @@
* file that was distributed with this source code.
*/
-
class Twig_Tests_Node_SandboxedPrintTest extends Twig_Test_NodeTestCase
{
/**
View
1  test/Twig/Tests/Node/SetTest.php
@@ -9,7 +9,6 @@
* file that was distributed with this source code.
*/
-
class Twig_Tests_Node_SetTest extends Twig_Test_NodeTestCase
{
/**
View
1  test/Twig/Tests/Node/SpacelessTest.php
@@ -9,7 +9,6 @@
* file that was distributed with this source code.
*/
-
class Twig_Tests_Node_SpacelessTest extends Twig_Test_NodeTestCase
{
/**
View
1  test/Twig/Tests/Node/TextTest.php
@@ -9,7 +9,6 @@
* file that was distributed with this source code.
*/
-
class Twig_Tests_Node_TextTest extends Twig_Test_NodeTestCase
{
/**
View
16 test/Twig/Tests/TemplateTest.php
@@ -196,7 +196,7 @@ public function getGetAttributeTests()
// add twig_template_get_attributes tests
if (function_exists('twig_template_get_attributes')) {
- foreach(array_slice($tests, 0) as $test) {
+ foreach (array_slice($tests, 0) as $test) {
$test = array_pad($test, 7, null);
$test[6] = true;
$tests[] = $test;
@@ -370,7 +370,7 @@ protected function getProtected()
return 'protected';
}
- static public function getStatic()
+ public static function getStatic()
{
return 'static';
}
@@ -379,24 +379,28 @@ static public function getStatic()
class Twig_TemplateMethodAndPropObject
{
private $a = 'a_prop';
- public function getA() {
+ public function getA()
+ {
return 'a';
}
public $b = 'b_prop';
- public function getB() {
+ public function getB()
+ {
return 'b';
}
private $c = 'c_prop';
- private function getC() {
+ private function getC()
+ {
return 'c';
}
}
class Twig_TemplateMagicMethodObject
{
- public function __call($method, $arguments) {
+ public function __call($method, $arguments)
+ {
return '__call_'.$method;
}
}
View
2  test/Twig/Tests/TokenStreamTest.php
@@ -11,7 +11,7 @@
class Twig_Tests_TokenStreamTest extends PHPUnit_Framework_TestCase
{
- static protected $tokens;
+ protected static $tokens;
public function setUp()
{
Please sign in to comment.
Something went wrong with that request. Please try again.