From 8e9afcba8806a1bef16cdfae50a5353d00f5037e Mon Sep 17 00:00:00 2001 From: =?utf8?q?C=C3=A9sar=20D=2E=20Rodas?= Date: Mon, 9 Aug 2010 01:39:51 -0400 Subject: [PATCH] - Added missing `static` declaration to avoid E_STRIC messages --- contrib/dummy.php | 2 +- contrib/meneame_pagination.php | 2 +- lib/Haanga/AST.php | 6 +++--- lib/Haanga/Compiler/Lexer.lex | 2 +- lib/Haanga/Compiler/Lexer.php | 2 +- lib/Haanga/Extension/Filter/Cut.php | 2 +- lib/Haanga/Extension/Filter/Date.php | 2 +- lib/Haanga/Extension/Filter/Default.php | 2 +- lib/Haanga/Extension/Filter/Dictsort.php | 2 +- lib/Haanga/Extension/Filter/Join.php | 2 +- lib/Haanga/Extension/Filter/Length.php | 2 +- lib/Haanga/Extension/Filter/Pluralize.php | 2 +- lib/Haanga/Extension/Filter/Reverse.php | 2 +- lib/Haanga/Extension/Filter/Safe.php | 2 +- lib/Haanga/Extension/Filter/Title.php | 2 +- lib/Haanga/Extension/Filter/Truncatewords.php | 2 +- lib/Haanga/Extension/Filter/Urlencode.php | 2 +- lib/Haanga/Extension/Tag/Cycle.php | 2 +- lib/Haanga/Extension/Tag/Dictsort.php | 2 +- lib/Haanga/Extension/Tag/Exec.php | 2 +- lib/Haanga/Extension/Tag/Firstof.php | 2 +- lib/Haanga/Extension/Tag/Setsafe.php | 2 +- lib/Haanga/Extension/Tag/Spaceless.php | 10 +++++----- lib/Haanga/Extension/Tag/Templatetag.php | 2 +- lib/Haanga/Extension/Tag/Trans.php | 2 +- tests/assert_templates/object.php | 1 + 26 files changed, 32 insertions(+), 31 deletions(-) diff --git a/contrib/dummy.php b/contrib/dummy.php index 8f50029..9f50eaf 100644 --- a/contrib/dummy.php +++ b/contrib/dummy.php @@ -4,7 +4,7 @@ Class Haanga_Extension_Tag_Dummy { public $is_block = TRUE; - function main($html) + static function main($html) { return strtolower($html); } diff --git a/contrib/meneame_pagination.php b/contrib/meneame_pagination.php index 4014f14..c8e4402 100644 --- a/contrib/meneame_pagination.php +++ b/contrib/meneame_pagination.php @@ -4,7 +4,7 @@ class Haanga_Extension_Tag_MeneamePagination { public $is_block = FALSE; - function generator($cmp, $args, $redirected) + static function generator($cmp, $args, $redirected) { if (count($args) != 3 && count($args) != 4) { throw new Haanga_CompilerException("Memeame_Pagination requires 3 or 4 parameters"); diff --git a/lib/Haanga/AST.php b/lib/Haanga/AST.php index 6436c80..c54ce33 100644 --- a/lib/Haanga/AST.php +++ b/lib/Haanga/AST.php @@ -98,12 +98,12 @@ class Haanga_AST } - function str($string) + public static function str($string) { return array("string" => $string); } - function num($number) + public static function num($number) { return array("number" => $number); } @@ -122,7 +122,7 @@ class Haanga_AST return $this; } - function constant($str) + static function constant($str) { return array('constant' => $str); } diff --git a/lib/Haanga/Compiler/Lexer.lex b/lib/Haanga/Compiler/Lexer.lex index 86c2a4b..7a95375 100644 --- a/lib/Haanga/Compiler/Lexer.lex +++ b/lib/Haanga/Compiler/Lexer.lex @@ -57,7 +57,7 @@ class Haanga_Compiler_Lexer $this->line = 1; } - function init($template, $compiler) + static function init($template, $compiler) { $lexer = new Haanga_Compiler_Lexer($template, $compiler); $parser = new Haanga_Compiler_Parser($lexer); diff --git a/lib/Haanga/Compiler/Lexer.php b/lib/Haanga/Compiler/Lexer.php index f898258..dc6d33a 100644 --- a/lib/Haanga/Compiler/Lexer.php +++ b/lib/Haanga/Compiler/Lexer.php @@ -57,7 +57,7 @@ class Haanga_Compiler_Lexer $this->line = 1; } - function init($template, $compiler) + static function init($template, $compiler) { $lexer = new Haanga_Compiler_Lexer($template, $compiler); $parser = new Haanga_Compiler_Parser($lexer); diff --git a/lib/Haanga/Extension/Filter/Cut.php b/lib/Haanga/Extension/Filter/Cut.php index 2c90ad9..123beee 100644 --- a/lib/Haanga/Extension/Filter/Cut.php +++ b/lib/Haanga/Extension/Filter/Cut.php @@ -16,7 +16,7 @@ Class Haanga_Extension_Filter_Cut * or less django style). * */ - function generator($compiler, $args) + static function generator($compiler, $args) { return hexec('str_replace', $args[1], "", $args[0]); } diff --git a/lib/Haanga/Extension/Filter/Date.php b/lib/Haanga/Extension/Filter/Date.php index a11fb92..b60b299 100644 --- a/lib/Haanga/Extension/Filter/Date.php +++ b/lib/Haanga/Extension/Filter/Date.php @@ -2,7 +2,7 @@ class Haanga_Extension_Filter_Date { - function generator($compiler, $args) + static function generator($compiler, $args) { return hexec('date', $args[1], $args[0]); } diff --git a/lib/Haanga/Extension/Filter/Default.php b/lib/Haanga/Extension/Filter/Default.php index 5fd4c8d..10ee70c 100644 --- a/lib/Haanga/Extension/Filter/Default.php +++ b/lib/Haanga/Extension/Filter/Default.php @@ -2,7 +2,7 @@ class Haanga_Extension_Filter_Default { - function generator($compiler, $args) + static function generator($compiler, $args) { return hexpr_cond(hexpr(hexec('empty', $args[0]), '==', TRUE), $args[1], $args[0]); } diff --git a/lib/Haanga/Extension/Filter/Dictsort.php b/lib/Haanga/Extension/Filter/Dictsort.php index e69c06e..e528a83 100644 --- a/lib/Haanga/Extension/Filter/Dictsort.php +++ b/lib/Haanga/Extension/Filter/Dictsort.php @@ -8,7 +8,7 @@ class Haanga_Extension_Filter_Dictsort * filter is included at rendering time, if you want * to see the generated version see tags/dictsort.php */ - function main($array, $sort_by) + static function main($array, $sort_by) { $field = array(); foreach ($array as $key => $item) { diff --git a/lib/Haanga/Extension/Filter/Join.php b/lib/Haanga/Extension/Filter/Join.php index 6d525ed..ac0b430 100644 --- a/lib/Haanga/Extension/Filter/Join.php +++ b/lib/Haanga/Extension/Filter/Join.php @@ -2,7 +2,7 @@ class Haanga_Extension_Filter_Join { - public function generator($compiler, $args) + public static function generator($compiler, $args) { if (count($args) == 1) { $args[1] = ""; diff --git a/lib/Haanga/Extension/Filter/Length.php b/lib/Haanga/Extension/Filter/Length.php index 7694eb6..face1ac 100644 --- a/lib/Haanga/Extension/Filter/Length.php +++ b/lib/Haanga/Extension/Filter/Length.php @@ -2,7 +2,7 @@ class Haanga_Extension_Filter_Length { - function generator($compiler, $args) + static function generator($compiler, $args) { if (Haanga_AST::is_str($args[0])) { return hexec('strlen', $args[0]); diff --git a/lib/Haanga/Extension/Filter/Pluralize.php b/lib/Haanga/Extension/Filter/Pluralize.php index 9a413a4..df0a434 100644 --- a/lib/Haanga/Extension/Filter/Pluralize.php +++ b/lib/Haanga/Extension/Filter/Pluralize.php @@ -2,7 +2,7 @@ class Haanga_Extension_Filter_Pluralize { - function generator($compiler, $args) + static function generator($compiler, $args) { if (count($args) > 1) { if (!Haanga_AST::is_str($args[1])) { diff --git a/lib/Haanga/Extension/Filter/Reverse.php b/lib/Haanga/Extension/Filter/Reverse.php index 111c690..4e3e454 100644 --- a/lib/Haanga/Extension/Filter/Reverse.php +++ b/lib/Haanga/Extension/Filter/Reverse.php @@ -2,7 +2,7 @@ class Haanga_Extension_Filter_Reverse { - function generator($compiler, $args) + static function generator($compiler, $args) { if (count($args) != 1) { throw new Haanga_Compiler_Exception("Reverse only needs one parameter"); diff --git a/lib/Haanga/Extension/Filter/Safe.php b/lib/Haanga/Extension/Filter/Safe.php index b74c1a2..eef6ca1 100644 --- a/lib/Haanga/Extension/Filter/Safe.php +++ b/lib/Haanga/Extension/Filter/Safe.php @@ -2,7 +2,7 @@ class Haanga_Extension_Filter_Safe { - function generator($compiler, $args) + static function generator($compiler, $args) { $compiler->var_is_safe = TRUE; return current($args); diff --git a/lib/Haanga/Extension/Filter/Title.php b/lib/Haanga/Extension/Filter/Title.php index 1ad1bae..361f4df 100644 --- a/lib/Haanga/Extension/Filter/Title.php +++ b/lib/Haanga/Extension/Filter/Title.php @@ -2,7 +2,7 @@ class Haanga_Extension_Filter_Title { - function generator($compiler, $args) + static function generator($compiler, $args) { if (count($args) != 1) { throw new Haanga_Compiler_Exception("title filter only needs one parameter"); diff --git a/lib/Haanga/Extension/Filter/Truncatewords.php b/lib/Haanga/Extension/Filter/Truncatewords.php index 48070a7..09093fa 100644 --- a/lib/Haanga/Extension/Filter/Truncatewords.php +++ b/lib/Haanga/Extension/Filter/Truncatewords.php @@ -2,7 +2,7 @@ class Haanga_Extension_Filter_Truncatewords { - function main($text, $limit) + static function main($text, $limit) { $words = explode(" ", $text, $limit+1); if (count($words) == $limit+1) { diff --git a/lib/Haanga/Extension/Filter/Urlencode.php b/lib/Haanga/Extension/Filter/Urlencode.php index 3b74140..4c2cc94 100644 --- a/lib/Haanga/Extension/Filter/Urlencode.php +++ b/lib/Haanga/Extension/Filter/Urlencode.php @@ -3,7 +3,7 @@ class Haanga_Extension_Filter_UrlEncode { - public function generator($cmp, $args) + public static function generator($cmp, $args) { $cmp->var_is_safe = TRUE; return hexec('urlencode', $args[0]); diff --git a/lib/Haanga/Extension/Tag/Cycle.php b/lib/Haanga/Extension/Tag/Cycle.php index fa89ade..6cff310 100644 --- a/lib/Haanga/Extension/Tag/Cycle.php +++ b/lib/Haanga/Extension/Tag/Cycle.php @@ -4,7 +4,7 @@ class Haanga_Extension_Tag_Cycle { public $is_block = FALSE; - function generator($cmp, $args, $declared) + static function generator($cmp, $args, $declared) { static $cycle = 0; if (!isset($cmp->cycle)) { diff --git a/lib/Haanga/Extension/Tag/Dictsort.php b/lib/Haanga/Extension/Tag/Dictsort.php index 6444c19..fa5608b 100644 --- a/lib/Haanga/Extension/Tag/Dictsort.php +++ b/lib/Haanga/Extension/Tag/Dictsort.php @@ -8,7 +8,7 @@ class Haanga_Extension_Tag_Dictsort * property on each sub-array. , if you want * to see the original php file look filters/dictsort.php */ - function generator($cmp, $args, $redirected) + static function generator($cmp, $args, $redirected) { if (!$redirected) { throw new Haanga_Compiler_Exception("dictsort must be redirected to a variable using AS "); diff --git a/lib/Haanga/Extension/Tag/Exec.php b/lib/Haanga/Extension/Tag/Exec.php index 0a3b57f..d33b40d 100644 --- a/lib/Haanga/Extension/Tag/Exec.php +++ b/lib/Haanga/Extension/Tag/Exec.php @@ -5,7 +5,7 @@ class Haanga_Extension_Tag_Exec { public $is_block = FALSE; - function generator($cmp, $args, $assign=NULL) + static function generator($cmp, $args, $assign=NULL) { if (!$cmp->getOption('allow_exec')) { throw new Haanga_Compiler_Exception("Tag exec is disabled for security reasons"); diff --git a/lib/Haanga/Extension/Tag/Firstof.php b/lib/Haanga/Extension/Tag/Firstof.php index 8c176f1..a47e37c 100644 --- a/lib/Haanga/Extension/Tag/Firstof.php +++ b/lib/Haanga/Extension/Tag/Firstof.php @@ -6,7 +6,7 @@ class Haanga_Extension_Tag_FirstOf * firstof tag * */ - function generator($cmp, $args) + static function generator($cmp, $args) { $count = count($args); $args = array_reverse($args); diff --git a/lib/Haanga/Extension/Tag/Setsafe.php b/lib/Haanga/Extension/Tag/Setsafe.php index 9db4e48..75d08c9 100644 --- a/lib/Haanga/Extension/Tag/Setsafe.php +++ b/lib/Haanga/Extension/Tag/Setsafe.php @@ -4,7 +4,7 @@ class Haanga_Extension_Tag_SetSafe { public $is_block = FALSE; - function generator($cmp, $args) + static function generator($cmp, $args) { foreach ($args as $arg) { if (Haanga_AST::is_var($arg)) { diff --git a/lib/Haanga/Extension/Tag/Spaceless.php b/lib/Haanga/Extension/Tag/Spaceless.php index 8cb723b..21a9f18 100644 --- a/lib/Haanga/Extension/Tag/Spaceless.php +++ b/lib/Haanga/Extension/Tag/Spaceless.php @@ -13,16 +13,16 @@ class Haanga_Extension_Tag_Spaceless /** * main() {{{ * - * This function contains the definition of spaceless + * This static function contains the definition of spaceless * tag, it is important not to refence to $compiler since it * will copied and paste in the generated PHP code from the - * template as a function. + * template as a static function. * * It is also important to put the start and the end of the - * function in new lines. + * static function in new lines. * * - static function main($html) + static static function main($html) { $regex = array( '/>[ \t\r\n]+[ \t\r\n]+[ \t\r\n]+$/sU'); $repl = array('><', '<', '>'); diff --git a/lib/Haanga/Extension/Tag/Templatetag.php b/lib/Haanga/Extension/Tag/Templatetag.php index 5f8dc20..28abb44 100644 --- a/lib/Haanga/Extension/Tag/Templatetag.php +++ b/lib/Haanga/Extension/Tag/Templatetag.php @@ -2,7 +2,7 @@ class Haanga_Extension_Tag_Templatetag { - function generator($compiler, $args) + static function generator($compiler, $args) { if (count($args) != 1) { throw new Haanga_Compiler_Exception("templatetag only needs one parameter"); diff --git a/lib/Haanga/Extension/Tag/Trans.php b/lib/Haanga/Extension/Tag/Trans.php index 92ee42a..548596d 100644 --- a/lib/Haanga/Extension/Tag/Trans.php +++ b/lib/Haanga/Extension/Tag/Trans.php @@ -4,7 +4,7 @@ class Haanga_Extension_Tag_Trans { public $is_block = FALSE; - function generator($cmp, $args, $rebuild) + static function generator($cmp, $args, $rebuild) { $code = hcode(); diff --git a/tests/assert_templates/object.php b/tests/assert_templates/object.php index bda53dc..b8005fc 100644 --- a/tests/assert_templates/object.php +++ b/tests/assert_templates/object.php @@ -1,5 +1,6 @@ name = 'foo'; $obj->obj['name'] = 'bar'; $arr['obj'] = $obj; -- 2.11.4.GIT