mirror of
https://github.com/twigphp/Twig.git
synced 2026-09-12 18:36:53 +00:00
moved some more PSR0 class names to namespaced ones
This commit is contained in:
@@ -17,7 +17,7 @@ use Twig\TokenParser\TokenParserInterface;
|
||||
/**
|
||||
* Internal class.
|
||||
*
|
||||
* This class is used by \Twig_Environment as a staging area and must not be used directly.
|
||||
* This class is used by \Twig\Environment as a staging area and must not be used directly.
|
||||
*
|
||||
* @author Fabien Potencier <fabien@symfony.com>
|
||||
*
|
||||
|
||||
+1
-1
@@ -82,7 +82,7 @@ class Lexer implements \Twig_LexerInterface
|
||||
public function tokenize($code, $name = null)
|
||||
{
|
||||
if (!$code instanceof Source) {
|
||||
@trigger_error(sprintf('Passing a string as the $code argument of %s() is deprecated since version 1.27 and will be removed in 2.0. Pass a \Twig_Source instance instead.', __METHOD__), E_USER_DEPRECATED);
|
||||
@trigger_error(sprintf('Passing a string as the $code argument of %s() is deprecated since version 1.27 and will be removed in 2.0. Pass a \Twig\Source instance instead.', __METHOD__), E_USER_DEPRECATED);
|
||||
$this->source = new Source($code, $name);
|
||||
} else {
|
||||
$this->source = $code;
|
||||
|
||||
@@ -33,7 +33,7 @@ class ModuleNode extends Node
|
||||
public function __construct(\Twig_NodeInterface $body, AbstractExpression $parent = null, \Twig_NodeInterface $blocks, \Twig_NodeInterface $macros, \Twig_NodeInterface $traits, $embeddedTemplates, $name, $source = '')
|
||||
{
|
||||
if (!$name instanceof Source) {
|
||||
@trigger_error(sprintf('Passing a string as the $name argument of %s() is deprecated since version 1.27. Pass a \Twig_Source instance instead.', __METHOD__), E_USER_DEPRECATED);
|
||||
@trigger_error(sprintf('Passing a string as the $name argument of %s() is deprecated since version 1.27. Pass a \Twig\Source instance instead.', __METHOD__), E_USER_DEPRECATED);
|
||||
$this->source = new Source($source, $name);
|
||||
} else {
|
||||
$this->source = $name;
|
||||
|
||||
@@ -15,8 +15,7 @@ use Twig\Compiler;
|
||||
use Twig\Node\Expression\FilterExpression;
|
||||
|
||||
/**
|
||||
* \Twig_Node_SandboxedPrint adds a check for the __toString() method
|
||||
* when the variable is an object and the sandbox is activated.
|
||||
* Adds a check for the __toString() method when the variable is an object and the sandbox is activated.
|
||||
*
|
||||
* When there is a simple Print statement, like {{ article }},
|
||||
* and if the sandbox is enabled, we need to check that the __toString()
|
||||
|
||||
@@ -14,7 +14,7 @@ namespace Twig;
|
||||
use Twig\NodeVisitor\NodeVisitorInterface;
|
||||
|
||||
/**
|
||||
* \Twig_NodeTraverser is a node traverser.
|
||||
* A node traverser.
|
||||
*
|
||||
* It visits all nodes and their children and calls the given visitor for each.
|
||||
*
|
||||
|
||||
@@ -15,7 +15,7 @@ use Twig\Environment;
|
||||
use Twig\Node\Node;
|
||||
|
||||
/**
|
||||
* \Twig_BaseNodeVisitor can be used to make node visitors compatible with Twig 1.x and 2.x.
|
||||
* Used to make node visitors compatible with Twig 1.x and 2.x.
|
||||
*
|
||||
* @author Fabien Potencier <fabien@symfony.com>
|
||||
*/
|
||||
@@ -24,7 +24,7 @@ abstract class AbstractNodeVisitor implements NodeVisitorInterface
|
||||
final public function enterNode(\Twig_NodeInterface $node, Environment $env)
|
||||
{
|
||||
if (!$node instanceof Node) {
|
||||
throw new \LogicException(sprintf('%s only supports \Twig_Node instances.', __CLASS__));
|
||||
throw new \LogicException(sprintf('%s only supports \Twig\Node\Node instances.', __CLASS__));
|
||||
}
|
||||
|
||||
return $this->doEnterNode($node, $env);
|
||||
@@ -33,7 +33,7 @@ abstract class AbstractNodeVisitor implements NodeVisitorInterface
|
||||
final public function leaveNode(\Twig_NodeInterface $node, Environment $env)
|
||||
{
|
||||
if (!$node instanceof Node) {
|
||||
throw new \LogicException(sprintf('%s only supports \Twig_Node instances.', __CLASS__));
|
||||
throw new \LogicException(sprintf('%s only supports \Twig\Node\Node instances.', __CLASS__));
|
||||
}
|
||||
|
||||
return $this->doLeaveNode($node, $env);
|
||||
|
||||
@@ -24,8 +24,6 @@ use Twig\Node\PrintNode;
|
||||
use Twig\NodeTraverser;
|
||||
|
||||
/**
|
||||
* \Twig_NodeVisitor_Escaper implements output escaping.
|
||||
*
|
||||
* @final
|
||||
*
|
||||
* @author Fabien Potencier <fabien@symfony.com>
|
||||
|
||||
@@ -30,7 +30,7 @@ use Twig\Node\PrintNode;
|
||||
use Twig\Node\SetTempNode;
|
||||
|
||||
/**
|
||||
* \Twig_NodeVisitor_Optimizer tries to optimizes the AST.
|
||||
* Tries to optimize the AST.
|
||||
*
|
||||
* This visitor is always the last registered one.
|
||||
*
|
||||
|
||||
@@ -22,8 +22,6 @@ use Twig\Node\PrintNode;
|
||||
use Twig\Node\SandboxedPrintNode;
|
||||
|
||||
/**
|
||||
* \Twig_NodeVisitor_Sandbox implements sandboxing.
|
||||
*
|
||||
* @final
|
||||
*
|
||||
* @author Fabien Potencier <fabien@symfony.com>
|
||||
|
||||
+8
-8
@@ -21,7 +21,7 @@ use Twig\Error\RuntimeError;
|
||||
*
|
||||
* This class is an implementation detail of how template compilation currently
|
||||
* works, which might change. It should never be used directly. Use $twig->load()
|
||||
* instead, which returns an instance of \Twig_TemplateWrapper.
|
||||
* instead, which returns an instance of \Twig\TemplateWrapper.
|
||||
*
|
||||
* @author Fabien Potencier <fabien@symfony.com>
|
||||
*
|
||||
@@ -213,7 +213,7 @@ abstract class Template implements \Twig_TemplateInterface
|
||||
|
||||
// avoid RCEs when sandbox is enabled
|
||||
if (null !== $template && !$template instanceof self) {
|
||||
throw new \LogicException('A block must be a method on a \Twig_Template instance.');
|
||||
throw new \LogicException('A block must be a method on a \Twig\Template instance.');
|
||||
}
|
||||
|
||||
if (null !== $template) {
|
||||
@@ -224,8 +224,8 @@ abstract class Template implements \Twig_TemplateInterface
|
||||
$e->setSourceContext($template->getSourceContext());
|
||||
}
|
||||
|
||||
// this is mostly useful for \Twig_Error_Loader exceptions
|
||||
// see \Twig_Error_Loader
|
||||
// this is mostly useful for \Twig\Error\LoaderError exceptions
|
||||
// see \Twig\Error\LoaderError
|
||||
if (false === $e->getTemplateLine()) {
|
||||
$e->setTemplateLine(-1);
|
||||
$e->guess();
|
||||
@@ -437,8 +437,8 @@ abstract class Template implements \Twig_TemplateInterface
|
||||
$e->setSourceContext($this->getSourceContext());
|
||||
}
|
||||
|
||||
// this is mostly useful for \Twig_Error_Loader exceptions
|
||||
// see \Twig_Error_Loader
|
||||
// this is mostly useful for \Twig\Error\LoaderError exceptions
|
||||
// see \Twig\Error\LoaderError
|
||||
if (false === $e->getTemplateLine()) {
|
||||
$e->setTemplateLine(-1);
|
||||
$e->guess();
|
||||
@@ -498,7 +498,7 @@ abstract class Template implements \Twig_TemplateInterface
|
||||
* @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 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
|
||||
*
|
||||
@@ -580,7 +580,7 @@ abstract class Template implements \Twig_TemplateInterface
|
||||
}
|
||||
|
||||
// object property
|
||||
if (self::METHOD_CALL !== $type && !$object instanceof self) { // \Twig_Template does not have public properties, and we don't want to allow access to internal ones
|
||||
if (self::METHOD_CALL !== $type && !$object instanceof self) { // \Twig\Template does not have public properties, and we don't want to allow access to internal ones
|
||||
if (isset($object->$item) || \array_key_exists((string) $item, $object)) {
|
||||
if ($isDefinedTest) {
|
||||
return true;
|
||||
|
||||
@@ -20,14 +20,8 @@ use Twig\Parser;
|
||||
*/
|
||||
abstract class AbstractTokenParser implements TokenParserInterface
|
||||
{
|
||||
/**
|
||||
* @var \Twig_Parser
|
||||
*/
|
||||
protected $parser;
|
||||
|
||||
/**
|
||||
* Sets the parser associated with this token parser.
|
||||
*/
|
||||
public function setParser(Parser $parser)
|
||||
{
|
||||
$this->parser = $parser;
|
||||
|
||||
+1
-1
@@ -38,7 +38,7 @@ class TokenStream
|
||||
{
|
||||
if (!$name instanceof Source) {
|
||||
if (null !== $name || null !== $source) {
|
||||
@trigger_error(sprintf('Passing a string as the $name argument of %s() is deprecated since version 1.27. Pass a \Twig_Source instance instead.', __METHOD__), E_USER_DEPRECATED);
|
||||
@trigger_error(sprintf('Passing a string as the $name argument of %s() is deprecated since version 1.27. Pass a \Twig\Source instance instead.', __METHOD__), E_USER_DEPRECATED);
|
||||
}
|
||||
$this->source = new Source($source, $name);
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user