Passed
Push — next ( ee2197...d54041 )
by Bas
02:37
created

src/AQL/HasSupportCommands.php (3 issues)

1
<?php
2
3
declare(strict_types=1);
4
5
namespace LaravelFreelancerNL\FluentAQL\AQL;
6
7
use LaravelFreelancerNL\FluentAQL\Clauses\RawClause;
8
use LaravelFreelancerNL\FluentAQL\Exceptions\BindException;
9
use LaravelFreelancerNL\FluentAQL\Expressions\BindExpression;
10
use LaravelFreelancerNL\FluentAQL\Expressions\Expression;
11
use LaravelFreelancerNL\FluentAQL\Expressions\LiteralExpression;
12
use LaravelFreelancerNL\FluentAQL\QueryBuilder;
13
14
/**
15
 * Trait hasFunctions.
16
 *
17
 * AQL Function API calls.
18
 */
19
trait HasSupportCommands
20
{
21
22
    abstract public function addCommand($command);
23
24
    /**
25
     * @param object|array<mixed>|string|int|float|bool|null $data
26
     */
27
    abstract public function bind(
28
        object|array|string|int|float|bool|null $data,
0 ignored issues
show
The type LaravelFreelancerNL\FluentAQL\AQL\null 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...
29
        string $to = null
30
    ): BindExpression;
31
32
    /**
33
     * @param array<object|array<mixed>|string|int|float|bool|null> $binds
34
     * @param array<string, string|Expression|QueryBuilder> $collections
35
     * @throws BindException
36
     */
37 3
    public function raw(
38
        string $aql,
39
        array $binds = [],
40
        array $collections = []
41
    ): self {
42 3
        $this->bindArrayValues($binds);
0 ignored issues
show
It seems like bindArrayValues() must be provided by classes using this trait. How about adding it as abstract method to this trait? ( Ignorable by Annotation )

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

42
        $this->/** @scrutinizer ignore-call */ 
43
               bindArrayValues($binds);
Loading history...
43
44 3
        foreach ($collections as $mode => $modeCollections) {
45 1
            $this->registerCollections($modeCollections, $mode);
46
        }
47
48 3
        $this->addCommand(new RawClause($aql));
49
50 3
        return $this;
51
    }
52
53
    abstract public function registerCollections($collections, $mode = 'write');
54
55
    /**
56
     * @param array<array-key, array<array-key, mixed>|null|object|scalar> $binds
0 ignored issues
show
Documentation Bug introduced by
The doc comment array<array-key, array<a...ed>|null|object|scalar> at position 2 could not be parsed: Unknown type name 'array-key' at position 2 in array<array-key, array<array-key, mixed>|null|object|scalar>.
Loading history...
57
     * @param array<string, string|Expression|QueryBuilder> $collections
58
     * @throws BindException
59
     */
60 3
    public function rawExpression(
61
        string $aql,
62
        array $binds = [],
63
        array $collections = []
64
    ): LiteralExpression {
65 3
        $this->bindArrayValues($binds);
66
67 3
        foreach ($collections as $mode => $modeCollections) {
68 1
            $this->registerCollections($modeCollections, $mode);
69
        }
70
71 3
        return new LiteralExpression($aql);
72
    }
73
}
74