Code Duplication    Length = 14-17 lines in 2 locations

src/Internal/JsonDecodeReader.php 1 location

@@ 179-192 (lines=14) @@
176
     *
177
     * @return string
178
     */
179
    public function nextString(): string
180
    {
181
        $this->pathIndices[$this->pathIndex]++;
182
183
        if ($this->stackTypes[$this->stackSize - 1] !== JsonToken::STRING) {
184
            if ($this->stackTypes[$this->stackSize - 1] === JsonToken::NAME) {
185
                return $this->nextName();
186
            }
187
188
            $this->assertionFailed(JsonToken::STRING);
189
        }
190
191
        return (string)$this->stack[--$this->stackSize];
192
    }
193
}
194

src/Internal/JsonElementReader.php 1 location

@@ 178-194 (lines=17) @@
175
     *
176
     * @return string
177
     */
178
    public function nextString(): string
179
    {
180
        $this->pathIndices[$this->pathIndex]++;
181
182
        if ($this->stackTypes[$this->stackSize - 1] !== JsonToken::STRING) {
183
            if ($this->stackTypes[$this->stackSize - 1] === JsonToken::NAME) {
184
                return $this->nextName();
185
            }
186
187
            $this->assertionFailed(JsonToken::STRING);
188
        }
189
190
        /** @var JsonPrimitive $primitive */
191
        $primitive = $this->stack[--$this->stackSize];
192
193
        return $primitive->asString();
194
    }
195
}
196