From 544a83533002b3640f12a32d30ce50898de45499 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Thiemo=20M=C3=A4ttig?= Date: Wed, 16 Apr 2014 16:13:46 +0200 Subject: [PATCH] Documentation for page_props getter in ParserOutput I would love to make this getter return null instead of false, similar to getExtensionData() in the same class. A property that's not set should be null. Not a boolean. This makes it impossible to have boolean properties. But I can't change this because it's used in extensions with "!== false" and such. Change-Id: I2bc0bed1c58435d791f7a055bac2763a3411bb6f --- includes/parser/ParserOutput.php | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/includes/parser/ParserOutput.php b/includes/parser/ParserOutput.php index 931c08832c..b4a1c5dd8c 100644 --- a/includes/parser/ParserOutput.php +++ b/includes/parser/ParserOutput.php @@ -573,6 +573,14 @@ class ParserOutput extends CacheTime { $this->mProperties[$name] = $value; } + /** + * @param string $name The property name to look up. + * + * @return mixed|false The value previously set using setProperty(). False if null or no value + * was set for the given property name. + * + * @note You need to use getProperties() to check for boolean and null properties. + */ public function getProperty( $name ) { return isset( $this->mProperties[$name] ) ? $this->mProperties[$name] : false; } @@ -706,7 +714,7 @@ class ParserOutput extends CacheTime { * * @param string $key The key to look up. * - * @return mixed The value previously set for the given key using setExtensionData( $key ), + * @return mixed|null The value previously set for the given key using setExtensionData() * or null if no value was set for this key. */ public function getExtensionData( $key ) { -- 2.20.1