Passed
Push — new-json-functions ( f0f3c9 )
by Martin
03:39
created

JsonSerialize::validateArguments()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 1
Metric Value
cc 2
eloc 2
c 1
b 0
f 1
nc 2
nop 1
dl 0
loc 4
rs 10
1
<?php
2
3
declare(strict_types=1);
4
5
namespace MartinGeorgiev\Doctrine\ORM\Query\AST\Functions;
6
7
use MartinGeorgiev\Doctrine\ORM\Query\AST\Functions\Exception\InvalidArgumentForVariadicFunctionException;
0 ignored issues
show
Bug introduced by
The type MartinGeorgiev\Doctrine\...riadicFunctionException was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
8
9
/**
10
 * Implementation of PostgreSQL JSON_SERIALIZE().
11
 *
12
 * Supports basic form:
13
 * - json_serialize(expression)
14
 *
15
 * @see https://www.postgresql.org/docs/17/functions-json.html
16
 * @since 2.10
17
 *
18
 * @author Martin Georgiev <[email protected]>
19
 */
20
class JsonSerialize extends BaseVariadicFunction
21
{
22
    protected function customizeFunction(): void
23
    {
24
        $this->setFunctionPrototype('json_serialize(%s)');
25
    }
26
27
    protected function validateArguments(array $arguments): void
28
    {
29
        if (\count($arguments) !== 1) {
30
            throw InvalidArgumentForVariadicFunctionException::exact('json_serialize', 1);
31
        }
32
    }
33
}
34