Skip to content
This repository
Browse code

- Added missing `static` declaration to avoid E_STRIC messages

  • Loading branch information...
commit 8e9afcba8806a1bef16cdfae50a5353d00f5037e 1 parent cfe4801
César D. Rodas authored August 09, 2010
2  contrib/dummy.php
@@ -4,7 +4,7 @@
4 4
 {
5 5
     public $is_block = TRUE;
6 6
 
7  
-    function main($html)
  7
+    static function main($html)
8 8
     {
9 9
         return strtolower($html);
10 10
     }
2  contrib/meneame_pagination.php
@@ -4,7 +4,7 @@ class Haanga_Extension_Tag_MeneamePagination
4 4
 {
5 5
     public $is_block = FALSE;
6 6
 
7  
-    function generator($cmp, $args, $redirected)
  7
+    static function generator($cmp, $args, $redirected)
8 8
     {
9 9
         if (count($args) != 3 && count($args) != 4) {
10 10
             throw new Haanga_CompilerException("Memeame_Pagination requires 3 or 4 parameters");
6  lib/Haanga/AST.php
@@ -98,12 +98,12 @@ public static function is_expr($arr)
98 98
     }
99 99
 
100 100
 
101  
-    function str($string)
  101
+    public static function str($string)
102 102
     {
103 103
         return array("string" => $string);
104 104
     }
105 105
 
106  
-    function num($number)
  106
+    public static function num($number)
107 107
     {
108 108
         return array("number" => $number);
109 109
     }
@@ -122,7 +122,7 @@ function append_ast(Haanga_AST $obj)
122 122
         return $this;
123 123
     }
124 124
 
125  
-    function constant($str)
  125
+    static function constant($str)
126 126
     {
127 127
         return array('constant' => $str);
128 128
     }
2  lib/Haanga/Compiler/Lexer.lex
@@ -57,7 +57,7 @@ class Haanga_Compiler_Lexer
57 57
         $this->line     = 1;
58 58
     }
59 59
 
60  
-    function init($template, $compiler)
  60
+    static function init($template, $compiler)
61 61
     {
62 62
         $lexer  = new Haanga_Compiler_Lexer($template, $compiler);
63 63
         $parser = new Haanga_Compiler_Parser($lexer);
2  lib/Haanga/Compiler/Lexer.php
@@ -57,7 +57,7 @@ function __construct($data, $compiler)
57 57
         $this->line     = 1;
58 58
     }
59 59
 
60  
-    function init($template, $compiler)
  60
+    static function init($template, $compiler)
61 61
     {
62 62
         $lexer  = new Haanga_Compiler_Lexer($template, $compiler);
63 63
         $parser = new Haanga_Compiler_Parser($lexer);
2  lib/Haanga/Extension/Filter/Cut.php
@@ -16,7 +16,7 @@
16 16
      *  or less django style).
17 17
      *  
18 18
      */
19  
-    function generator($compiler, $args)
  19
+    static function generator($compiler, $args)
20 20
     {
21 21
         return hexec('str_replace', $args[1], "", $args[0]);
22 22
     }
2  lib/Haanga/Extension/Filter/Date.php
@@ -2,7 +2,7 @@
2 2
 
3 3
 class Haanga_Extension_Filter_Date
4 4
 {
5  
-    function generator($compiler, $args)
  5
+    static function generator($compiler, $args)
6 6
     {
7 7
         return hexec('date', $args[1], $args[0]);
8 8
     }
2  lib/Haanga/Extension/Filter/Default.php
@@ -2,7 +2,7 @@
2 2
 
3 3
 class Haanga_Extension_Filter_Default
4 4
 {
5  
-    function generator($compiler, $args)
  5
+    static function generator($compiler, $args)
6 6
     {
7 7
         return hexpr_cond(hexpr(hexec('empty', $args[0]), '==', TRUE), $args[1], $args[0]);
8 8
     }
2  lib/Haanga/Extension/Filter/Dictsort.php
@@ -8,7 +8,7 @@ class Haanga_Extension_Filter_Dictsort
8 8
      *  filter is included at rendering time, if you want 
9 9
      *  to see the generated version see tags/dictsort.php
10 10
      */
11  
-    function main($array, $sort_by)
  11
+    static function main($array, $sort_by)
12 12
     {
13 13
         $field = array();
14 14
         foreach ($array as $key => $item) {
2  lib/Haanga/Extension/Filter/Join.php
@@ -2,7 +2,7 @@
2 2
 
3 3
 class Haanga_Extension_Filter_Join
4 4
 {
5  
-    public function generator($compiler, $args)
  5
+    public static function generator($compiler, $args)
6 6
     {
7 7
         if (count($args) == 1) {
8 8
             $args[1] = "";
2  lib/Haanga/Extension/Filter/Length.php
@@ -2,7 +2,7 @@
2 2
 
3 3
 class Haanga_Extension_Filter_Length
4 4
 {
5  
-    function generator($compiler, $args)
  5
+    static function generator($compiler, $args)
6 6
     {
7 7
         if (Haanga_AST::is_str($args[0])) {
8 8
             return hexec('strlen', $args[0]);
2  lib/Haanga/Extension/Filter/Pluralize.php
@@ -2,7 +2,7 @@
2 2
 
3 3
 class Haanga_Extension_Filter_Pluralize
4 4
 {
5  
-    function generator($compiler, $args)
  5
+    static function generator($compiler, $args)
6 6
     {
7 7
         if (count($args) > 1) {
8 8
             if (!Haanga_AST::is_str($args[1])) {
2  lib/Haanga/Extension/Filter/Reverse.php
@@ -2,7 +2,7 @@
2 2
 
3 3
 class Haanga_Extension_Filter_Reverse
4 4
 {
5  
-    function generator($compiler, $args)
  5
+    static function generator($compiler, $args)
6 6
     {
7 7
         if (count($args) != 1) {
8 8
             throw new Haanga_Compiler_Exception("Reverse only needs one parameter");
2  lib/Haanga/Extension/Filter/Safe.php
@@ -2,7 +2,7 @@
2 2
 
3 3
 class Haanga_Extension_Filter_Safe
4 4
 {
5  
-    function generator($compiler, $args)
  5
+    static function generator($compiler, $args)
6 6
     {
7 7
         $compiler->var_is_safe = TRUE;
8 8
         return current($args);
2  lib/Haanga/Extension/Filter/Title.php
@@ -2,7 +2,7 @@
2 2
 
3 3
 class Haanga_Extension_Filter_Title
4 4
 {
5  
-    function generator($compiler, $args)
  5
+    static function generator($compiler, $args)
6 6
     {
7 7
         if (count($args) != 1) {
8 8
             throw new Haanga_Compiler_Exception("title filter only needs one parameter");
2  lib/Haanga/Extension/Filter/Truncatewords.php
@@ -2,7 +2,7 @@
2 2
 
3 3
 class Haanga_Extension_Filter_Truncatewords
4 4
 {
5  
-    function main($text, $limit)
  5
+    static function main($text, $limit)
6 6
     {
7 7
         $words = explode(" ", $text, $limit+1);
8 8
         if (count($words) == $limit+1) {
2  lib/Haanga/Extension/Filter/Urlencode.php
@@ -3,7 +3,7 @@
3 3
 class Haanga_Extension_Filter_UrlEncode
4 4
 {
5 5
 
6  
-    public function generator($cmp, $args)
  6
+    public static function generator($cmp, $args)
7 7
     {
8 8
         $cmp->var_is_safe = TRUE;
9 9
         return hexec('urlencode', $args[0]);
2  lib/Haanga/Extension/Tag/Cycle.php
@@ -4,7 +4,7 @@ class Haanga_Extension_Tag_Cycle
4 4
 {
5 5
     public $is_block = FALSE;
6 6
 
7  
-    function generator($cmp, $args, $declared)
  7
+    static function generator($cmp, $args, $declared)
8 8
     {
9 9
         static $cycle = 0;
10 10
         if (!isset($cmp->cycle)) {
2  lib/Haanga/Extension/Tag/Dictsort.php
@@ -8,7 +8,7 @@ class Haanga_Extension_Tag_Dictsort
8 8
      *  property on each sub-array. , if you want 
9 9
      *  to see the original php file look filters/dictsort.php
10 10
      */
11  
-    function generator($cmp, $args, $redirected)
  11
+    static function generator($cmp, $args, $redirected)
12 12
     {
13 13
         if (!$redirected) {
14 14
             throw new Haanga_Compiler_Exception("dictsort must be redirected to a variable using AS <varname>");
2  lib/Haanga/Extension/Tag/Exec.php
@@ -5,7 +5,7 @@ class Haanga_Extension_Tag_Exec
5 5
 {
6 6
     public $is_block = FALSE;
7 7
 
8  
-    function generator($cmp, $args, $assign=NULL)
  8
+    static function generator($cmp, $args, $assign=NULL)
9 9
     {
10 10
         if (!$cmp->getOption('allow_exec')) {
11 11
             throw new Haanga_Compiler_Exception("Tag exec is disabled for security reasons");
2  lib/Haanga/Extension/Tag/Firstof.php
@@ -6,7 +6,7 @@ class Haanga_Extension_Tag_FirstOf
6 6
      *  firstof tag
7 7
      *
8 8
      */
9  
-    function generator($cmp, $args)
  9
+    static function generator($cmp, $args)
10 10
     {
11 11
         $count = count($args);
12 12
         $args  = array_reverse($args);
2  lib/Haanga/Extension/Tag/Setsafe.php
@@ -4,7 +4,7 @@ class Haanga_Extension_Tag_SetSafe
4 4
 {
5 5
     public $is_block = FALSE;
6 6
 
7  
-    function generator($cmp, $args)
  7
+    static function generator($cmp, $args)
8 8
     {
9 9
         foreach ($args as $arg) {
10 10
             if (Haanga_AST::is_var($arg)) {
10  lib/Haanga/Extension/Tag/Spaceless.php
@@ -13,16 +13,16 @@ class Haanga_Extension_Tag_Spaceless
13 13
     /**
14 14
      *  main() {{{
15 15
      *
16  
-     *  This function contains the definition of spaceless
  16
+     *  This static function contains the definition of spaceless
17 17
      *  tag, it is important not to refence to $compiler since it
18 18
      *  will copied and paste in the generated PHP code from the 
19  
-     *  template as a function.
  19
+     *  template as a static function.
20 20
      *
21 21
      *  It is also important to put the start and the end of the 
22  
-     *  function in new lines.
  22
+     *  static function in new lines.
23 23
      *
24 24
      *
25  
-    static function main($html)
  25
+    static static function main($html)
26 26
     {
27 27
         $regex = array(
28 28
             '/>[ \t\r\n]+</sU',
@@ -39,7 +39,7 @@ static function main($html)
39 39
      *  calling Spaceless_Tag::main() at everytime.
40 40
      *
41 41
      */
42  
-    function generator($compiler, $args)
  42
+    static function generator($compiler, $args)
43 43
     {
44 44
         $regex = array('/>[ \t\r\n]+</sU','/^[ \t\r\n]+</sU','/>[ \t\r\n]+$/sU');
45 45
         $repl  = array('><', '<', '>');
2  lib/Haanga/Extension/Tag/Templatetag.php
@@ -2,7 +2,7 @@
2 2
 
3 3
 class Haanga_Extension_Tag_Templatetag
4 4
 {
5  
-    function generator($compiler, $args)
  5
+    static function generator($compiler, $args)
6 6
     {
7 7
         if (count($args) != 1) {
8 8
             throw new Haanga_Compiler_Exception("templatetag only needs one parameter");
2  lib/Haanga/Extension/Tag/Trans.php
@@ -4,7 +4,7 @@ class Haanga_Extension_Tag_Trans
4 4
 {
5 5
     public $is_block = FALSE;
6 6
 
7  
-    function generator($cmp, $args, $rebuild)
  7
+    static function generator($cmp, $args, $rebuild)
8 8
     {
9 9
         $code = hcode();
10 10
 
1  tests/assert_templates/object.php
... ...
@@ -1,5 +1,6 @@
1 1
 <?php
2 2
 
  3
+$obj = new Stdclass;
3 4
 $obj->name = 'foo';
4 5
 $obj->obj['name'] = 'bar';
5 6
 $arr['obj'] = $obj;

0 notes on commit 8e9afcb

Please sign in to comment.
Something went wrong with that request. Please try again.