mirror of
https://github.com/twigphp/Twig.git
synced 2026-09-18 13:26:37 +00:00
fixed CS
This commit is contained in:
@@ -19,7 +19,7 @@ class Twig_Autoloader
|
||||
/**
|
||||
* Registers Twig_Autoloader as an SPL autoloader.
|
||||
*
|
||||
* @param bool $prepend Whether to prepend the autoloader or not.
|
||||
* @param bool $prepend Whether to prepend the autoloader or not.
|
||||
*/
|
||||
public static function register($prepend = false)
|
||||
{
|
||||
|
||||
@@ -239,7 +239,7 @@ class Twig_Compiler implements Twig_CompilerInterface
|
||||
/**
|
||||
* Indents the generated code.
|
||||
*
|
||||
* @param int $step The number of indentation to add
|
||||
* @param int $step The number of indentation to add
|
||||
*
|
||||
* @return Twig_Compiler The current compiler instance
|
||||
*/
|
||||
@@ -253,7 +253,7 @@ class Twig_Compiler implements Twig_CompilerInterface
|
||||
/**
|
||||
* Outdents the generated code.
|
||||
*
|
||||
* @param int $step The number of indentation to remove
|
||||
* @param int $step The number of indentation to remove
|
||||
*
|
||||
* @return Twig_Compiler The current compiler instance
|
||||
*
|
||||
|
||||
+11
-11
@@ -155,7 +155,7 @@ class Twig_Environment
|
||||
/**
|
||||
* Checks if debug mode is enabled.
|
||||
*
|
||||
* @return bool true if debug mode is enabled, false otherwise
|
||||
* @return bool true if debug mode is enabled, false otherwise
|
||||
*/
|
||||
public function isDebug()
|
||||
{
|
||||
@@ -181,7 +181,7 @@ class Twig_Environment
|
||||
/**
|
||||
* Checks if the auto_reload option is enabled.
|
||||
*
|
||||
* @return bool true if auto_reload is enabled, false otherwise
|
||||
* @return bool true if auto_reload is enabled, false otherwise
|
||||
*/
|
||||
public function isAutoReload()
|
||||
{
|
||||
@@ -207,7 +207,7 @@ class Twig_Environment
|
||||
/**
|
||||
* Checks if the strict_variables option is enabled.
|
||||
*
|
||||
* @return bool true if strict_variables is enabled, false otherwise
|
||||
* @return bool true if strict_variables is enabled, false otherwise
|
||||
*/
|
||||
public function isStrictVariables()
|
||||
{
|
||||
@@ -256,8 +256,8 @@ 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 int $index The index if it is an embedded template
|
||||
* @param string $name The name for which to calculate the template class name
|
||||
* @param int $index The index if it is an embedded template
|
||||
*
|
||||
* @return string The template class name
|
||||
*/
|
||||
@@ -311,8 +311,8 @@ class Twig_Environment
|
||||
/**
|
||||
* Loads a template by name.
|
||||
*
|
||||
* @param string $name The template name
|
||||
* @param int $index The index if it is an embedded template
|
||||
* @param string $name The template name
|
||||
* @param int $index The index if it is an embedded template
|
||||
*
|
||||
* @return Twig_TemplateInterface A template instance representing the given template name
|
||||
*
|
||||
@@ -353,10 +353,10 @@ class Twig_Environment
|
||||
* this method also checks if the enabled extensions have
|
||||
* not changed.
|
||||
*
|
||||
* @param string $name The template name
|
||||
* @param int $time The last modification time of the cached template
|
||||
* @param string $name The template name
|
||||
* @param int $time The last modification time of the cached template
|
||||
*
|
||||
* @return bool true if the template is fresh, false otherwise
|
||||
* @return bool true if the template is fresh, false otherwise
|
||||
*/
|
||||
public function isTemplateFresh($name, $time)
|
||||
{
|
||||
@@ -627,7 +627,7 @@ class Twig_Environment
|
||||
*
|
||||
* @param string $name The extension name
|
||||
*
|
||||
* @return bool Whether the extension is registered or not
|
||||
* @return bool Whether the extension is registered or not
|
||||
*/
|
||||
public function hasExtension($name)
|
||||
{
|
||||
|
||||
+2
-2
@@ -111,7 +111,7 @@ class Twig_Error extends Exception
|
||||
/**
|
||||
* Gets the template line where the error occurred.
|
||||
*
|
||||
* @return int 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 int $lineno The template line
|
||||
* @param int $lineno The template line
|
||||
*/
|
||||
public function setTemplateLine($lineno)
|
||||
{
|
||||
|
||||
@@ -23,7 +23,7 @@ interface Twig_ExistsLoaderInterface
|
||||
*
|
||||
* @param string $name The name of the template to check if we can load
|
||||
*
|
||||
* @return bool 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);
|
||||
}
|
||||
|
||||
@@ -466,8 +466,8 @@ class Twig_ExpressionParser
|
||||
/**
|
||||
* Parses arguments.
|
||||
*
|
||||
* @param bool $namedArguments Whether to allow named arguments or not
|
||||
* @param bool $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)
|
||||
{
|
||||
|
||||
@@ -95,9 +95,9 @@ class Twig_Extension_Core extends Twig_Extension
|
||||
/**
|
||||
* Sets the default format to be used by the number_format filter.
|
||||
*
|
||||
* @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.
|
||||
* @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.
|
||||
*/
|
||||
public function setNumberFormat($decimal, $decimalPoint, $thousandSep)
|
||||
{
|
||||
@@ -621,8 +621,8 @@ if (version_compare(PHP_VERSION, '5.3.0', '<')) {
|
||||
/**
|
||||
* JSON encodes a variable.
|
||||
*
|
||||
* @param mixed $value The value to encode.
|
||||
* @param int $options Not used on PHP 5.2.x
|
||||
* @param mixed $value The value to encode.
|
||||
* @param int $options Not used on PHP 5.2.x
|
||||
*
|
||||
* @return mixed The JSON encoded value
|
||||
*/
|
||||
@@ -640,8 +640,8 @@ if (version_compare(PHP_VERSION, '5.3.0', '<')) {
|
||||
/**
|
||||
* JSON encodes a variable.
|
||||
*
|
||||
* @param mixed $value The value to encode.
|
||||
* @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
|
||||
* @param mixed $value The value to encode.
|
||||
* @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
|
||||
*/
|
||||
@@ -1216,7 +1216,6 @@ 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);
|
||||
}
|
||||
|
||||
@@ -1228,7 +1227,7 @@ if (function_exists('mb_get_info')) {
|
||||
* @param Twig_Environment $env A Twig_Environment instance
|
||||
* @param mixed $thing A variable
|
||||
*
|
||||
* @return int The length of the value
|
||||
* @return int The length of the value
|
||||
*/
|
||||
function twig_length_filter(Twig_Environment $env, $thing)
|
||||
{
|
||||
@@ -1312,7 +1311,7 @@ else {
|
||||
* @param Twig_Environment $env A Twig_Environment instance
|
||||
* @param mixed $thing A variable
|
||||
*
|
||||
* @return int The length of the value
|
||||
* @return int The length of the value
|
||||
*/
|
||||
function twig_length_filter(Twig_Environment $env, $thing)
|
||||
{
|
||||
|
||||
@@ -317,11 +317,9 @@ class Twig_Lexer implements Twig_LexerInterface
|
||||
$this->pushToken(Twig_Token::INTERPOLATION_START_TYPE);
|
||||
$this->moveCursor($match[0]);
|
||||
$this->pushState(self::STATE_INTERPOLATION);
|
||||
|
||||
} elseif (preg_match(self::REGEX_DQ_STRING_PART, $this->code, $match, null, $this->cursor) && strlen($match[0]) > 0) {
|
||||
$this->pushToken(Twig_Token::STRING_TYPE, stripcslashes($match[0]));
|
||||
$this->moveCursor($match[0]);
|
||||
|
||||
} elseif (preg_match(self::REGEX_DQ_STRING_DELIM, $this->code, $match, null, $this->cursor)) {
|
||||
list($expect, $lineno) = array_pop($this->brackets);
|
||||
if ($this->code[$this->cursor] != '"') {
|
||||
|
||||
@@ -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 bool 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
|
||||
*/
|
||||
|
||||
+6
-6
@@ -28,10 +28,10 @@ class Twig_Node implements Twig_NodeInterface
|
||||
* The nodes are automatically made available as properties ($this->node).
|
||||
* The attributes are automatically made available as array items ($this['name']).
|
||||
*
|
||||
* @param array $nodes An array of named nodes
|
||||
* @param array $attributes An array of attributes (should not be nodes)
|
||||
* @param int $lineno The line number
|
||||
* @param string $tag The tag name associated with the Node
|
||||
* @param array $nodes An array of named nodes
|
||||
* @param array $attributes An array of attributes (should not be nodes)
|
||||
* @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)
|
||||
{
|
||||
@@ -124,7 +124,7 @@ class Twig_Node implements Twig_NodeInterface
|
||||
*
|
||||
* @param string The attribute name
|
||||
*
|
||||
* @return bool true if the attribute is defined, false otherwise
|
||||
* @return bool true if the attribute is defined, false otherwise
|
||||
*/
|
||||
public function hasAttribute($name)
|
||||
{
|
||||
@@ -173,7 +173,7 @@ class Twig_Node implements Twig_NodeInterface
|
||||
*
|
||||
* @param string The node name
|
||||
*
|
||||
* @return bool 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)
|
||||
{
|
||||
|
||||
@@ -36,7 +36,7 @@ class Twig_NodeVisitor_Optimizer implements Twig_NodeVisitorInterface
|
||||
/**
|
||||
* Constructor.
|
||||
*
|
||||
* @param int $optimizers The optimizer mode
|
||||
* @param int $optimizers The optimizer mode
|
||||
*/
|
||||
public function __construct($optimizers = -1)
|
||||
{
|
||||
|
||||
@@ -41,7 +41,7 @@ interface Twig_NodeVisitorInterface
|
||||
*
|
||||
* Priority should be between -10 and 10 (0 is the default).
|
||||
*
|
||||
* @return int The priority level
|
||||
* @return int The priority level
|
||||
*/
|
||||
public function getPriority();
|
||||
}
|
||||
|
||||
+18
-18
@@ -129,10 +129,10 @@ abstract class Twig_Template implements Twig_TemplateInterface
|
||||
* This method is for internal use only and should never be called
|
||||
* directly.
|
||||
*
|
||||
* @param string $name The block name to display
|
||||
* @param array $context The context
|
||||
* @param array $blocks The current set of blocks
|
||||
* @param bool $useBlocks Whether to use the current set of blocks
|
||||
* @param string $name The block name to display
|
||||
* @param array $context The context
|
||||
* @param array $blocks 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)
|
||||
{
|
||||
@@ -188,10 +188,10 @@ abstract class Twig_Template implements Twig_TemplateInterface
|
||||
* This method is for internal use only and should never be called
|
||||
* directly.
|
||||
*
|
||||
* @param string $name The block name to render
|
||||
* @param array $context The context
|
||||
* @param array $blocks The current set of blocks
|
||||
* @param bool $useBlocks Whether to use the current set of blocks
|
||||
* @param string $name The block name to render
|
||||
* @param array $context The context
|
||||
* @param array $blocks The current set of blocks
|
||||
* @param bool $useBlocks Whether to use the current set of blocks
|
||||
*
|
||||
* @return string The rendered block
|
||||
*/
|
||||
@@ -218,7 +218,7 @@ abstract class Twig_Template implements Twig_TemplateInterface
|
||||
*
|
||||
* @param string $name The block name
|
||||
*
|
||||
* @return bool true if the block exists, false otherwise
|
||||
* @return bool true if the block exists, false otherwise
|
||||
*/
|
||||
public function hasBlock($name)
|
||||
{
|
||||
@@ -324,9 +324,9 @@ abstract class Twig_Template implements Twig_TemplateInterface
|
||||
* access for versions of PHP before 5.4. This is not a way to override
|
||||
* the way to get a variable value.
|
||||
*
|
||||
* @param array $context The context
|
||||
* @param string $item The variable to return from the context
|
||||
* @param bool $ignoreStrictCheck Whether to ignore the strict variable check or not
|
||||
* @param array $context The context
|
||||
* @param string $item The variable to return from the context
|
||||
* @param bool $ignoreStrictCheck Whether to ignore the strict variable check or not
|
||||
*
|
||||
* @return The content of the context variable
|
||||
*
|
||||
@@ -348,12 +348,12 @@ abstract class Twig_Template implements Twig_TemplateInterface
|
||||
/**
|
||||
* Returns the attribute value for a given array/object.
|
||||
*
|
||||
* @param mixed $object The object or array from where to get the item
|
||||
* @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 bool $isDefinedTest Whether this is only a defined check
|
||||
* @param bool $ignoreStrictCheck Whether to ignore the strict attribute check or not
|
||||
* @param mixed $object The object or array from where to get the item
|
||||
* @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 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
|
||||
*
|
||||
|
||||
@@ -123,7 +123,7 @@ abstract class Twig_Test_IntegrationTestCase extends PHPUnit_Framework_TestCase
|
||||
|
||||
if (false !== $exception) {
|
||||
list($class, ) = explode(':', $exception);
|
||||
$this->assertThat(NULL, new PHPUnit_Framework_Constraint_Exception($class));
|
||||
$this->assertThat(null, new PHPUnit_Framework_Constraint_Exception($class));
|
||||
}
|
||||
|
||||
$expected = trim($match[3], "\n ");
|
||||
|
||||
+8
-8
@@ -38,9 +38,9 @@ class Twig_Token
|
||||
/**
|
||||
* Constructor.
|
||||
*
|
||||
* @param int $type The type of the token
|
||||
* @param string $value The token value
|
||||
* @param int $lineno The line position in the source
|
||||
* @param int $type The type of the token
|
||||
* @param string $value The token value
|
||||
* @param int $lineno The line position in the source
|
||||
*/
|
||||
public function __construct($type, $value, $lineno)
|
||||
{
|
||||
@@ -89,7 +89,7 @@ class Twig_Token
|
||||
/**
|
||||
* Gets the line.
|
||||
*
|
||||
* @return int The source line
|
||||
* @return int The source line
|
||||
*/
|
||||
public function getLine()
|
||||
{
|
||||
@@ -99,7 +99,7 @@ class Twig_Token
|
||||
/**
|
||||
* Gets the token type.
|
||||
*
|
||||
* @return int 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 int $type The type as an integer
|
||||
* @param bool $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 int $type The type as an integer
|
||||
* @param int $type The type as an integer
|
||||
*
|
||||
* @return string The string representation
|
||||
*/
|
||||
|
||||
@@ -101,7 +101,7 @@ class Twig_TokenStream
|
||||
/**
|
||||
* Looks at the next token.
|
||||
*
|
||||
* @param int $number
|
||||
* @param int $number
|
||||
*
|
||||
* @return Twig_Token
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user