function AbstractCollection::offsetSet
Throws
InvalidArgumentException if $element is of the wrong type.
Overrides AbstractArray::offsetSet
2 calls to AbstractCollection::offsetSet()
- AbstractSet::offsetSet in vendor/
ramsey/ collection/ src/ AbstractSet.php - Sets the given value to the given offset in the array.
- AbstractSet::offsetSet in vendor/
ramsey/ collection/ src/ AbstractSet.php - Sets the given value to the given offset in the array.
1 method overrides AbstractCollection::offsetSet()
- AbstractSet::offsetSet in vendor/
ramsey/ collection/ src/ AbstractSet.php - Sets the given value to the given offset in the array.
File
-
vendor/
ramsey/ collection/ src/ AbstractCollection.php, line 75
Class
- AbstractCollection
- This class provides a basic implementation of `CollectionInterface`, to minimize the effort required to implement this interface
Namespace
Ramsey\CollectionCode
public function offsetSet(mixed $offset, mixed $value) : void {
if ($this->checkType($this->getType(), $value) === false) {
throw new InvalidArgumentException('Value must be of type ' . $this->getType() . '; value is ' . $this->toolValueToString($value));
}
if ($offset === null) {
$this->data[] = $value;
}
else {
$this->data[$offset] = $value;
}
}