From 1b92251272db407319c740f42929c2718bf3aaec Mon Sep 17 00:00:00 2001 From: Torben Wilson Date: Wed, 5 Nov 2008 07:38:18 +0000 Subject: [PATCH] Document that static properties may not be initialized to expressions. git-svn-id: https://svn.php.net/repository/phpdoc/en/trunk@268329 c90b9560-bf6c-de11-be94-00142212c4b1 --- language/oop5/static.xml | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/language/oop5/static.xml b/language/oop5/static.xml index 98b3288e2d..bdcefbc24f 100644 --- a/language/oop5/static.xml +++ b/language/oop5/static.xml @@ -1,5 +1,5 @@ - + Static Keyword @@ -32,6 +32,14 @@ Calling non-static methods statically generates an E_STRICT level warning. + + Like any other PHP static variable, static properties must be + initialized using a literal or constant; expressions are not + allowed. So while you may initialize a static property to an + integer or array (for instance), you may not initialize it to + another variable, to a function return value, or to an object. + + As of PHP 5.3.0, it's possible to reference the class using a variable. The variable's value can not be a keyword (e.g. self,