moved some more PSR0 class names to namespaced ones

This commit is contained in:
Fabien Potencier
2019-03-06 13:45:57 +01:00
parent f16405f797
commit 4eb0c9da8e
12 changed files with 18 additions and 29 deletions
+1 -1
View File
@@ -17,7 +17,7 @@ use Twig\TokenParser\TokenParserInterface;
/** /**
* Internal class. * 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> * @author Fabien Potencier <fabien@symfony.com>
* *
+1 -1
View File
@@ -82,7 +82,7 @@ class Lexer implements \Twig_LexerInterface
public function tokenize($code, $name = null) public function tokenize($code, $name = null)
{ {
if (!$code instanceof Source) { 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); $this->source = new Source($code, $name);
} else { } else {
$this->source = $code; $this->source = $code;
+1 -1
View File
@@ -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 = '') 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) { 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); $this->source = new Source($source, $name);
} else { } else {
$this->source = $name; $this->source = $name;
+1 -2
View File
@@ -15,8 +15,7 @@ use Twig\Compiler;
use Twig\Node\Expression\FilterExpression; use Twig\Node\Expression\FilterExpression;
/** /**
* \Twig_Node_SandboxedPrint adds a check for the __toString() method * Adds a check for the __toString() method when the variable is an object and the sandbox is activated.
* when the variable is an object and the sandbox is activated.
* *
* When there is a simple Print statement, like {{ article }}, * When there is a simple Print statement, like {{ article }},
* and if the sandbox is enabled, we need to check that the __toString() * and if the sandbox is enabled, we need to check that the __toString()
+1 -1
View File
@@ -14,7 +14,7 @@ namespace Twig;
use Twig\NodeVisitor\NodeVisitorInterface; 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. * It visits all nodes and their children and calls the given visitor for each.
* *
+3 -3
View File
@@ -15,7 +15,7 @@ use Twig\Environment;
use Twig\Node\Node; 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> * @author Fabien Potencier <fabien@symfony.com>
*/ */
@@ -24,7 +24,7 @@ abstract class AbstractNodeVisitor implements NodeVisitorInterface
final public function enterNode(\Twig_NodeInterface $node, Environment $env) final public function enterNode(\Twig_NodeInterface $node, Environment $env)
{ {
if (!$node instanceof Node) { 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); return $this->doEnterNode($node, $env);
@@ -33,7 +33,7 @@ abstract class AbstractNodeVisitor implements NodeVisitorInterface
final public function leaveNode(\Twig_NodeInterface $node, Environment $env) final public function leaveNode(\Twig_NodeInterface $node, Environment $env)
{ {
if (!$node instanceof Node) { 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); return $this->doLeaveNode($node, $env);
-2
View File
@@ -24,8 +24,6 @@ use Twig\Node\PrintNode;
use Twig\NodeTraverser; use Twig\NodeTraverser;
/** /**
* \Twig_NodeVisitor_Escaper implements output escaping.
*
* @final * @final
* *
* @author Fabien Potencier <fabien@symfony.com> * @author Fabien Potencier <fabien@symfony.com>
+1 -1
View File
@@ -30,7 +30,7 @@ use Twig\Node\PrintNode;
use Twig\Node\SetTempNode; 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. * This visitor is always the last registered one.
* *
-2
View File
@@ -22,8 +22,6 @@ use Twig\Node\PrintNode;
use Twig\Node\SandboxedPrintNode; use Twig\Node\SandboxedPrintNode;
/** /**
* \Twig_NodeVisitor_Sandbox implements sandboxing.
*
* @final * @final
* *
* @author Fabien Potencier <fabien@symfony.com> * @author Fabien Potencier <fabien@symfony.com>
+8 -8
View File
@@ -21,7 +21,7 @@ use Twig\Error\RuntimeError;
* *
* This class is an implementation detail of how template compilation currently * This class is an implementation detail of how template compilation currently
* works, which might change. It should never be used directly. Use $twig->load() * 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> * @author Fabien Potencier <fabien@symfony.com>
* *
@@ -213,7 +213,7 @@ abstract class Template implements \Twig_TemplateInterface
// avoid RCEs when sandbox is enabled // avoid RCEs when sandbox is enabled
if (null !== $template && !$template instanceof self) { 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) { if (null !== $template) {
@@ -224,8 +224,8 @@ abstract class Template implements \Twig_TemplateInterface
$e->setSourceContext($template->getSourceContext()); $e->setSourceContext($template->getSourceContext());
} }
// this is mostly useful for \Twig_Error_Loader exceptions // this is mostly useful for \Twig\Error\LoaderError exceptions
// see \Twig_Error_Loader // see \Twig\Error\LoaderError
if (false === $e->getTemplateLine()) { if (false === $e->getTemplateLine()) {
$e->setTemplateLine(-1); $e->setTemplateLine(-1);
$e->guess(); $e->guess();
@@ -437,8 +437,8 @@ abstract class Template implements \Twig_TemplateInterface
$e->setSourceContext($this->getSourceContext()); $e->setSourceContext($this->getSourceContext());
} }
// this is mostly useful for \Twig_Error_Loader exceptions // this is mostly useful for \Twig\Error\LoaderError exceptions
// see \Twig_Error_Loader // see \Twig\Error\LoaderError
if (false === $e->getTemplateLine()) { if (false === $e->getTemplateLine()) {
$e->setTemplateLine(-1); $e->setTemplateLine(-1);
$e->guess(); $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 $object The object or array from where to get the item
* @param mixed $item The item to get from the array or object * @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 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 $isDefinedTest Whether this is only a defined check
* @param bool $ignoreStrictCheck Whether to ignore the strict attribute check or not * @param bool $ignoreStrictCheck Whether to ignore the strict attribute check or not
* *
@@ -580,7 +580,7 @@ abstract class Template implements \Twig_TemplateInterface
} }
// object property // 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 (isset($object->$item) || \array_key_exists((string) $item, $object)) {
if ($isDefinedTest) { if ($isDefinedTest) {
return true; return true;
-6
View File
@@ -20,14 +20,8 @@ use Twig\Parser;
*/ */
abstract class AbstractTokenParser implements TokenParserInterface abstract class AbstractTokenParser implements TokenParserInterface
{ {
/**
* @var \Twig_Parser
*/
protected $parser; protected $parser;
/**
* Sets the parser associated with this token parser.
*/
public function setParser(Parser $parser) public function setParser(Parser $parser)
{ {
$this->parser = $parser; $this->parser = $parser;
+1 -1
View File
@@ -38,7 +38,7 @@ class TokenStream
{ {
if (!$name instanceof Source) { if (!$name instanceof Source) {
if (null !== $name || null !== $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); $this->source = new Source($source, $name);
} else { } else {