src/Html/Form/Form.php
public function addElement(Element $element): Element
    {
        if ($element instanceof FormStatus) {
            if ($this->hasStatus === true) {
                throw new InvalidArgumentException('Form can contain only one FormStatus element');
            }
            $this->hasStatus = true;
        }
        return parent::addElement($element);
    }
public function addElement(Element $element): Element
    {
        if ($element instanceof FormStatus) {
            if ($this->hasStatus === true) {
                throw new InvalidArgumentException('Form can contain only one FormStatus element');
            }
            $this->hasStatus = true;
        }
        return parent::addElement($element);
    }
public function addElement ( Element $ element ) : Element { if ( $ element instanceof FormStatus ) { if ( $ this -> hasStatus === true ) { throw new InvalidArgumentException ( 'Form can contain only one FormStatus element' ) ; } $ this -> hasStatus = true ; } return parent :: addElement ( $ element ) ; }
Adds element to composite. Throws InvalidArgumentException if more than one FormStatus element is added.

@param Element $element
@return Element
Adds element to composite . Throws InvalidArgumentException if more than one FormStatus element is added .