1 | <?php |
||
15 | class Terms extends AbstractQuery |
||
16 | { |
||
17 | /** |
||
18 | * @var string |
||
19 | */ |
||
20 | private $field; |
||
21 | |||
22 | /** |
||
23 | * @var array<float|int|string> |
||
24 | */ |
||
25 | private $terms; |
||
26 | |||
27 | /** |
||
28 | * @var string[]|null |
||
29 | */ |
||
30 | private $lookup; |
||
31 | |||
32 | /** |
||
33 | * @param array<bool|float|int|string> $terms Terms list, leave empty if building a terms-lookup query |
||
34 | */ |
||
35 | public function __construct(string $field, array $terms = []) |
||
44 | |||
45 | /** |
||
46 | * Sets terms for the query. |
||
47 | * |
||
48 | * @param array<bool|float|int|string> $terms |
||
49 | */ |
||
50 | public function setTerms(array $terms): self |
||
56 | |||
57 | /** |
||
58 | * Adds a single term to the list. |
||
59 | * |
||
60 | * @param bool|float|int|string $term |
||
61 | */ |
||
62 | public function addTerm($term): self |
||
63 | { |
||
64 | if (!\is_scalar($term)) { |
||
65 | throw new \TypeError(\sprintf('Argument 1 passed to "%s()" must be a scalar, %s given.', __METHOD__, \is_object($term) ? \get_class($term) : \gettype($term))); |
||
66 | } |
||
67 | |||
68 | $this->terms[] = $term; |
||
69 | |||
70 | return $this; |
||
71 | } |
||
72 | |||
73 | public function setTermsLookup(string $index, string $id, string $path): self |
||
83 | |||
84 | /** |
||
85 | * {@inheritdoc} |
||
86 | */ |
||
87 | public function toArray(): array |
||
101 | } |
||
102 |
Our type inference engine has found an assignment to a property that is incompatible with the declared type of that property.
Either this assignment is in error or the assigned type should be added to the documentation/type hint for that property..