42
42
use function get_class ;
43
43
use function gettype ;
44
44
use function intval ;
45
- use function is_array ;
46
45
use function is_numeric ;
47
46
use function is_object ;
48
47
use function is_string ;
@@ -249,24 +248,21 @@ public function walkPathExpression($pathExpr)
249
248
case AST \PathExpression::TYPE_SINGLE_VALUED_ASSOCIATION :
250
249
if (isset ($ class ->associationMappings [$ fieldName ]['inherited ' ])) {
251
250
$ newClassName = $ class ->associationMappings [$ fieldName ]['inherited ' ];
252
- assert (is_string ($ newClassName ));
253
- /** @var class-string $newClassName */
254
251
$ class = $ this ->em ->getClassMetadata ($ newClassName );
255
252
}
256
253
257
254
$ assoc = $ class ->associationMappings [$ fieldName ];
258
255
259
- assert (is_array ($ assoc ['joinColumns ' ]));
260
-
261
- if (!((bool ) $ assoc ['isOwningSide ' ]) || count ($ assoc ['joinColumns ' ]) !== 1 ) {
256
+ if (
257
+ !$ assoc ['isOwningSide ' ]
258
+ || !isset ($ assoc ['joinColumns ' ])
259
+ || count ($ assoc ['joinColumns ' ]) !== 1
260
+ ) {
262
261
throw new ShouldNotHappenException ();
263
262
}
264
263
265
264
$ joinColumn = $ assoc ['joinColumns ' ][0 ];
266
- assert (is_array ($ joinColumn ));
267
265
$ assocClassName = $ assoc ['targetEntity ' ];
268
- assert (is_string ($ assocClassName ));
269
- /** @var class-string $assocClassName */
270
266
271
267
$ targetClass = $ this ->em ->getClassMetadata ($ assocClassName );
272
268
$ identifierFieldNames = $ targetClass ->getIdentifierFieldNames ();
@@ -278,7 +274,7 @@ public function walkPathExpression($pathExpr)
278
274
$ targetFieldName = $ identifierFieldNames [0 ];
279
275
[$ typeName , $ enumType ] = $ this ->getTypeOfField ($ targetClass , $ targetFieldName );
280
276
281
- $ nullable = (bool ) ( $ joinColumn ['nullable ' ] ?? true )
277
+ $ nullable = ($ joinColumn ['nullable ' ] ?? true )
282
278
|| $ this ->hasAggregateWithoutGroupBy ();
283
279
284
280
$ fieldType = $ this ->resolveDatabaseInternalType ($ typeName , $ enumType , $ nullable );
@@ -516,7 +512,6 @@ public function walkFunction($function)
516
512
$ queryComp = $ this ->queryComponents [$ dqlAlias ];
517
513
$ class = $ queryComp ['metadata ' ];
518
514
$ assoc = $ class ->associationMappings [$ assocField ];
519
- /** @var class-string $assocClassName */
520
515
$ assocClassName = $ assoc ['targetEntity ' ];
521
516
$ targetClass = $ this ->em ->getClassMetadata ($ assocClassName );
522
517
@@ -538,6 +533,10 @@ public function walkFunction($function)
538
533
539
534
[$ typeName , $ enumType ] = $ this ->getTypeOfField ($ targetClass , $ targetFieldName );
540
535
536
+ if (!isset ($ assoc ['joinColumns ' ])) {
537
+ return $ this ->marshalType (new MixedType ());
538
+ }
539
+
541
540
$ joinColumn = null ;
542
541
543
542
foreach ($ assoc ['joinColumns ' ] as $ item ) {
@@ -551,7 +550,7 @@ public function walkFunction($function)
551
550
return $ this ->marshalType (new MixedType ());
552
551
}
553
552
554
- $ nullable = (bool ) ( $ joinColumn ['nullable ' ] ?? true )
553
+ $ nullable = ($ joinColumn ['nullable ' ] ?? true )
555
554
|| $ this ->hasAggregateWithoutGroupBy ();
556
555
557
556
$ fieldType = $ this ->resolveDatabaseInternalType ($ typeName , $ enumType , $ nullable );
@@ -1296,7 +1295,6 @@ private function getTypeOfField(ClassMetadataInfo $class, string $fieldName): ar
1296
1295
{
1297
1296
assert (isset ($ class ->fieldMappings [$ fieldName ]));
1298
1297
1299
- /** @var array{type: string, enumType?: ?string} $metadata */
1300
1298
$ metadata = $ class ->fieldMappings [$ fieldName ];
1301
1299
1302
1300
$ type = $ metadata ['type ' ];
0 commit comments