public function addFirst($element): bool
    {
        if ($this->checkType($this->getType(), $element) === false) {
            throw new InvalidArgumentException(
                'Value must be of type ' . $this->getType() . '; value is '
                . $this->toolValueToString($element)
            );
        }

        $this->index--;

        $this->data[$this->index] = $element;

        return true;
    }
public function addFirst($element): bool
    {
        if ($this->checkType($this->getType(), $element) === false) {
            throw new InvalidArgumentException(
                'Value must be of type ' . $this->getType() . '; value is '
                . $this->toolValueToString($element)
            );
        }

        $this->index--;

        $this->data[$this->index] = $element;

        return true;
    }
public function addFirst ( $ element ) : bool { if ( $ this -> checkType ( $ this -> getType ( ) , $ element ) === false ) { throw new InvalidArgumentException ( 'Value must be of type ' . $ this -> getType ( ) . '; value is ' . $ this -> toolValueToString ( $ element ) ) ; } $ this -> index -- ; $ this -> data [ $ this -> index ] = $ element ; return true ; }
Ensures that the specified element is inserted at the front of this queue.

@param mixed $element The element to add to this queue.

@return bool `true` if this queue changed as a result of the call.

@throws InvalidArgumentException when the value does not match the
specified type for this queue.

@see self::offerFirst()
Ensures that the specified element is inserted at the front of this queue .