Documentation for page_props getter in ParserOutput
authorThiemo Mättig <thiemo.maettig@wikimedia.de>
Wed, 16 Apr 2014 14:13:46 +0000 (16:13 +0200)
committerThiemo Mättig <thiemo.maettig@wikimedia.de>
Mon, 2 Jun 2014 21:30:03 +0000 (23:30 +0200)
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

index 931c088..b4a1c5d 100644 (file)
@@ -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 ) {