src/Internal/JsonElementWriter.php 1 location
|
@@ 295-303 (lines=9) @@
|
292 |
|
*/ |
293 |
|
private function push(JsonElement $value): JsonWritable |
294 |
|
{ |
295 |
|
if (0 === $this->stackSize) { |
296 |
|
if (null !== $this->result) { |
297 |
|
throw new BadMethodCallException('Attempting to write two different types'); |
298 |
|
} |
299 |
|
|
300 |
|
$this->result = $value; |
301 |
|
|
302 |
|
return $this; |
303 |
|
} |
304 |
|
|
305 |
|
if (null !== $this->pendingName) { |
306 |
|
$this->stack[$this->last()]->add($this->pendingName, $value); |
src/Internal/JsonEncodeWriter.php 1 location
|
@@ 277-285 (lines=9) @@
|
274 |
|
*/ |
275 |
|
private function push(&$value): JsonWritable |
276 |
|
{ |
277 |
|
if (0 === $this->stackSize) { |
278 |
|
if (null !== $this->result) { |
279 |
|
throw new BadMethodCallException('Attempting to write two different types'); |
280 |
|
} |
281 |
|
|
282 |
|
$this->result = &$value; |
283 |
|
|
284 |
|
return $this; |
285 |
|
} |
286 |
|
|
287 |
|
if (null !== $this->pendingName) { |
288 |
|
$this->stack[$this->last()]->{$this->pendingName} = &$value; |