Issues (13)

src/Decoders/SimdjsonDecoder.php (1 issue)

Labels
Severity
1
<?php
2
3
namespace Cerbero\JsonParser\Decoders;
4
5
/**
6
 * The decoder using the simdjson extension.
7
 *
8
 */
9
final class SimdjsonDecoder extends AbstractDecoder
10
{
11
    /**
12
     * Instantiate the class.
13
     *
14
     * @param bool $decodesToArray
15
     * @param int $depth
16
     */
17 376
    public function __construct(private readonly bool $decodesToArray = true, private readonly int $depth = 512)
18
    {
19 376
    }
20
21
    /**
22
     * Retrieve the decoded value of the given JSON
23
     *
24
     * @param string $json
25
     * @return mixed
26
     * @throws \Throwable
27
     */
28 263
    protected function decodeJson(string $json): mixed
29
    {
30 263
        return simdjson_decode($json, $this->decodesToArray, $this->depth);
0 ignored issues
show
The function simdjson_decode was not found. Maybe you did not declare it correctly or list all dependencies? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

30
        return /** @scrutinizer ignore-call */ simdjson_decode($json, $this->decodesToArray, $this->depth);
Loading history...
31
    }
32
}
33