src/GuardedMapAbstract.php
public function set($key, $value)
    {
        $result = $this->allowed($value);
        if ($this->passes($result)) {
            parent::set($key, $this->normalize($value));
        } else {
            throw new \UnexpectedValueException(sprintf(
                'Value of type "%s" forbidden in this instance of %s',
                gettype($value),
                get_class($this)
            ));
        }
    }
public function set($key, $value)
    {
        $result = $this->allowed($value);
        if ($this->passes($result)) {
            parent::set($key, $this->normalize($value));
        } else {
            throw new \UnexpectedValueException(sprintf(
                'Value of type "%s" forbidden in this instance of %s',
                gettype($value),
                get_class($this)
            ));
        }
    }
public function set ( $ key , $ value ) { $ result = $ this -> allowed ( $ value ) ; if ( $ this -> passes ( $ result ) ) { parent :: set ( $ key , $ this -> normalize ( $ value ) ) ; } else { throw new \ UnexpectedValueException ( sprintf ( 'Value of type "%s" forbidden in this instance of %s' , gettype ( $ value ) , get_class ( $ this ) ) ) ; } }
Set the value at a given key, provided that the value passes the
defined guard. Optionally, normalize the value before setting.

{@inheritDoc}
@throws \UnexpectedValueException
Set the value at a given key provided that the value passes the defined guard . Optionally normalize the value before setting .