src/Core/ClassValidationArray.php
public function offsetSet($index, $value): void
    {
        if (!is_object($value)) {
            throw new \InvalidArgumentException("Excepcted object, got ". gettype($value));
        }
        if (!isset($this->class)) {
            $this->class = get_class($value);
        }
        if (get_class($value) === $this->class) {
            parent::offsetSet($index, $value);
        } else {
            throw new \InvalidArgumentException("Excepcted $this->class, got ". get_class($value));
        }
    }
public function offsetSet($index, $value): void
    {
        if (!is_object($value)) {
            throw new \InvalidArgumentException("Excepcted object, got ". gettype($value));
        }
        if (!isset($this->class)) {
            $this->class = get_class($value);
        }
        if (get_class($value) === $this->class) {
            parent::offsetSet($index, $value);
        } else {
            throw new \InvalidArgumentException("Excepcted $this->class, got ". get_class($value));
        }
    }
public function offsetSet ( $ index , $ value ) : void { if ( ! is_object ( $ value ) ) { throw new \ InvalidArgumentException ( "Excepcted object, got " . gettype ( $ value ) ) ; } if ( ! isset ( $ this -> class ) ) { $ this -> class = get_class ( $ value ) ; } if ( get_class ( $ value ) === $ this -> class ) { parent :: offsetSet ( $ index , $ value ) ; } else { throw new \ InvalidArgumentException ( "Excepcted $this->class, got " . get_class ( $ value ) ) ; } }
Sets the value at the specified index to value if value's class matches the one set.
If a class has not been set it will set the given object's class as the only allowed class.
@param mixed  $index The index to put the value in.
@param object $value The object that should be added.
@return void
@throws \InvalidArgumentException When $value is not an object or doesn't match the class that has been set.
Sets the value at the specified index to value if value s class matches the one set . If a class has not been set it will set the given object s class as the only allowed class .