removed some unneeded phpdocs

This commit is contained in:
Fabien Potencier
2016-11-10 11:40:45 -08:00
parent 924c2f4813
commit f21c44cd67
31 changed files with 81 additions and 291 deletions
+5 -7
View File
@@ -554,8 +554,6 @@ An extension is a class that implements the following interface::
*
* This is where you can load some file that contains filter functions for instance.
*
* @param Twig_Environment $environment The current Twig_Environment instance
*
* @deprecated since 1.23 (to be removed in 2.0), implement Twig_Extension_InitRuntimeInterface instead
*/
function initRuntime(Twig_Environment $environment);
@@ -563,35 +561,35 @@ An extension is a class that implements the following interface::
/**
* Returns the token parser instances to add to the existing list.
*
* @return array An array of Twig_TokenParserInterface or Twig_TokenParserBrokerInterface instances
* @return (Twig_TokenParserInterface|Twig_TokenParserBrokerInterface)[]
*/
function getTokenParsers();
/**
* Returns the node visitor instances to add to the existing list.
*
* @return array An array of Twig_NodeVisitorInterface instances
* @return Twig_NodeVisitorInterface[]
*/
function getNodeVisitors();
/**
* Returns a list of filters to add to the existing list.
*
* @return array An array of filters
* @return Twig_SimpleFilter[]
*/
function getFilters();
/**
* Returns a list of tests to add to the existing list.
*
* @return array An array of tests
* @return Twig_SimpleTest[]
*/
function getTests();
/**
* Returns a list of functions to add to the existing list.
*
* @return array An array of functions
* @return Twig_SimpleFunction[]
*/
function getFunctions();
+5 -7
View File
@@ -539,43 +539,41 @@ An extension is a class that implements the following interface::
* Initializes the runtime environment.
*
* This is where you can load some file that contains filter functions for instance.
*
* @param Twig_Environment $environment The current Twig_Environment instance
*/
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
* @return (Twig_TokenParserInterface|Twig_TokenParserBrokerInterface)[]
*/
function getTokenParsers();
/**
* Returns the node visitor instances to add to the existing list.
*
* @return array An array of Twig_NodeVisitorInterface instances
* @return Twig_NodeVisitorInterface[]
*/
function getNodeVisitors();
/**
* Returns a list of filters to add to the existing list.
*
* @return array An array of filters
* @return Twig_SimpleFilter[]
*/
function getFilters();
/**
* Returns a list of tests to add to the existing list.
*
* @return array An array of tests
* @return Twig_SimpleTest[]
*/
function getTests();
/**
* Returns a list of functions to add to the existing list.
*
* @return array An array of functions
* @return Twig_SimpleFunction[]
*/
function getFunctions();
-6
View File
@@ -43,9 +43,6 @@ abstract class Twig_BaseNodeVisitor implements Twig_NodeVisitorInterface
/**
* Called before child nodes are visited.
*
* @param Twig_Node $node The node to visit
* @param Twig_Environment $env The Twig environment instance
*
* @return Twig_Node The modified node
*/
abstract protected function doEnterNode(Twig_Node $node, Twig_Environment $env);
@@ -53,9 +50,6 @@ abstract class Twig_BaseNodeVisitor implements Twig_NodeVisitorInterface
/**
* Called after child nodes are visited.
*
* @param Twig_Node $node The node to visit
* @param Twig_Environment $env The Twig environment instance
*
* @return Twig_Node|false The modified node or false if the node must be removed
*/
abstract protected function doLeaveNode(Twig_Node $node, Twig_Environment $env);
+10 -17
View File
@@ -26,11 +26,6 @@ class Twig_Compiler implements Twig_CompilerInterface
protected $sourceLine;
protected $filename;
/**
* Constructor.
*
* @param Twig_Environment $env The twig environment instance
*/
public function __construct(Twig_Environment $env)
{
$this->env = $env;
@@ -49,7 +44,7 @@ class Twig_Compiler implements Twig_CompilerInterface
/**
* Returns the environment instance related to this compiler.
*
* @return Twig_Environment The environment instance
* @return Twig_Environment
*/
public function getEnvironment()
{
@@ -72,7 +67,7 @@ class Twig_Compiler implements Twig_CompilerInterface
* @param Twig_NodeInterface $node The node to compile
* @param int $indentation The current indentation
*
* @return Twig_Compiler The current compiler instance
* @return $this
*/
public function compile(Twig_NodeInterface $node, $indentation = 0)
{
@@ -110,7 +105,7 @@ class Twig_Compiler implements Twig_CompilerInterface
*
* @param string $string The string
*
* @return Twig_Compiler The current compiler instance
* @return $this
*/
public function raw($string)
{
@@ -122,7 +117,7 @@ class Twig_Compiler implements Twig_CompilerInterface
/**
* Writes a string to the compiled code by adding indentation.
*
* @return Twig_Compiler The current compiler instance
* @return $this
*/
public function write()
{
@@ -137,7 +132,7 @@ class Twig_Compiler implements Twig_CompilerInterface
/**
* Appends an indentation to the current PHP code after compilation.
*
* @return Twig_Compiler The current compiler instance
* @return $this
*
* @deprecated since 1.27 (to be removed in 2.0).
*/
@@ -155,7 +150,7 @@ class Twig_Compiler implements Twig_CompilerInterface
*
* @param string $value The string
*
* @return Twig_Compiler The current compiler instance
* @return $this
*/
public function string($value)
{
@@ -169,7 +164,7 @@ class Twig_Compiler implements Twig_CompilerInterface
*
* @param mixed $value The value to convert
*
* @return Twig_Compiler The current compiler instance
* @return $this
*/
public function repr($value)
{
@@ -210,9 +205,7 @@ class Twig_Compiler implements Twig_CompilerInterface
/**
* Adds debugging information.
*
* @param Twig_NodeInterface $node The related twig node
*
* @return Twig_Compiler The current compiler instance
* @return $this
*/
public function addDebugInfo(Twig_NodeInterface $node)
{
@@ -249,7 +242,7 @@ class Twig_Compiler implements Twig_CompilerInterface
*
* @param int $step The number of indentation to add
*
* @return Twig_Compiler The current compiler instance
* @return $this
*/
public function indent($step = 1)
{
@@ -263,7 +256,7 @@ class Twig_Compiler implements Twig_CompilerInterface
*
* @param int $step The number of indentation to remove
*
* @return Twig_Compiler The current compiler instance
* @return $this
*
* @throws LogicException When trying to outdent too much so the indentation would become negative
*/
+1 -3
View File
@@ -21,9 +21,7 @@ interface Twig_CompilerInterface
/**
* Compiles a node.
*
* @param Twig_NodeInterface $node The node to compile
*
* @return Twig_CompilerInterface The current compiler instance
* @return $this
*/
public function compile(Twig_NodeInterface $node);
+16 -55
View File
@@ -94,7 +94,7 @@ class Twig_Environment
* (default to -1 which means that all optimizations are enabled;
* set it to 0 to disable).
*
* @param Twig_LoaderInterface $loader A Twig_LoaderInterface instance
* @param Twig_LoaderInterface $loader
* @param array $options An array of options
*/
public function __construct(Twig_LoaderInterface $loader = null, $options = array())
@@ -576,7 +576,7 @@ class Twig_Environment
/**
* Gets the Lexer instance.
*
* @return Twig_LexerInterface A Twig_LexerInterface instance
* @return Twig_LexerInterface
*
* @deprecated since 1.25 (to be removed in 2.0)
*/
@@ -591,11 +591,6 @@ class Twig_Environment
return $this->lexer;
}
/**
* Sets the Lexer instance.
*
* @param Twig_LexerInterface $lexer A Twig_LexerInterface instance
*/
public function setLexer(Twig_LexerInterface $lexer)
{
$this->lexer = $lexer;
@@ -607,7 +602,7 @@ class Twig_Environment
* @param string|Twig_Source $source The template source code
* @param string $name The template name (deprecated)
*
* @return Twig_TokenStream A Twig_TokenStream instance
* @return Twig_TokenStream
*
* @throws Twig_Error_Syntax When the code is syntactically wrong
*/
@@ -628,7 +623,7 @@ class Twig_Environment
/**
* Gets the Parser instance.
*
* @return Twig_ParserInterface A Twig_ParserInterface instance
* @return Twig_ParserInterface
*
* @deprecated since 1.25 (to be removed in 2.0)
*/
@@ -643,11 +638,6 @@ class Twig_Environment
return $this->parser;
}
/**
* Sets the Parser instance.
*
* @param Twig_ParserInterface $parser A Twig_ParserInterface instance
*/
public function setParser(Twig_ParserInterface $parser)
{
$this->parser = $parser;
@@ -656,9 +646,7 @@ class Twig_Environment
/**
* Converts a token stream to a node tree.
*
* @param Twig_TokenStream $stream A token stream instance
*
* @return Twig_Node_Module A node tree
* @return Twig_Node_Module
*
* @throws Twig_Error_Syntax When the token stream is syntactically or semantically wrong
*/
@@ -674,7 +662,7 @@ class Twig_Environment
/**
* Gets the Compiler instance.
*
* @return Twig_CompilerInterface A Twig_CompilerInterface instance
* @return Twig_CompilerInterface
*
* @deprecated since 1.25 (to be removed in 2.0)
*/
@@ -689,11 +677,6 @@ class Twig_Environment
return $this->compiler;
}
/**
* Sets the Compiler instance.
*
* @param Twig_CompilerInterface $compiler A Twig_CompilerInterface instance
*/
public function setCompiler(Twig_CompilerInterface $compiler)
{
$this->compiler = $compiler;
@@ -702,8 +685,6 @@ class Twig_Environment
/**
* Compiles a node and returns the PHP code.
*
* @param Twig_NodeInterface $node A Twig_NodeInterface instance
*
* @return string The compiled PHP source code
*/
public function compile(Twig_NodeInterface $node)
@@ -742,11 +723,6 @@ class Twig_Environment
}
}
/**
* Sets the Loader instance.
*
* @param Twig_LoaderInterface $loader A Twig_LoaderInterface instance
*/
public function setLoader(Twig_LoaderInterface $loader)
{
if (!$loader instanceof Twig_SourceContextLoaderInterface && 0 !== strpos(get_class($loader), 'Mock_Twig_LoaderInterface')) {
@@ -759,7 +735,7 @@ class Twig_Environment
/**
* Gets the Loader instance.
*
* @return Twig_LoaderInterface A Twig_LoaderInterface instance
* @return Twig_LoaderInterface
*/
public function getLoader()
{
@@ -846,7 +822,7 @@ class Twig_Environment
*
* @param string $class The extension class name
*
* @return Twig_ExtensionInterface A Twig_ExtensionInterface instance
* @return Twig_ExtensionInterface
*/
public function getExtension($class)
{
@@ -891,11 +867,6 @@ class Twig_Environment
throw new Twig_Error_Runtime(sprintf('Unable to load the "%s" runtime.', $class));
}
/**
* Registers an extension.
*
* @param Twig_ExtensionInterface $extension A Twig_ExtensionInterface instance
*/
public function addExtension(Twig_ExtensionInterface $extension)
{
if ($this->extensionInitialized) {
@@ -968,11 +939,6 @@ class Twig_Environment
return $this->extensions;
}
/**
* Registers a Token Parser.
*
* @param Twig_TokenParserInterface $parser A Twig_TokenParserInterface instance
*/
public function addTokenParser(Twig_TokenParserInterface $parser)
{
if ($this->extensionInitialized) {
@@ -985,7 +951,7 @@ class Twig_Environment
/**
* Gets the registered Token Parsers.
*
* @return Twig_TokenParserBrokerInterface A broker containing token parsers
* @return Twig_TokenParserBrokerInterface
*
* @internal
*/
@@ -1003,7 +969,7 @@ class Twig_Environment
*
* Be warned that this method cannot return tags defined by Twig_TokenParserBrokerInterface classes.
*
* @return Twig_TokenParserInterface[] An array of Twig_TokenParserInterface instances
* @return Twig_TokenParserInterface[]
*
* @internal
*/
@@ -1019,11 +985,6 @@ class Twig_Environment
return $tags;
}
/**
* Registers a Node Visitor.
*
* @param Twig_NodeVisitorInterface $visitor A Twig_NodeVisitorInterface instance
*/
public function addNodeVisitor(Twig_NodeVisitorInterface $visitor)
{
if ($this->extensionInitialized) {
@@ -1036,7 +997,7 @@ class Twig_Environment
/**
* Gets the registered Node Visitors.
*
* @return Twig_NodeVisitorInterface[] An array of Twig_NodeVisitorInterface instances
* @return Twig_NodeVisitorInterface[]
*
* @internal
*/
@@ -1053,7 +1014,7 @@ class Twig_Environment
* Registers a Filter.
*
* @param string|Twig_SimpleFilter $name The filter name or a Twig_SimpleFilter instance
* @param Twig_FilterInterface|Twig_SimpleFilter $filter A Twig_FilterInterface instance or a Twig_SimpleFilter instance
* @param Twig_FilterInterface|Twig_SimpleFilter $filter
*/
public function addFilter($name, $filter = null)
{
@@ -1129,7 +1090,7 @@ class Twig_Environment
*
* Be warned that this method cannot return filters defined with registerUndefinedFilterCallback.
*
* @return Twig_FilterInterface[] An array of Twig_FilterInterface instances
* @return Twig_FilterInterface[]
*
* @see registerUndefinedFilterCallback
*
@@ -1173,7 +1134,7 @@ class Twig_Environment
/**
* Gets the registered Tests.
*
* @return Twig_TestInterface[] An array of Twig_TestInterface instances
* @return Twig_TestInterface[]
*
* @internal
*/
@@ -1212,7 +1173,7 @@ class Twig_Environment
* Registers a Function.
*
* @param string|Twig_SimpleFunction $name The function name or a Twig_SimpleFunction instance
* @param Twig_FunctionInterface|Twig_SimpleFunction $function A Twig_FunctionInterface instance or a Twig_SimpleFunction instance
* @param Twig_FunctionInterface|Twig_SimpleFunction $function
*/
public function addFunction($name, $function = null)
{
@@ -1288,7 +1249,7 @@ class Twig_Environment
*
* Be warned that this method cannot return functions defined with registerUndefinedFunctionCallback.
*
* @return Twig_FunctionInterface[] An array of Twig_FunctionInterface instances
* @return Twig_FunctionInterface[]
*
* @see registerUndefinedFunctionCallback
*
+20 -20
View File
@@ -275,7 +275,7 @@ class Twig_Extension_Core extends Twig_Extension
/**
* Cycles over a value.
*
* @param ArrayAccess|array $values An array or an ArrayAccess instance
* @param ArrayAccess|array $values
* @param int $position The cycle position
*
* @return string The next value in the cycle
@@ -295,7 +295,7 @@ function twig_cycle($values, $position)
* - a random character from a string
* - a random integer between 0 and the integer parameter.
*
* @param Twig_Environment $env A Twig_Environment instance
* @param Twig_Environment $env
* @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).
@@ -355,7 +355,7 @@ function twig_random(Twig_Environment $env, $values = null)
* {{ post.published_at|date("m/d/Y") }}
* </pre>
*
* @param Twig_Environment $env A Twig_Environment instance
* @param Twig_Environment $env
* @param DateTime|DateTimeInterface|DateInterval|string $date A date
* @param string|null $format The target format, null to use the default
* @param DateTimeZone|string|null|false $timezone The target timezone, null to use the default, false to leave unchanged
@@ -383,7 +383,7 @@ function twig_date_format_filter(Twig_Environment $env, $date, $format = null, $
* {{ post.published_at|date_modify("-1day")|date("m/d/Y") }}
* </pre>
*
* @param Twig_Environment $env A Twig_Environment instance
* @param Twig_Environment $env
* @param DateTime|string $date A date
* @param string $modifier A modifier string
*
@@ -409,7 +409,7 @@ function twig_date_modify_filter(Twig_Environment $env, $date, $modifier)
* {% endif %}
* </pre>
*
* @param Twig_Environment $env A Twig_Environment instance
* @param Twig_Environment $env
* @param DateTime|DateTimeInterface|string|null $date A date
* @param DateTimeZone|string|null|false $timezone The target timezone, null to use the default, false to leave unchanged
*
@@ -511,7 +511,7 @@ function twig_round($value, $precision = 0, $method = 'common')
* be used. Supplying any of the parameters will override the defaults set in the
* environment object.
*
* @param Twig_Environment $env A Twig_Environment instance
* @param Twig_Environment $env
* @param mixed $number A float/int/string of the number to format
* @param int $decimal The number of decimal points to display.
* @param string $decimalPoint The character(s) to use for the decimal point.
@@ -640,7 +640,7 @@ function twig_array_merge($arr1, $arr2)
/**
* Slices a variable.
*
* @param Twig_Environment $env A Twig_Environment instance
* @param Twig_Environment $env
* @param mixed $item A variable
* @param int $start Start of the slice
* @param int $length Size of the slice
@@ -682,7 +682,7 @@ function twig_slice(Twig_Environment $env, $item, $start, $length = null, $prese
/**
* Returns the first element of the item.
*
* @param Twig_Environment $env A Twig_Environment instance
* @param Twig_Environment $env
* @param mixed $item A variable
*
* @return mixed The first element of the item
@@ -697,7 +697,7 @@ function twig_first(Twig_Environment $env, $item)
/**
* Returns the last element of the item.
*
* @param Twig_Environment $env A Twig_Environment instance
* @param Twig_Environment $env
* @param mixed $item A variable
*
* @return mixed The last element of the item
@@ -753,7 +753,7 @@ function twig_join_filter($value, $glue = '')
* {# returns [aa, bb, cc] #}
* </pre>
*
* @param Twig_Environment $env A Twig_Environment instance
* @param Twig_Environment $env
* @param string $value A string
* @param string $delimiter The delimiter
* @param int $limit The limit
@@ -833,7 +833,7 @@ function twig_get_array_keys_filter($array)
/**
* Reverses a variable.
*
* @param Twig_Environment $env A Twig_Environment instance
* @param Twig_Environment $env
* @param array|Traversable|string $item An array, a Traversable instance, or a string
* @param bool $preserveKeys Whether to preserve key or not
*
@@ -909,7 +909,7 @@ function twig_in_filter($value, $compare)
/**
* Escapes a string.
*
* @param Twig_Environment $env A Twig_Environment instance
* @param Twig_Environment $env
* @param mixed $string The value to be escaped
* @param string $strategy The escaping strategy
* @param string $charset The charset
@@ -1188,7 +1188,7 @@ if (function_exists('mb_get_info')) {
/**
* Returns the length of a variable.
*
* @param Twig_Environment $env A Twig_Environment instance
* @param Twig_Environment $env
* @param mixed $thing A variable
*
* @return int The length of the value
@@ -1201,7 +1201,7 @@ if (function_exists('mb_get_info')) {
/**
* Converts a string to uppercase.
*
* @param Twig_Environment $env A Twig_Environment instance
* @param Twig_Environment $env
* @param string $string A string
*
* @return string The uppercased string
@@ -1218,7 +1218,7 @@ if (function_exists('mb_get_info')) {
/**
* Converts a string to lowercase.
*
* @param Twig_Environment $env A Twig_Environment instance
* @param Twig_Environment $env
* @param string $string A string
*
* @return string The lowercased string
@@ -1235,7 +1235,7 @@ if (function_exists('mb_get_info')) {
/**
* Returns a titlecased string.
*
* @param Twig_Environment $env A Twig_Environment instance
* @param Twig_Environment $env
* @param string $string A string
*
* @return string The titlecased string
@@ -1252,7 +1252,7 @@ if (function_exists('mb_get_info')) {
/**
* Returns a capitalized string.
*
* @param Twig_Environment $env A Twig_Environment instance
* @param Twig_Environment $env
* @param string $string A string
*
* @return string The capitalized string
@@ -1271,7 +1271,7 @@ else {
/**
* Returns the length of a variable.
*
* @param Twig_Environment $env A Twig_Environment instance
* @param Twig_Environment $env
* @param mixed $thing A variable
*
* @return int The length of the value
@@ -1284,7 +1284,7 @@ else {
/**
* Returns a titlecased string.
*
* @param Twig_Environment $env A Twig_Environment instance
* @param Twig_Environment $env
* @param string $string A string
*
* @return string The titlecased string
@@ -1297,7 +1297,7 @@ else {
/**
* Returns a capitalized string.
*
* @param Twig_Environment $env A Twig_Environment instance
* @param Twig_Environment $env
* @param string $string A string
*
* @return string The capitalized string
-2
View File
@@ -13,8 +13,6 @@ class Twig_Extension_Escaper extends Twig_Extension
protected $defaultStrategy;
/**
* Constructor.
*
* @param string|false|callable $defaultStrategy An escaping strategy
*
* @see setDefaultStrategy()
+1 -1
View File
@@ -33,7 +33,7 @@ class Twig_Extension_StringLoader extends Twig_Extension
* @param Twig_Environment $env A Twig_Environment instance
* @param string $template A template as a string or object implementing __toString()
*
* @return Twig_Template A Twig_Template instance
* @return Twig_Template
*/
function twig_template_from_string(Twig_Environment $env, $template)
{
+1 -3
View File
@@ -21,8 +21,6 @@ interface Twig_ExtensionInterface
*
* This is where you can load some file that contains filter functions for instance.
*
* @param Twig_Environment $environment The current Twig_Environment instance
*
* @deprecated since 1.23 (to be removed in 2.0), implement Twig_Extension_InitRuntimeInterface instead
*/
public function initRuntime(Twig_Environment $environment);
@@ -37,7 +35,7 @@ interface Twig_ExtensionInterface
/**
* Returns the node visitor instances to add to the existing list.
*
* @return Twig_NodeVisitorInterface[] An array of Twig_NodeVisitorInterface instances
* @return Twig_NodeVisitorInterface[]
*/
public function getNodeVisitors();
+1 -1
View File
@@ -24,7 +24,7 @@ interface Twig_LexerInterface
* @param string|Twig_Source $code The source code
* @param string $name A unique identifier for the source code
*
* @return Twig_TokenStream A token stream instance
* @return Twig_TokenStream
*
* @throws Twig_Error_Syntax When the code is syntactically wrong
*/
-2
View File
@@ -26,8 +26,6 @@ class Twig_Loader_Array implements Twig_LoaderInterface, Twig_ExistsLoaderInterf
protected $templates = array();
/**
* Constructor.
*
* @param array $templates An array of templates (keys are the names, and values are the source code)
*/
public function __construct(array $templates = array())
+1 -8
View File
@@ -20,9 +20,7 @@ class Twig_Loader_Chain implements Twig_LoaderInterface, Twig_ExistsLoaderInterf
protected $loaders = array();
/**
* Constructor.
*
* @param Twig_LoaderInterface[] $loaders An array of loader instances
* @param Twig_LoaderInterface[] $loaders
*/
public function __construct(array $loaders = array())
{
@@ -31,11 +29,6 @@ class Twig_Loader_Chain implements Twig_LoaderInterface, Twig_ExistsLoaderInterf
}
}
/**
* Adds a loader instance.
*
* @param Twig_LoaderInterface $loader A Loader instance
*/
public function addLoader(Twig_LoaderInterface $loader)
{
$this->loaders[] = $loader;
-2
View File
@@ -26,8 +26,6 @@ class Twig_Loader_Filesystem implements Twig_LoaderInterface, Twig_ExistsLoaderI
private $rootPath;
/**
* Constructor.
*
* @param string|array $paths A path or an array of paths where to look for templates
* @param string|null $rootPath The root path common to all relative paths (null for getcwd())
*/
+1 -35
View File
@@ -139,11 +139,7 @@ class Twig_Node implements Twig_NodeInterface
}
/**
* Returns true if the attribute is defined.
*
* @param string $name The attribute name
*
* @return bool true if the attribute is defined, false otherwise
* @return bool
*/
public function hasAttribute($name)
{
@@ -151,10 +147,6 @@ class Twig_Node implements Twig_NodeInterface
}
/**
* Gets an attribute value by name.
*
* @param string $name
*
* @return mixed
*/
public function getAttribute($name)
@@ -167,8 +159,6 @@ class Twig_Node implements Twig_NodeInterface
}
/**
* Sets an attribute by name to a value.
*
* @param string $name
* @param mixed $value
*/
@@ -177,21 +167,12 @@ class Twig_Node implements Twig_NodeInterface
$this->attributes[$name] = $value;
}
/**
* Removes an attribute by name.
*
* @param string $name
*/
public function removeAttribute($name)
{
unset($this->attributes[$name]);
}
/**
* Returns true if the node with the given name exists.
*
* @param string $name
*
* @return bool
*/
public function hasNode($name)
@@ -200,10 +181,6 @@ class Twig_Node implements Twig_NodeInterface
}
/**
* Gets a node by name.
*
* @param string $name
*
* @return Twig_Node
*/
public function getNode($name)
@@ -215,12 +192,6 @@ class Twig_Node implements Twig_NodeInterface
return $this->nodes[$name];
}
/**
* Sets a node.
*
* @param string $name
* @param Twig_Node $node
*/
public function setNode($name, $node = null)
{
if (!$node instanceof Twig_NodeInterface) {
@@ -230,11 +201,6 @@ class Twig_Node implements Twig_NodeInterface
$this->nodes[$name] = $node;
}
/**
* Removes a node by name.
*
* @param string $name
*/
public function removeNode($name)
{
unset($this->nodes[$name]);
+1 -3
View File
@@ -36,11 +36,9 @@ class Twig_Node_SandboxedPrint extends Twig_Node_Print
*
* This is mostly needed when another visitor adds filters (like the escaper one).
*
* @param Twig_Node $node A Node
*
* @return Twig_Node
*/
protected function removeNodeFilter($node)
protected function removeNodeFilter(Twig_Node $node)
{
if ($node instanceof Twig_Node_Expression_Filter) {
return $this->removeNodeFilter($node->getNode('node'));
-2
View File
@@ -20,8 +20,6 @@ interface Twig_NodeInterface extends Countable, IteratorAggregate
{
/**
* Compiles the node to PHP.
*
* @param Twig_Compiler $compiler A Twig_Compiler instance
*/
public function compile(Twig_Compiler $compiler);
+2 -11
View File
@@ -22,10 +22,8 @@ class Twig_NodeTraverser
protected $visitors = array();
/**
* Constructor.
*
* @param Twig_Environment $env A Twig_Environment instance
* @param Twig_NodeVisitorInterface[] $visitors An array of Twig_NodeVisitorInterface instances
* @param Twig_Environment $env
* @param Twig_NodeVisitorInterface[] $visitors
*/
public function __construct(Twig_Environment $env, array $visitors = array())
{
@@ -35,11 +33,6 @@ class Twig_NodeTraverser
}
}
/**
* Adds a visitor.
*
* @param Twig_NodeVisitorInterface $visitor A Twig_NodeVisitorInterface instance
*/
public function addVisitor(Twig_NodeVisitorInterface $visitor)
{
if (!isset($this->visitors[$visitor->getPriority()])) {
@@ -52,8 +45,6 @@ class Twig_NodeTraverser
/**
* Traverses a node and calls the registered visitors.
*
* @param Twig_NodeInterface $node A Twig_NodeInterface instance
*
* @return Twig_NodeInterface
*/
public function traverse(Twig_NodeInterface $node)
-14
View File
@@ -34,8 +34,6 @@ class Twig_NodeVisitor_Optimizer extends Twig_BaseNodeVisitor
protected $inABody = false;
/**
* Constructor.
*
* @param int $optimizers The optimizer mode
*/
public function __construct($optimizers = -1)
@@ -127,9 +125,6 @@ class Twig_NodeVisitor_Optimizer extends Twig_BaseNodeVisitor
*
* * "echo $this->render(Parent)Block()" with "$this->display(Parent)Block()"
*
* @param Twig_NodeInterface $node A Node
* @param Twig_Environment $env The current Twig environment
*
* @return Twig_NodeInterface
*/
protected function optimizePrintNode(Twig_NodeInterface $node, Twig_Environment $env)
@@ -153,9 +148,6 @@ class Twig_NodeVisitor_Optimizer extends Twig_BaseNodeVisitor
/**
* Removes "raw" filters.
*
* @param Twig_NodeInterface $node A Node
* @param Twig_Environment $env The current Twig environment
*
* @return Twig_NodeInterface
*/
protected function optimizeRawFilter(Twig_NodeInterface $node, Twig_Environment $env)
@@ -169,9 +161,6 @@ class Twig_NodeVisitor_Optimizer extends Twig_BaseNodeVisitor
/**
* Optimizes "for" tag by removing the "loop" variable creation whenever possible.
*
* @param Twig_NodeInterface $node A Node
* @param Twig_Environment $env The current Twig environment
*/
protected function enterOptimizeFor(Twig_NodeInterface $node, Twig_Environment $env)
{
@@ -236,9 +225,6 @@ class Twig_NodeVisitor_Optimizer extends Twig_BaseNodeVisitor
/**
* Optimizes "for" tag by removing the "loop" variable creation whenever possible.
*
* @param Twig_NodeInterface $node A Node
* @param Twig_Environment $env The current Twig environment
*/
protected function leaveOptimizeFor(Twig_NodeInterface $node, Twig_Environment $env)
{
-6
View File
@@ -19,9 +19,6 @@ interface Twig_NodeVisitorInterface
/**
* Called before child nodes are visited.
*
* @param Twig_NodeInterface $node The node to visit
* @param Twig_Environment $env The Twig environment instance
*
* @return Twig_NodeInterface The modified node
*/
public function enterNode(Twig_NodeInterface $node, Twig_Environment $env);
@@ -29,9 +26,6 @@ interface Twig_NodeVisitorInterface
/**
* Called after child nodes are visited.
*
* @param Twig_NodeInterface $node The node to visit
* @param Twig_Environment $env The Twig environment instance
*
* @return Twig_NodeInterface|false The modified node or false if the node must be removed
*/
public function leaveNode(Twig_NodeInterface $node, Twig_Environment $env);
+3 -14
View File
@@ -32,11 +32,6 @@ class Twig_Parser implements Twig_ParserInterface
protected $traits;
protected $embeddedTemplates = array();
/**
* Constructor.
*
* @param Twig_Environment $env A Twig_Environment instance
*/
public function __construct(Twig_Environment $env)
{
$this->env = $env;
@@ -346,9 +341,7 @@ class Twig_Parser implements Twig_ParserInterface
}
/**
* Gets the expression parser.
*
* @return Twig_ExpressionParser The expression parser
* @return Twig_ExpressionParser
*/
public function getExpressionParser()
{
@@ -366,9 +359,7 @@ class Twig_Parser implements Twig_ParserInterface
}
/**
* Gets the token stream.
*
* @return Twig_TokenStream The token stream
* @return Twig_TokenStream
*/
public function getStream()
{
@@ -376,9 +367,7 @@ class Twig_Parser implements Twig_ParserInterface
}
/**
* Gets the current token.
*
* @return Twig_Token The current token
* @return Twig_Token
*/
public function getCurrentToken()
{
+1 -3
View File
@@ -21,9 +21,7 @@ interface Twig_ParserInterface
/**
* Converts a token stream to a node tree.
*
* @param Twig_TokenStream $stream A token stream instance
*
* @return Twig_Node_Module A node tree
* @return Twig_Node_Module
*
* @throws Twig_Error_Syntax When the token stream is syntactically or semantically wrong
*/
-5
View File
@@ -32,11 +32,6 @@ abstract class Twig_Template implements Twig_TemplateInterface
protected $blocks = array();
protected $traits = array();
/**
* Constructor.
*
* @param Twig_Environment $env A Twig_Environment instance
*/
public function __construct(Twig_Environment $env)
{
$this->env = $env;
+1 -1
View File
@@ -42,7 +42,7 @@ interface Twig_TemplateInterface
/**
* Returns the bound environment for this template.
*
* @return Twig_Environment The current environment
* @return Twig_Environment
*/
public function getEnvironment();
}
+7 -20
View File
@@ -36,8 +36,6 @@ class Twig_Token
const INTERPOLATION_END_TYPE = 11;
/**
* Constructor.
*
* @param int $type The type of the token
* @param string $value The token value
* @param int $lineno The line position in the source
@@ -49,11 +47,6 @@ class Twig_Token
$this->lineno = $lineno;
}
/**
* Returns a string representation of the token.
*
* @return string A string representation of the token
*/
public function __toString()
{
return sprintf('%s(%s)', self::typeToString($this->type, true), $this->value);
@@ -63,9 +56,9 @@ class Twig_Token
* Tests the current token for a type and/or a value.
*
* Parameters may be:
* * just type
* * type and value (or array of possible values)
* * just value (or array of possible values) (NAME_TYPE is used as type)
* * just type
* * type and value (or array of possible values)
* * just value (or array of possible values) (NAME_TYPE is used as type)
*
* @param array|int $type The type to test
* @param array|string|null $values The token value
@@ -87,9 +80,7 @@ class Twig_Token
}
/**
* Gets the line.
*
* @return int The source line
* @return int
*/
public function getLine()
{
@@ -97,9 +88,7 @@ class Twig_Token
}
/**
* Gets the token type.
*
* @return int The token type
* @return int
*/
public function getType()
{
@@ -107,9 +96,7 @@ class Twig_Token
}
/**
* Gets the token value.
*
* @return string The token value
* @return string
*/
public function getValue()
{
@@ -174,7 +161,7 @@ class Twig_Token
}
/**
* Returns the english representation of a given type.
* Returns the English representation of a given type.
*
* @param int $type The type as an integer
*
-2
View File
@@ -23,8 +23,6 @@ abstract class Twig_TokenParser implements Twig_TokenParserInterface
/**
* Sets the parser associated with this token parser.
*
* @param Twig_Parser $parser A Twig_Parser instance
*/
public function setParser(Twig_Parser $parser)
{
-22
View File
@@ -24,8 +24,6 @@ class Twig_TokenParserBroker implements Twig_TokenParserBrokerInterface
protected $brokers = array();
/**
* Constructor.
*
* @param array|Traversable $parsers A Traversable of Twig_TokenParserInterface instances
* @param array|Traversable $brokers A Traversable of Twig_TokenParserBrokerInterface instances
* @param bool $triggerDeprecationError
@@ -50,21 +48,11 @@ class Twig_TokenParserBroker implements Twig_TokenParserBrokerInterface
}
}
/**
* Adds a TokenParser.
*
* @param Twig_TokenParserInterface $parser A Twig_TokenParserInterface instance
*/
public function addTokenParser(Twig_TokenParserInterface $parser)
{
$this->parsers[$parser->getTag()] = $parser;
}
/**
* Removes a TokenParser.
*
* @param Twig_TokenParserInterface $parser A Twig_TokenParserInterface instance
*/
public function removeTokenParser(Twig_TokenParserInterface $parser)
{
$name = $parser->getTag();
@@ -73,21 +61,11 @@ class Twig_TokenParserBroker implements Twig_TokenParserBrokerInterface
}
}
/**
* Adds a TokenParserBroker.
*
* @param Twig_TokenParserBroker $broker A Twig_TokenParserBroker instance
*/
public function addTokenParserBroker(Twig_TokenParserBroker $broker)
{
$this->brokers[] = $broker;
}
/**
* Removes a TokenParserBroker.
*
* @param Twig_TokenParserBroker $broker A Twig_TokenParserBroker instance
*/
public function removeTokenParserBroker(Twig_TokenParserBroker $broker)
{
if (false !== $pos = array_search($broker, $this->brokers)) {
+1 -3
View File
@@ -26,14 +26,12 @@ interface Twig_TokenParserBrokerInterface
*
* @param string $tag A tag name
*
* @return null|Twig_TokenParserInterface A Twig_TokenParserInterface or null if no suitable TokenParser was found
* @return Twig_TokenParserInterface|null A Twig_TokenParserInterface or null if no suitable TokenParser was found
*/
public function getTokenParser($tag);
/**
* Calls Twig_TokenParserInterface::setParser on all parsers the implementation knows of.
*
* @param Twig_ParserInterface $parser A Twig_ParserInterface interface
*/
public function setParser(Twig_ParserInterface $parser);
+1 -5
View File
@@ -18,17 +18,13 @@ interface Twig_TokenParserInterface
{
/**
* Sets the parser associated with this token parser.
*
* @param Twig_Parser $parser A Twig_Parser instance
*/
public function setParser(Twig_Parser $parser);
/**
* Parses a token and returns a node.
*
* @param Twig_Token $token A Twig_Token instance
*
* @return Twig_NodeInterface A Twig_NodeInterface instance
* @return Twig_NodeInterface
*
* @throws Twig_Error_Syntax
*/
-9
View File
@@ -24,8 +24,6 @@ class Twig_TokenStream
private $source;
/**
* Constructor.
*
* @param array $tokens An array of tokens
* @param string|null $name The name of the template which tokens are associated with
* @param string|null $source The source code associated with the tokens
@@ -47,11 +45,6 @@ class Twig_TokenStream
$this->filename = $this->source->getName();
}
/**
* Returns a string representation of the token stream.
*
* @return string
*/
public function __toString()
{
return implode("\n", $this->tokens);
@@ -148,8 +141,6 @@ class Twig_TokenStream
}
/**
* Gets the current token.
*
* @return Twig_Token
*/
public function getCurrent()
+2 -2
View File
@@ -28,7 +28,7 @@ class Twig_Util_DeprecationCollector
* @param string $dir A directory where templates are stored
* @param string $ext Limit the loaded templates by extension
*
* @return array() An array of deprecations
* @return array An array of deprecations
*/
public function collectDir($dir, $ext = '.twig')
{
@@ -46,7 +46,7 @@ class Twig_Util_DeprecationCollector
*
* @param Iterator $iterator An iterator of templates (where keys are template names and values the contents of the template)
*
* @return array() An array of deprecations
* @return array An array of deprecations
*/
public function collect(Iterator $iterator)
{