1 | <?php |
||
31 | class Query implements \IteratorAggregate |
||
32 | { |
||
33 | use Macroable { |
||
34 | Macroable::__call as __macroableCall; |
||
35 | } |
||
36 | use AliasProvider; |
||
37 | use WhereProvider; |
||
38 | use OrderProvider; |
||
39 | use SelectProvider; |
||
40 | use GroupByProvider; |
||
41 | use RelationProvider; |
||
42 | use RepositoryProvider; |
||
43 | use ExecutionsProvider; |
||
44 | use LimitAndOffsetProvider; |
||
45 | |||
46 | /** |
||
47 | * @var bool |
||
48 | */ |
||
49 | private static $booted = false; |
||
50 | |||
51 | /** |
||
52 | * @var CriterionInterface[]|\SplObjectStorage |
||
53 | */ |
||
54 | protected $criteria; |
||
55 | |||
56 | /** |
||
57 | * @var array|ObjectRepository[] |
||
58 | */ |
||
59 | protected $scopes = []; |
||
60 | |||
61 | /** |
||
62 | * Query constructor. |
||
63 | * @param ObjectRepository|null $repository |
||
64 | */ |
||
65 | 67 | public function __construct(ObjectRepository $repository = null) |
|
73 | |||
74 | /** |
||
75 | * @return void |
||
76 | */ |
||
77 | 30 | private function bootIfNotBooted(): void |
|
89 | |||
90 | /** |
||
91 | * Adds the specified set of scopes (method groups) to the query. |
||
92 | * |
||
93 | * @param object|string ...$scopes |
||
94 | * @return Query|$this |
||
95 | */ |
||
96 | 33 | public function scope(...$scopes): self |
|
102 | |||
103 | /** |
||
104 | * Returns a list of selection criteria. |
||
105 | * |
||
106 | * @return \Generator|CriterionInterface[] |
||
107 | */ |
||
108 | 67 | public function getCriteria(): \Generator |
|
112 | |||
113 | /** |
||
114 | * Creates a new query (alias to the constructor). |
||
115 | * |
||
116 | * @param CriterionInterface $criterion |
||
117 | * @return Query|$this |
||
118 | */ |
||
119 | 63 | public function add(CriterionInterface $criterion): self |
|
125 | |||
126 | /** |
||
127 | * Creates a new query (alias to the constructor). |
||
128 | * |
||
129 | * @param ObjectRepository|null $repository |
||
130 | * @return Query |
||
131 | */ |
||
132 | 67 | public static function new(ObjectRepository $repository = null): Query |
|
136 | |||
137 | /** |
||
138 | * @param string $name |
||
139 | * @return null |
||
140 | */ |
||
141 | 18 | public function __get(string $name) |
|
149 | |||
150 | /** |
||
151 | * @param string $method |
||
152 | * @param array $parameters |
||
153 | * @return mixed|$this|Query |
||
154 | */ |
||
155 | 4 | public function __call(string $method, array $parameters = []) |
|
174 | |||
175 | /** |
||
176 | * Returns a set of scopes for the specified query. |
||
177 | * |
||
178 | * @return array|ObjectRepository[] |
||
179 | */ |
||
180 | 7 | public function getScopes(): array |
|
184 | |||
185 | /** |
||
186 | * Attaches a child query to the parent without affecting |
||
187 | * the set of criteria (selections). |
||
188 | * |
||
189 | * @param Query $query |
||
190 | * @return Query |
||
191 | */ |
||
192 | 5 | public function attach(Query $query): Query |
|
200 | |||
201 | /** |
||
202 | * @param string $alias |
||
203 | * @return Query|$this|self |
||
204 | */ |
||
205 | 2 | public function withAlias(string $alias): Query |
|
215 | |||
216 | /** |
||
217 | * Creates a new query using the current set of scopes. |
||
218 | * |
||
219 | * @return Query |
||
220 | */ |
||
221 | 7 | public function create(): Query |
|
225 | |||
226 | /** |
||
227 | * Copies a set of Criteria from the child query to the parent. |
||
228 | * |
||
229 | * @param Query $query |
||
230 | * @return Query |
||
231 | */ |
||
232 | 2 | public function merge(Query $query): Query |
|
241 | |||
242 | /** |
||
243 | * @return void |
||
244 | */ |
||
245 | 14 | public function __clone() |
|
258 | |||
259 | /** |
||
260 | * @return \Generator |
||
261 | */ |
||
262 | public function getIterator(): \Generator |
||
268 | |||
269 | /** |
||
270 | * @return bool |
||
271 | */ |
||
272 | public function isEmpty(): bool |
||
276 | } |
||
277 |
It seems like the method you are trying to call exists only in some of the possible types.
Let’s take a look at an example:
Available Fixes
Add an additional type-check:
Only allow a single type to be passed if the variable comes from a parameter: