@@ -240,6 +240,7 @@ public function walkPathExpression($pathExpr): string
240240
241241 case AST \PathExpression::TYPE_SINGLE_VALUED_ASSOCIATION :
242242 if (isset ($ class ->associationMappings [$ fieldName ]['inherited ' ])) {
243+ /** @var class-string $newClassName */
243244 $ newClassName = $ class ->associationMappings [$ fieldName ]['inherited ' ];
244245 $ class = $ this ->em ->getClassMetadata ($ newClassName );
245246 }
@@ -255,6 +256,8 @@ public function walkPathExpression($pathExpr): string
255256 }
256257
257258 $ joinColumn = $ assoc ['joinColumns ' ][0 ];
259+
260+ /** @var class-string $assocClassName */
258261 $ assocClassName = $ assoc ['targetEntity ' ];
259262
260263 $ targetClass = $ this ->em ->getClassMetadata ($ assocClassName );
@@ -360,7 +363,7 @@ public function walkFunction($function): string
360363 return $ function ->getSql ($ this );
361364
362365 case $ function instanceof AST \Functions \AbsFunction:
363- $ exprType = $ this ->unmarshalType ($ function -> simpleArithmeticExpression -> dispatch ( $ this ));
366+ $ exprType = $ this ->unmarshalType ($ this -> walkSimpleArithmeticExpression ( $ function -> simpleArithmeticExpression ));
364367
365368 $ type = TypeCombinator::union (
366369 IntegerRangeType::fromInterval (0 , null ),
@@ -442,8 +445,8 @@ public function walkFunction($function): string
442445 return $ this ->marshalType ($ type );
443446
444447 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 ));
447450
448451 $ type = IntegerRangeType::fromInterval (0 , null );
449452 if (TypeCombinator::containsNull ($ firstExprType ) || TypeCombinator::containsNull ($ secondExprType )) {
@@ -465,8 +468,8 @@ public function walkFunction($function): string
465468 return $ this ->marshalType ($ type );
466469
467470 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 ));
470473
471474 $ type = IntegerRangeType::fromInterval (0 , null );
472475 if (TypeCombinator::containsNull ($ firstExprType ) || TypeCombinator::containsNull ($ secondExprType )) {
@@ -481,7 +484,7 @@ public function walkFunction($function): string
481484 return $ this ->marshalType ($ type );
482485
483486 case $ function instanceof AST \Functions \SqrtFunction:
484- $ exprType = $ this ->unmarshalType ($ function -> simpleArithmeticExpression -> dispatch ( $ this ));
487+ $ exprType = $ this ->unmarshalType ($ this -> walkSimpleArithmeticExpression ( $ function -> simpleArithmeticExpression ));
485488
486489 $ type = new FloatType ();
487490 if (TypeCombinator::containsNull ($ exprType )) {
@@ -492,10 +495,10 @@ public function walkFunction($function): string
492495
493496 case $ function instanceof AST \Functions \SubstringFunction:
494497 $ stringType = $ this ->unmarshalType ($ function ->stringPrimary ->dispatch ($ this ));
495- $ firstExprType = $ this ->unmarshalType ($ function -> firstSimpleArithmeticExpression -> dispatch ( $ this ));
498+ $ firstExprType = $ this ->unmarshalType ($ this -> walkSimpleArithmeticExpression ( $ function -> firstSimpleArithmeticExpression ));
496499
497500 if ($ function ->secondSimpleArithmeticExpression !== null ) {
498- $ secondExprType = $ this ->unmarshalType ($ function -> secondSimpleArithmeticExpression -> dispatch ( $ this ));
501+ $ secondExprType = $ this ->unmarshalType ($ this -> walkSimpleArithmeticExpression ( $ function -> secondSimpleArithmeticExpression ));
499502 } else {
500503 $ secondExprType = new IntegerType ();
501504 }
@@ -514,6 +517,8 @@ public function walkFunction($function): string
514517 assert (array_key_exists ('metadata ' , $ queryComp ));
515518 $ class = $ queryComp ['metadata ' ];
516519 $ assoc = $ class ->associationMappings [$ assocField ];
520+
521+ /** @var class-string $assocClassName */
517522 $ assocClassName = $ assoc ['targetEntity ' ];
518523 $ targetClass = $ this ->em ->getClassMetadata ($ assocClassName );
519524
@@ -930,7 +935,7 @@ public function walkAggregateExpression($aggExpression): string
930935 case 'AVG ' :
931936 case 'SUM ' :
932937 $ type = $ this ->unmarshalType (
933- $ aggExpression -> pathExpression -> dispatch ( $ this )
938+ $ this -> walkSimpleArithmeticExpression ( $ aggExpression -> pathExpression )
934939 );
935940
936941 return $ this ->marshalType (TypeCombinator::addNull ($ type ));
@@ -1159,7 +1164,7 @@ public function walkInputParameter($inputParam): string
11591164 public function walkArithmeticExpression ($ arithmeticExpr ): string
11601165 {
11611166 if ($ arithmeticExpr ->simpleArithmeticExpression !== null ) {
1162- return $ arithmeticExpr -> simpleArithmeticExpression -> dispatch ( $ this );
1167+ return $ this -> walkSimpleArithmeticExpression ( $ arithmeticExpr -> simpleArithmeticExpression );
11631168 }
11641169
11651170 if ($ arithmeticExpr ->subselect !== null ) {
@@ -1302,7 +1307,10 @@ private function getTypeOfField(ClassMetadata $class, string $fieldName): array
13021307
13031308 $ metadata = $ class ->fieldMappings [$ fieldName ];
13041309
1310+ /** @var string $type */
13051311 $ type = $ metadata ['type ' ];
1312+
1313+ /** @var class-string<BackedEnum>|null $enumType */
13061314 $ enumType = $ metadata ['enumType ' ] ?? null ;
13071315
13081316 if (!is_string ($ enumType ) || !class_exists ($ enumType )) {
0 commit comments