You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: tests/QueryCheckerTreeWalkerTest.php
+20-20
Original file line number
Diff line number
Diff line change
@@ -27,7 +27,7 @@ public function testWrongParameterTypeInVariousPlaces(mixed $expr): void
27
27
{
28
28
self::assertException(
29
29
LogicException::class,
30
-
'QueryCheckerTreeWalker: Parameter "stringField" is of type "float", but expected "string" (because it\'s used in expression with e.stringField)',
30
+
'QueryCheckerTreeWalker: Parameter \'stringField\' has no type specified in 3rd argument of setParameter(). Thus it is inferred as \'float\', but it is compared with \'e.stringField\' which can only be compared with \'string\'.',
31
31
function () use ($expr): void {
32
32
$this->getEntityManager()->createQueryBuilder()
33
33
->select('e')
@@ -42,7 +42,7 @@ function () use ($expr): void {
42
42
43
43
self::assertException(
44
44
LogicException::class,
45
-
'QueryCheckerTreeWalker: Parameter "stringField" is of type "float", but expected "string" (because it\'s used in expression with e.stringField)',
45
+
'QueryCheckerTreeWalker: Parameter \'stringField\' has no type specified in 3rd argument of setParameter(). Thus it is inferred as \'float\', but it is compared with \'e.stringField\' which can only be compared with \'string\'.',
46
46
function () use ($expr): void {
47
47
$this->getEntityManager()->createQueryBuilder()
48
48
->select('e')
@@ -201,113 +201,113 @@ public static function provideWrongParameterTypesData(): iterable
201
201
'e.stringField',
202
202
123,
203
203
null,
204
-
'Parameter "e_stringField" is of type "integer", but expected "string" (because it\'s used in expression with e.stringField)',
204
+
'Parameter \'e_stringField\' has no type specified in 3rd argument of setParameter(). Thus it is inferred as \'integer\', but it is compared with \'e.stringField\' which can only be compared with \'string\'.',
205
205
];
206
206
207
207
yield [
208
208
'e.stringField',
209
209
123.4,
210
210
null,
211
-
'Parameter "e_stringField" is of type "float", but expected "string" (because it\'s used in expression with e.stringField)',
211
+
'Parameter \'e_stringField\' has no type specified in 3rd argument of setParameter(). Thus it is inferred as \'float\', but it is compared with \'e.stringField\' which can only be compared with \'string\'.',
212
212
];
213
213
214
214
yield [
215
215
'e.stringField',
216
216
TestEntityWithManyFieldTypesStringEnum::A,
217
217
null,
218
-
'Parameter "e_stringField" is of type "ShipMonkTests\DoctrineQueryChecker\Fixture\Enum\TestEntityWithManyFieldTypesStringEnum", but expected "string" (because it\'s used in expression with e.stringField)',
218
+
'Parameter \'e_stringField\' has no type specified in 3rd argument of setParameter(). Thus it is inferred as \'ShipMonkTests\DoctrineQueryChecker\Fixture\Enum\TestEntityWithManyFieldTypesStringEnum\', but it is compared with \'e.stringField\' which can only be compared with \'string\'.',
219
219
];
220
220
221
221
yield [
222
222
'e.textField',
223
223
123,
224
224
null,
225
-
'Parameter "e_textField" is of type "integer", but expected "string" (because it\'s used in expression with e.textField)',
225
+
'Parameter \'e_textField\' has no type specified in 3rd argument of setParameter(). Thus it is inferred as \'integer\', but it is compared with \'e.textField\' which can only be compared with \'string\'.',
226
226
];
227
227
228
228
yield [
229
229
'e.textField',
230
230
123.4,
231
231
null,
232
-
'Parameter "e_textField" is of type "float", but expected "string" (because it\'s used in expression with e.textField)',
232
+
'Parameter \'e_textField\' has no type specified in 3rd argument of setParameter(). Thus it is inferred as \'float\', but it is compared with \'e.textField\' which can only be compared with \'string\'.',
233
233
];
234
234
235
235
yield [
236
236
'e.booleanField',
237
237
'ABC',
238
238
null,
239
-
'Parameter "e_booleanField" is of type "string", but expected "boolean" (because it\'s used in expression with e.booleanField)',
239
+
'Parameter \'e_booleanField\' has no type specified in 3rd argument of setParameter(). Thus it is inferred as \'string\', but it is compared with \'e.booleanField\' which can only be compared with \'boolean\'.',
240
240
];
241
241
242
242
yield [
243
243
'e.stringEnumField',
244
244
TestEntityWithManyFieldTypesIntEnum::A,
245
245
null,
246
-
'Parameter "e_stringEnumField" is of type "ShipMonkTests\DoctrineQueryChecker\Fixture\Enum\TestEntityWithManyFieldTypesIntEnum", but expected one of: ["ShipMonkTests\DoctrineQueryChecker\Fixture\Enum\TestEntityWithManyFieldTypesStringEnum", "string"] (because it\'s used in expression with e.stringEnumField)',
246
+
'Parameter \'e_stringEnumField\' has no type specified in 3rd argument of setParameter(). Thus it is inferred as \'ShipMonkTests\DoctrineQueryChecker\Fixture\Enum\TestEntityWithManyFieldTypesIntEnum\', but it is compared with \'e.stringEnumField\' which can only be compared with one of: [\'ShipMonkTests\DoctrineQueryChecker\Fixture\Enum\TestEntityWithManyFieldTypesStringEnum\', \'string\'].',
247
247
];
248
248
249
249
yield [
250
250
'e.dateTimeImmutableField',
251
251
'2021-01-01',
252
252
Types::STRING,
253
-
'Parameter "e_dateTimeImmutableField" is of type "string", but expected "datetime_immutable" (because it\'s used in expression with e.dateTimeImmutableField)',
253
+
'Parameter \'e_dateTimeImmutableField\' is using \'string\'type in 3rd argument of setParameter(), but it is compared with \'e.dateTimeImmutableField\' which can only be compared with \'datetime_immutable\'.',
'Parameter "e_simpleTestEntity" is of type "ShipMonkTests\DoctrineQueryChecker\Fixture\Entity\SimpleTestEntityWithUuid", but expected one of: ["ShipMonkTests\DoctrineQueryChecker\Fixture\Entity\SimpleTestEntity", "integer"] (because it\'s used in expression with e.simpleTestEntity)',
261
+
'Parameter \'e_simpleTestEntity\' has no type specified in 3rd argument of setParameter(). Thus it is inferred as \'ShipMonkTests\DoctrineQueryChecker\Fixture\Entity\SimpleTestEntityWithUuid\', but it is compared with \'e.simpleTestEntity\' which can only be compared with one of: [\'ShipMonkTests\DoctrineQueryChecker\Fixture\Entity\SimpleTestEntity\', \'integer\'].',
262
262
];
263
263
264
264
yield [
265
265
'se.id',
266
266
$simpleTestEntityWithUuid,
267
267
null,
268
-
'Parameter "se_id" is of type "ShipMonkTests\DoctrineQueryChecker\Fixture\Entity\SimpleTestEntityWithUuid", but expected one of: ["ShipMonkTests\DoctrineQueryChecker\Fixture\Entity\SimpleTestEntity", "integer"] (because it\'s used in expression with se.id)',
268
+
'Parameter \'se_id\' has no type specified in 3rd argument of setParameter(). Thus it is inferred as \'ShipMonkTests\DoctrineQueryChecker\Fixture\Entity\SimpleTestEntityWithUuid\', but it is compared with \'se.id\' which can only be compared with one of: [\'ShipMonkTests\DoctrineQueryChecker\Fixture\Entity\SimpleTestEntity\', \'integer\'].',
269
269
];
270
270
271
271
yield [
272
272
'e.simpleTestEntityWithUuid',
273
273
$simpleTestEntityWithUuid->getUuid(),
274
274
null,
275
-
'Parameter "e_simpleTestEntityWithUuid" is of type "string", but expected one of: ["ShipMonkTests\DoctrineQueryChecker\Fixture\Entity\SimpleTestEntityWithUuid", "uuid"] (because it\'s used in expression with e.simpleTestEntityWithUuid)',
275
+
'Parameter \'e_simpleTestEntityWithUuid\' has no type specified in 3rd argument of setParameter(). Thus it is inferred as \'string\', but it is compared with \'e.simpleTestEntityWithUuid\' which can only be compared with one of: [\'ShipMonkTests\DoctrineQueryChecker\Fixture\Entity\SimpleTestEntityWithUuid\', \'uuid\'].',
276
276
];
277
277
278
278
yield [
279
279
'e.simpleTestEntityWithUuid',
280
280
$simpleTestEntityWithUuid->getUuid(),
281
281
Types::STRING,
282
-
'Parameter "e_simpleTestEntityWithUuid" is of type "string", but expected one of: ["ShipMonkTests\DoctrineQueryChecker\Fixture\Entity\SimpleTestEntityWithUuid", "uuid"] (because it\'s used in expression with e.simpleTestEntityWithUuid)',
282
+
'Parameter \'e_simpleTestEntityWithUuid\' is using \'string\'type in 3rd argument of setParameter(), but it is compared with \'e.simpleTestEntityWithUuid\' which can only be compared with one of: [\'ShipMonkTests\DoctrineQueryChecker\Fixture\Entity\SimpleTestEntityWithUuid\', \'uuid\'].',
283
283
];
284
284
285
285
yield [
286
286
'sewu',
287
287
$simpleTestEntityWithUuid->getUuid(),
288
288
null,
289
-
'Parameter "sewu" is of type "string", but expected one of: ["ShipMonkTests\DoctrineQueryChecker\Fixture\Entity\SimpleTestEntityWithUuid", "uuid"] (because it\'s used in expression with sewu.uuid)',
289
+
'Parameter \'sewu\' has no type specified in 3rd argument of setParameter(). Thus it is inferred as \'string\', but it is compared with \'sewu.uuid\' which can only be compared with one of: [\'ShipMonkTests\DoctrineQueryChecker\Fixture\Entity\SimpleTestEntityWithUuid\', \'uuid\'].',
290
290
];
291
291
292
292
yield [
293
293
'sewu',
294
294
$simpleTestEntityWithUuid->getUuid(),
295
295
Types::STRING,
296
-
'Parameter "sewu" is of type "string", but expected one of: ["ShipMonkTests\DoctrineQueryChecker\Fixture\Entity\SimpleTestEntityWithUuid", "uuid"] (because it\'s used in expression with sewu.uuid)',
296
+
'Parameter \'sewu\' is using \'string\'type in 3rd argument of setParameter(), but it is compared with \'sewu.uuid\' which can only be compared with one of: [\'ShipMonkTests\DoctrineQueryChecker\Fixture\Entity\SimpleTestEntityWithUuid\', \'uuid\'].',
297
297
];
298
298
299
299
yield [
300
300
'sewu.uuid',
301
301
$simpleTestEntityWithUuid->getUuid(),
302
302
null,
303
-
'Parameter "sewu_uuid" is of type "string", but expected one of: ["ShipMonkTests\DoctrineQueryChecker\Fixture\Entity\SimpleTestEntityWithUuid", "uuid"] (because it\'s used in expression with sewu.uuid)',
303
+
'Parameter \'sewu_uuid\' has no type specified in 3rd argument of setParameter(). Thus it is inferred as \'string\', but it is compared with \'sewu.uuid\' which can only be compared with one of: [\'ShipMonkTests\DoctrineQueryChecker\Fixture\Entity\SimpleTestEntityWithUuid\', \'uuid\'].',
304
304
];
305
305
306
306
yield [
307
307
'sewu.uuid',
308
308
$simpleTestEntityWithUuid->getUuid(),
309
309
Types::STRING,
310
-
'Parameter "sewu_uuid" is of type "string", but expected one of: ["ShipMonkTests\DoctrineQueryChecker\Fixture\Entity\SimpleTestEntityWithUuid", "uuid"] (because it\'s used in expression with sewu.uuid)',
310
+
'Parameter \'sewu_uuid\' is using \'string\'type in 3rd argument of setParameter(), but it is compared with \'sewu.uuid\' which can only be compared with one of: [\'ShipMonkTests\DoctrineQueryChecker\Fixture\Entity\SimpleTestEntityWithUuid\', \'uuid\'].',
311
311
];
312
312
}
313
313
@@ -317,7 +317,7 @@ public function testWillUseLoggerIfAvailable(): void
317
317
$logger->expects(self::once())
318
318
->method('error')
319
319
->with(
320
-
'QueryCheckerTreeWalker: Parameter "value" is of type "float", but expected "boolean" (because it\'s used in expression with e.booleanField)',
320
+
'QueryCheckerTreeWalker: Parameter \'value\' has no type specified in 3rd argument of setParameter(). Thus it is inferred as \'float\', but it is compared with \'e.booleanField\' which can only be compared with \'boolean\'.',
321
321
self::arrayHasKey('exception'),
322
322
);
323
323
@@ -336,7 +336,7 @@ public function testWillUseLoggerIfAvailable(): void
336
336
337
337
self::assertException(
338
338
LogicException::class,
339
-
'QueryCheckerTreeWalker: Parameter "value" is of type "float", but expected "boolean" (because it\'s used in expression with e.booleanField)',
339
+
'QueryCheckerTreeWalker: Parameter \'value\' has no type specified in 3rd argument of setParameter(). Thus it is inferred as \'float\', but it is compared with \'e.booleanField\' which can only be compared with \'boolean\'.',
0 commit comments