function _set(&$object, $key, $value) { return Underscore::set($object, $key, $value); }
/** * @tags objects */ public function testSet() { $array = []; $object = new \stdClass(); $iterator = new \ArrayIterator([]); $this->array(_::set($array, 'foo', 'bar'))->isEqualTo(['foo' => 'bar']); $array = [1, 2, 3]; $this->array(_::set($array, 3, 4))->isEqualTo([1, 2, 3, 4]); $this->object(_::set($object, 'foo', 'bar'))->isEqualTo((object) ['foo' => 'bar']); $this->array(_::set($iterator, 'foo', 'bar')->getArrayCopy())->isEqualTo(['foo' => 'bar']); }