Merge branch '1.x'

* 1.x:
  move property initialization to the declaration when possible
  optimized the filesystem loader
This commit is contained in:
Fabien Potencier
2015-08-22 17:50:35 +02:00
6 changed files with 11 additions and 20 deletions
+1 -2
View File
@@ -21,7 +21,7 @@ class Twig_Compiler
private $source;
private $indentation;
private $env;
private $debugInfo;
private $debugInfo = array();
private $sourceOffset;
private $sourceLine;
private $filename;
@@ -34,7 +34,6 @@ class Twig_Compiler
public function __construct(Twig_Environment $env)
{
$this->env = $env;
$this->debugInfo = array();
}
public function getFilename()
+4 -8
View File
@@ -34,15 +34,15 @@ class Twig_Environment
protected $tests;
protected $functions;
protected $globals;
protected $runtimeInitialized;
protected $extensionInitialized;
protected $runtimeInitialized = false;
protected $extensionInitialized = false;
protected $loadedTemplates;
protected $strictVariables;
protected $unaryOperators;
protected $binaryOperators;
protected $templateClassPrefix = '__TwigTemplate_';
protected $functionCallbacks;
protected $filterCallbacks;
protected $functionCallbacks = array();
protected $filterCallbacks = array();
protected $staging;
/**
@@ -101,15 +101,11 @@ class Twig_Environment
$this->baseTemplateClass = $options['base_template_class'];
$this->autoReload = null === $options['auto_reload'] ? $this->debug : (bool) $options['auto_reload'];
$this->strictVariables = (bool) $options['strict_variables'];
$this->runtimeInitialized = false;
$this->setCache($options['cache']);
$this->functionCallbacks = array();
$this->filterCallbacks = array();
$this->addExtension(new Twig_Extension_Core());
$this->addExtension(new Twig_Extension_Escaper($options['autoescape']));
$this->addExtension(new Twig_Extension_Optimizer($options['optimizations']));
$this->extensionInitialized = false;
$this->staging = new Twig_Extension_Staging();
}
+2 -2
View File
@@ -11,11 +11,11 @@
class Twig_Extension_Profiler extends Twig_Extension
{
private $actives;
private $actives = array();
public function __construct(Twig_Profiler_Profile $profile)
{
$this->actives = array($profile);
$this->actives[] = $profile;
}
public function enter(Twig_Profiler_Profile $profile)
+1 -2
View File
@@ -19,7 +19,7 @@
class Twig_NodeTraverser
{
private $env;
private $visitors;
private $visitors = array();
/**
* Constructor.
@@ -30,7 +30,6 @@ class Twig_NodeTraverser
public function __construct(Twig_Environment $env, array $visitors = array())
{
$this->env = $env;
$this->visitors = array();
foreach ($visitors as $visitor) {
$this->addVisitor($visitor);
}
+2 -4
View File
@@ -26,8 +26,8 @@ abstract class Twig_Template
protected $parent;
protected $parents = array();
protected $env;
protected $blocks;
protected $traits;
protected $blocks = array();
protected $traits = array();
/**
* Constructor.
@@ -37,8 +37,6 @@ abstract class Twig_Template
public function __construct(Twig_Environment $env)
{
$this->env = $env;
$this->blocks = array();
$this->traits = array();
}
/**
+1 -2
View File
@@ -18,7 +18,7 @@
class Twig_TokenStream
{
private $tokens;
private $current;
private $current = 0;
private $filename;
/**
@@ -30,7 +30,6 @@ class Twig_TokenStream
public function __construct(array $tokens, $filename = null)
{
$this->tokens = $tokens;
$this->current = 0;
$this->filename = $filename;
}