Merge "Add @covers tags to utils tests"
[lhc/web/wiklou.git] / includes / htmlform / HTMLForm.php
index 7293b99..d959dd2 100644 (file)
@@ -1723,6 +1723,12 @@ class HTMLForm extends ContextSource {
         * @return string HTML
         */
        protected function formatSection( array $fieldsHtml, $sectionName, $anyFieldHasLabel ) {
+               if ( !$fieldsHtml ) {
+                       // Do not generate any wrappers for empty sections. Sections may be empty if they only have
+                       // subsections, but no fields. A legend will still be added in wrapFieldSetSection().
+                       return '';
+               }
+
                $displayFormat = $this->getDisplayFormat();
                $html = implode( '', $fieldsHtml );
 
@@ -1893,7 +1899,7 @@ class HTMLForm extends ContextSource {
         * 'novalidate' attribute will be added on the `<form>` element. It will be removed if the user
         * agent has JavaScript support, in htmlform.js.
         *
-        * @return boolean
+        * @return bool
         * @since 1.29
         */
        public function needsJSForHtml5FormValidation() {