Merge "maintenance: Script to rename titles for Unicode uppercasing changes"
[lhc/web/wiklou.git] / includes / libs / mime / XmlTypeCheck.php
index 993eea9..65cc54b 100644 (file)
 
 class XmlTypeCheck {
        /**
-        * Will be set to true or false to indicate whether the file is
+        * @var bool|null Will be set to true or false to indicate whether the file is
         * well-formed XML. Note that this doesn't check schema validity.
         */
        public $wellFormed = null;
 
        /**
-        * Will be set to true if the optional element filter returned
+        * @var bool Will be set to true if the optional element filter returned
         * a match at some point.
         */
        public $filterMatch = false;
@@ -46,33 +46,33 @@ class XmlTypeCheck {
        public $filterMatchType = false;
 
        /**
-        * Name of the document's root element, including any namespace
+        * @var string Name of the document's root element, including any namespace
         * as an expanded URL.
         */
        public $rootElement = '';
 
        /**
-        * A stack of strings containing the data of each xml element as it's processed. Append
-        * data to the top string of the stack, then pop off the string and process it when the
+        * @var string[] A stack of strings containing the data of each xml element as it's processed.
+        * Append data to the top string of the stack, then pop off the string and process it when the
         * element is closed.
         */
        protected $elementData = [];
 
        /**
-        * A stack of element names and attributes, as we process them.
+        * @var array A stack of element names and attributes, as we process them.
         */
        protected $elementDataContext = [];
 
        /**
-        * Current depth of the data stack.
+        * @var int Current depth of the data stack.
         */
        protected $stackDepth = 0;
 
        /**
-        * Additional parsing options
+        * @var array Additional parsing options
         */
        private $parserOptions = [
-               'processing_instruction_handler' => '',
+               'processing_instruction_handler' => null,
                'external_dtd_handler' => '',
                'dtd_handler' => '',
                'require_safe_dtd' => true
@@ -308,7 +308,7 @@ class XmlTypeCheck {
 
        /**
         * @param string $name
-        * @param string $attribs
+        * @param array $attribs
         */
        private function elementOpen( $name, $attribs ) {
                $this->elementDataContext[] = [ $name, $attribs ];
@@ -406,10 +406,10 @@ class XmlTypeCheck {
                        $callbackReturn = false;
                }
 
-               if ( $checkIfSafe && isset( $parsedDTD['internal'] ) ) {
-                       if ( !$this->checkDTDIsSafe( $parsedDTD['internal'] ) ) {
-                               $this->wellFormed = false;
-                       }
+               if ( $checkIfSafe && isset( $parsedDTD['internal'] ) &&
+                       !$this->checkDTDIsSafe( $parsedDTD['internal'] )
+               ) {
+                       $this->wellFormed = false;
                }
        }