@@ -240,6 +240,7 @@ public function walkPathExpression($pathExpr): string
240
240
241
241
case AST \PathExpression::TYPE_SINGLE_VALUED_ASSOCIATION :
242
242
if (isset ($ class ->associationMappings [$ fieldName ]['inherited ' ])) {
243
+ /** @var class-string $newClassName */
243
244
$ newClassName = $ class ->associationMappings [$ fieldName ]['inherited ' ];
244
245
$ class = $ this ->em ->getClassMetadata ($ newClassName );
245
246
}
@@ -255,6 +256,8 @@ public function walkPathExpression($pathExpr): string
255
256
}
256
257
257
258
$ joinColumn = $ assoc ['joinColumns ' ][0 ];
259
+
260
+ /** @var class-string $assocClassName */
258
261
$ assocClassName = $ assoc ['targetEntity ' ];
259
262
260
263
$ targetClass = $ this ->em ->getClassMetadata ($ assocClassName );
@@ -360,7 +363,7 @@ public function walkFunction($function): string
360
363
return $ function ->getSql ($ this );
361
364
362
365
case $ function instanceof AST \Functions \AbsFunction:
363
- $ exprType = $ this ->unmarshalType ($ function -> simpleArithmeticExpression -> dispatch ( $ this ));
366
+ $ exprType = $ this ->unmarshalType ($ this -> walkSimpleArithmeticExpression ( $ function -> simpleArithmeticExpression ));
364
367
365
368
$ type = TypeCombinator::union (
366
369
IntegerRangeType::fromInterval (0 , null ),
@@ -442,8 +445,8 @@ public function walkFunction($function): string
442
445
return $ this ->marshalType ($ type );
443
446
444
447
case $ function instanceof AST \Functions \LocateFunction:
445
- $ firstExprType = $ this ->unmarshalType ($ function -> firstStringPrimary -> dispatch ( $ this ));
446
- $ secondExprType = $ this ->unmarshalType ($ function -> secondStringPrimary -> dispatch ( $ this ));
448
+ $ firstExprType = $ this ->unmarshalType ($ this -> walkStringPrimary ( $ function -> firstStringPrimary ));
449
+ $ secondExprType = $ this ->unmarshalType ($ this -> walkStringPrimary ( $ function -> secondStringPrimary ));
447
450
448
451
$ type = IntegerRangeType::fromInterval (0 , null );
449
452
if (TypeCombinator::containsNull ($ firstExprType ) || TypeCombinator::containsNull ($ secondExprType )) {
@@ -465,8 +468,8 @@ public function walkFunction($function): string
465
468
return $ this ->marshalType ($ type );
466
469
467
470
case $ function instanceof AST \Functions \ModFunction:
468
- $ firstExprType = $ this ->unmarshalType ($ function -> firstSimpleArithmeticExpression -> dispatch ( $ this ));
469
- $ secondExprType = $ this ->unmarshalType ($ function -> secondSimpleArithmeticExpression -> dispatch ( $ this ));
471
+ $ firstExprType = $ this ->unmarshalType ($ this -> walkSimpleArithmeticExpression ( $ function -> firstSimpleArithmeticExpression ));
472
+ $ secondExprType = $ this ->unmarshalType ($ this -> walkSimpleArithmeticExpression ( $ function -> secondSimpleArithmeticExpression ));
470
473
471
474
$ type = IntegerRangeType::fromInterval (0 , null );
472
475
if (TypeCombinator::containsNull ($ firstExprType ) || TypeCombinator::containsNull ($ secondExprType )) {
@@ -481,7 +484,7 @@ public function walkFunction($function): string
481
484
return $ this ->marshalType ($ type );
482
485
483
486
case $ function instanceof AST \Functions \SqrtFunction:
484
- $ exprType = $ this ->unmarshalType ($ function -> simpleArithmeticExpression -> dispatch ( $ this ));
487
+ $ exprType = $ this ->unmarshalType ($ this -> walkSimpleArithmeticExpression ( $ function -> simpleArithmeticExpression ));
485
488
486
489
$ type = new FloatType ();
487
490
if (TypeCombinator::containsNull ($ exprType )) {
@@ -492,10 +495,10 @@ public function walkFunction($function): string
492
495
493
496
case $ function instanceof AST \Functions \SubstringFunction:
494
497
$ stringType = $ this ->unmarshalType ($ function ->stringPrimary ->dispatch ($ this ));
495
- $ firstExprType = $ this ->unmarshalType ($ function -> firstSimpleArithmeticExpression -> dispatch ( $ this ));
498
+ $ firstExprType = $ this ->unmarshalType ($ this -> walkSimpleArithmeticExpression ( $ function -> firstSimpleArithmeticExpression ));
496
499
497
500
if ($ function ->secondSimpleArithmeticExpression !== null ) {
498
- $ secondExprType = $ this ->unmarshalType ($ function -> secondSimpleArithmeticExpression -> dispatch ( $ this ));
501
+ $ secondExprType = $ this ->unmarshalType ($ this -> walkSimpleArithmeticExpression ( $ function -> secondSimpleArithmeticExpression ));
499
502
} else {
500
503
$ secondExprType = new IntegerType ();
501
504
}
@@ -514,6 +517,8 @@ public function walkFunction($function): string
514
517
assert (array_key_exists ('metadata ' , $ queryComp ));
515
518
$ class = $ queryComp ['metadata ' ];
516
519
$ assoc = $ class ->associationMappings [$ assocField ];
520
+
521
+ /** @var class-string $assocClassName */
517
522
$ assocClassName = $ assoc ['targetEntity ' ];
518
523
$ targetClass = $ this ->em ->getClassMetadata ($ assocClassName );
519
524
@@ -930,7 +935,7 @@ public function walkAggregateExpression($aggExpression): string
930
935
case 'AVG ' :
931
936
case 'SUM ' :
932
937
$ type = $ this ->unmarshalType (
933
- $ aggExpression -> pathExpression -> dispatch ( $ this )
938
+ $ this -> walkSimpleArithmeticExpression ( $ aggExpression -> pathExpression )
934
939
);
935
940
936
941
return $ this ->marshalType (TypeCombinator::addNull ($ type ));
@@ -1159,7 +1164,7 @@ public function walkInputParameter($inputParam): string
1159
1164
public function walkArithmeticExpression ($ arithmeticExpr ): string
1160
1165
{
1161
1166
if ($ arithmeticExpr ->simpleArithmeticExpression !== null ) {
1162
- return $ arithmeticExpr -> simpleArithmeticExpression -> dispatch ( $ this );
1167
+ return $ this -> walkSimpleArithmeticExpression ( $ arithmeticExpr -> simpleArithmeticExpression );
1163
1168
}
1164
1169
1165
1170
if ($ arithmeticExpr ->subselect !== null ) {
@@ -1302,7 +1307,10 @@ private function getTypeOfField(ClassMetadata $class, string $fieldName): array
1302
1307
1303
1308
$ metadata = $ class ->fieldMappings [$ fieldName ];
1304
1309
1310
+ /** @var string $type */
1305
1311
$ type = $ metadata ['type ' ];
1312
+
1313
+ /** @var class-string<BackedEnum>|null $enumType */
1306
1314
$ enumType = $ metadata ['enumType ' ] ?? null ;
1307
1315
1308
1316
if (!is_string ($ enumType ) || !class_exists ($ enumType )) {
0 commit comments