@@ -88,7 +88,7 @@ public static function getSelectableFieldsAndRelations(
88
88
if (null !== $ primaryKey ) {
89
89
$ primaryKey = $ parentTable ? ($ parentTable . '. ' . $ primaryKey ) : $ primaryKey ;
90
90
91
- if (!in_array ($ primaryKey , $ select )) {
91
+ if (!\ in_array ($ primaryKey , $ select )) {
92
92
$ select [] = $ primaryKey ;
93
93
}
94
94
}
@@ -193,12 +193,12 @@ protected static function handleFields(
193
193
}
194
194
// With
195
195
196
- elseif (is_array ($ field ['fields ' ]) && !empty ($ field ['fields ' ]) && $ queryable ) {
196
+ elseif (\ is_array ($ field ['fields ' ]) && !empty ($ field ['fields ' ]) && $ queryable ) {
197
197
if (isset ($ parentType ->config ['model ' ])) {
198
198
// Get the next parent type, so that 'with' queries could be made
199
199
// Both keys for the relation are required (e.g 'id' <-> 'user_id')
200
200
$ relationsKey = $ fieldObject ->config ['alias ' ] ?? $ key ;
201
- $ relation = call_user_func ([app ($ parentType ->config ['model ' ]), $ relationsKey ]);
201
+ $ relation = \ call_user_func ([app ($ parentType ->config ['model ' ]), $ relationsKey ]);
202
202
203
203
static ::handleRelation ($ select , $ relation , $ parentTable , $ field );
204
204
@@ -279,15 +279,15 @@ protected static function addFieldToSelect($field, array &$select, ?string $pare
279
279
return ;
280
280
}
281
281
282
- if ($ forRelation && !array_key_exists ($ field , $ select ['fields ' ])) {
282
+ if ($ forRelation && !\ array_key_exists ($ field , $ select ['fields ' ])) {
283
283
$ select ['fields ' ][$ field ] = [
284
284
'args ' => [],
285
285
'fields ' => true ,
286
286
];
287
- } elseif (!$ forRelation && !in_array ($ field , $ select )) {
287
+ } elseif (!$ forRelation && !\ in_array ($ field , $ select )) {
288
288
$ field = $ parentTable ? ($ parentTable . '. ' . $ field ) : $ field ;
289
289
290
- if (!in_array ($ field , $ select )) {
290
+ if (!\ in_array ($ field , $ select )) {
291
291
$ select [] = $ field ;
292
292
}
293
293
}
@@ -318,14 +318,14 @@ protected static function validateField(FieldDefinition $fieldObject, array $que
318
318
319
319
switch ($ privacyClass ) {
320
320
// If privacy given as a closure
321
- case is_callable ($ privacyClass ):
321
+ case \ is_callable ($ privacyClass ):
322
322
if (false === $ privacyClass ($ queryArgs , $ ctx )) {
323
323
$ selectable = null ;
324
324
}
325
325
326
326
break ;
327
327
// If Privacy class given
328
- case is_string ($ privacyClass ):
328
+ case \ is_string ($ privacyClass ):
329
329
/** @var Privacy $instance */
330
330
$ instance = app ($ privacyClass );
331
331
@@ -381,27 +381,27 @@ protected static function handleRelation(array &$select, $relation, ?string $par
381
381
$ foreignKeyType = $ relation ->getMorphType ();
382
382
$ foreignKeyType = $ parentTable ? ($ parentTable . '. ' . $ foreignKeyType ) : $ foreignKeyType ;
383
383
384
- if (!in_array ($ foreignKey , $ select )) {
384
+ if (!\ in_array ($ foreignKey , $ select )) {
385
385
$ select [] = $ foreignKey ;
386
386
}
387
387
388
- if (!in_array ($ foreignKeyType , $ select )) {
388
+ if (!\ in_array ($ foreignKeyType , $ select )) {
389
389
$ select [] = $ foreignKeyType ;
390
390
}
391
391
} elseif (is_a ($ relation , BelongsTo::class)) {
392
- if (!in_array ($ foreignKey , $ select )) {
392
+ if (!\ in_array ($ foreignKey , $ select )) {
393
393
$ select [] = $ foreignKey ;
394
394
}
395
395
} // If 'HasMany', then add it in the 'with'
396
396
elseif ((is_a ($ relation , HasMany::class) || is_a ($ relation , MorphMany::class) || is_a (
397
397
$ relation ,
398
398
HasOne::class
399
399
) || is_a ($ relation , MorphOne::class)) &&
400
- !array_key_exists ($ foreignKey , $ field )) {
400
+ !\ array_key_exists ($ foreignKey , $ field )) {
401
401
$ segments = explode ('. ' , $ foreignKey );
402
402
$ foreignKey = end ($ segments );
403
403
404
- if (!array_key_exists ($ foreignKey , $ field )) {
404
+ if (!\ array_key_exists ($ foreignKey , $ field )) {
405
405
$ field ['fields ' ][$ foreignKey ] = static ::ALWAYS_RELATION_KEY ;
406
406
}
407
407
@@ -425,7 +425,7 @@ protected static function addAlwaysFields(
425
425
if (isset ($ fieldObject ->config ['always ' ])) {
426
426
$ always = $ fieldObject ->config ['always ' ];
427
427
428
- if (is_string ($ always )) {
428
+ if (\ is_string ($ always )) {
429
429
$ always = explode (', ' , $ always );
430
430
}
431
431
@@ -491,7 +491,7 @@ function (GraphqlType $type) use ($query) {
491
491
);
492
492
$ typesFiltered = array_values ($ typesFiltered ?? []);
493
493
494
- if (1 === count ($ typesFiltered )) {
494
+ if (1 === \ count ($ typesFiltered )) {
495
495
/* @var GraphqlType $type */
496
496
$ type = $ typesFiltered [0 ];
497
497
$ relationField = $ type ->getField ($ key );
0 commit comments