diff --git a/lib/Twig/Compiler.php b/lib/Twig/Compiler.php index 2514c31e8..abea3aafe 100644 --- a/lib/Twig/Compiler.php +++ b/lib/Twig/Compiler.php @@ -21,7 +21,7 @@ class Twig_Compiler implements Twig_CompilerInterface protected $source; protected $indentation; protected $env; - protected $debugInfo; + protected $debugInfo = array(); protected $sourceOffset; protected $sourceLine; protected $filename; @@ -34,7 +34,6 @@ class Twig_Compiler implements Twig_CompilerInterface public function __construct(Twig_Environment $env) { $this->env = $env; - $this->debugInfo = array(); } public function getFilename() diff --git a/lib/Twig/Environment.php b/lib/Twig/Environment.php index f68e373d1..7318fe18d 100644 --- a/lib/Twig/Environment.php +++ b/lib/Twig/Environment.php @@ -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; /** @@ -106,15 +106,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(); } diff --git a/lib/Twig/Extension/Profiler.php b/lib/Twig/Extension/Profiler.php index 35e04a013..e21fdb6e2 100644 --- a/lib/Twig/Extension/Profiler.php +++ b/lib/Twig/Extension/Profiler.php @@ -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) diff --git a/lib/Twig/NodeTraverser.php b/lib/Twig/NodeTraverser.php index 6024e65d0..00f7b54b6 100644 --- a/lib/Twig/NodeTraverser.php +++ b/lib/Twig/NodeTraverser.php @@ -19,7 +19,7 @@ class Twig_NodeTraverser { protected $env; - protected $visitors; + protected $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); } diff --git a/lib/Twig/Template.php b/lib/Twig/Template.php index cf7c79d2e..e2ab05a24 100644 --- a/lib/Twig/Template.php +++ b/lib/Twig/Template.php @@ -22,8 +22,8 @@ abstract class Twig_Template implements Twig_TemplateInterface protected $parent; protected $parents = array(); protected $env; - protected $blocks; - protected $traits; + protected $blocks = array(); + protected $traits = array(); /** * Constructor. @@ -33,8 +33,6 @@ abstract class Twig_Template implements Twig_TemplateInterface public function __construct(Twig_Environment $env) { $this->env = $env; - $this->blocks = array(); - $this->traits = array(); } /** diff --git a/lib/Twig/TokenStream.php b/lib/Twig/TokenStream.php index 89d2575a8..8d2e220fe 100644 --- a/lib/Twig/TokenStream.php +++ b/lib/Twig/TokenStream.php @@ -18,7 +18,7 @@ class Twig_TokenStream { protected $tokens; - protected $current; + protected $current = 0; protected $filename; /** @@ -30,7 +30,6 @@ class Twig_TokenStream public function __construct(array $tokens, $filename = null) { $this->tokens = $tokens; - $this->current = 0; $this->filename = $filename; }