Merge "Add default for revision.rev_text_id where missing"
[lhc/web/wiklou.git] / includes / libs / HtmlArmor.php
index 511e1c9..6e6ad7c 100644 (file)
@@ -16,7 +16,7 @@
  * http://www.gnu.org/copyleft/gpl.html
  *
  * @file
- * @license GPL-2.0+
+ * @license GPL-2.0-or-later
  * @author Kunal Mehta <legoktm@member.fsf.org>
  */
 
 class HtmlArmor {
 
        /**
-        * @var string
+        * @var string|null
         */
        private $value;
 
        /**
-        * @param string $value
+        * @param string|null $value
         */
        public function __construct( $value ) {
                $this->value = $value;
@@ -44,13 +44,14 @@ class HtmlArmor {
         * and get safe HTML back
         *
         * @param string|HtmlArmor $input
-        * @return string safe for usage in HTML
+        * @return string|null safe for usage in HTML, or null
+        *         if the HtmlArmor instance was wrapping null.
         */
        public static function getHtml( $input ) {
                if ( $input instanceof HtmlArmor ) {
                        return $input->value;
                } else {
-                       return htmlspecialchars( $input );
+                       return htmlspecialchars( $input, ENT_QUOTES );
                }
        }
 }