Skip to content

Commit e1569e1

Browse files
committedJun 17, 2021
composer fix-style
1.0.2 of mfn/php-cs-fixer-config now includes native_function_invocation with compiler_optimized
1 parent 7c45cb6 commit e1569e1

17 files changed

+56
-56
lines changed
 

‎src/Console/PublishCommand.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ public function handle(): void
5454
if ($this->files->exists($to) && !$this->option('force')) {
5555
continue;
5656
}
57-
$this->createParentDirectory(dirname($to));
57+
$this->createParentDirectory(\dirname($to));
5858
$this->files->copy($from, $to);
5959
$this->status($from, $to);
6060
}

‎src/GraphQL.php

+11-11
Original file line numberDiff line numberDiff line change
@@ -196,7 +196,7 @@ public function addTypes(array $types): void
196196
public function addType($class, string $name = null): void
197197
{
198198
if (!$name) {
199-
$type = is_object($class) ? $class : $this->app->make($class);
199+
$type = \is_object($class) ? $class : $this->app->make($class);
200200
$name = $type->name;
201201
}
202202

@@ -232,7 +232,7 @@ public function getType(string $name, bool $fresh = false): Type
232232
{
233233
$standardTypes = Type::getStandardTypes();
234234

235-
if (in_array($name, $standardTypes)) {
235+
if (\in_array($name, $standardTypes)) {
236236
return $standardTypes[$name];
237237
}
238238

@@ -252,7 +252,7 @@ public function getType(string $name, bool $fresh = false): Type
252252

253253
$type = $this->types[$name];
254254

255-
if (!is_object($type)) {
255+
if (!\is_object($type)) {
256256
$type = $this->app->make($type);
257257
}
258258

@@ -285,7 +285,7 @@ public function objectType($type, array $opts = []): Type
285285
$objectType->config[$key] = $value;
286286
}
287287
}
288-
} elseif (is_array($type)) {
288+
} elseif (\is_array($type)) {
289289
$objectType = $this->buildObjectTypeFromFields($type, $opts);
290290
} else {
291291
$objectType = $this->buildObjectTypeFromClass($type, $opts);
@@ -299,15 +299,15 @@ public function objectType($type, array $opts = []): Type
299299
*/
300300
protected function buildObjectTypeFromClass($type, array $opts = []): Type
301301
{
302-
if (!is_object($type)) {
302+
if (!\is_object($type)) {
303303
$type = $this->app->make($type);
304304
}
305305

306306
if (!$type instanceof TypeConvertible) {
307307
throw new TypeNotFound(
308308
sprintf(
309309
'Unable to convert %s to a GraphQL type, please add/implement the interface %s',
310-
get_class($type),
310+
\get_class($type),
311311
TypeConvertible::class
312312
)
313313
);
@@ -325,7 +325,7 @@ protected function buildObjectTypeFromFields(array $fields, array $opts = []): O
325325
$typeFields = [];
326326

327327
foreach ($fields as $name => $field) {
328-
if (is_string($field)) {
328+
if (\is_string($field)) {
329329
$field = $this->app->make($field);
330330
$name = is_numeric($name) ? $field->name : $name;
331331
$field->name = $name;
@@ -562,19 +562,19 @@ public static function getNormalizedSchemaConfiguration(string $schemaName): arr
562562
{
563563
$schemas = Config::get('graphql.schemas');
564564

565-
if (!array_key_exists($schemaName, $schemas)) {
565+
if (!\array_key_exists($schemaName, $schemas)) {
566566
throw new SchemaNotFound("No configuration for schema '$schemaName' found");
567567
}
568568

569569
$schemaConfig = $schemas[$schemaName];
570570

571-
if (!is_string($schemaConfig) && !is_array($schemaConfig)) {
571+
if (!\is_string($schemaConfig) && !\is_array($schemaConfig)) {
572572
throw new SchemaNotFound(
573573
sprintf(
574574
"Configuration for schema '%s' must be either an array or a class implementing %s, found type %s",
575575
$schemaName,
576576
ConfigConvertible::class,
577-
gettype($schemaConfig)
577+
\gettype($schemaConfig)
578578
)
579579
);
580580
}
@@ -583,7 +583,7 @@ public static function getNormalizedSchemaConfiguration(string $schemaName): arr
583583
throw new SchemaNotFound("Empty configuration found for schema '$schemaName'");
584584
}
585585

586-
if (is_string($schemaConfig)) {
586+
if (\is_string($schemaConfig)) {
587587
if (!class_exists($schemaConfig)) {
588588
throw new SchemaNotFound("Cannot find class '$schemaConfig' for schema '$schemaName'");
589589
}

‎src/GraphQLController.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ public function query(Request $request, RequestParser $parser, Repository $confi
2626
$headers = $config->get('graphql.headers', []);
2727
$jsonOptions = $config->get('graphql.json_encoding_options', 0);
2828

29-
$isBatch = is_array($operations);
29+
$isBatch = \is_array($operations);
3030

3131
$supportsBatching = $config->get('graphql.batching.enable', true);
3232

@@ -78,7 +78,7 @@ public function graphiql(Request $request, Repository $config, Factory $viewFact
7878
*/
7979
protected function createBatchingNotSupportedResponse(array $input): array
8080
{
81-
$count = min(count($input), 100);
81+
$count = min(\count($input), 100);
8282

8383
$data = [];
8484

‎src/Helpers.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ class Helpers
1717
*/
1818
public static function applyEach(Closure $callback, $valueOrValues)
1919
{
20-
if (is_array($valueOrValues)) {
20+
if (\is_array($valueOrValues)) {
2121
return array_map($callback, $valueOrValues);
2222
}
2323

‎src/Support/AliasArguments/AliasArguments.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ protected function getArrayDepth(array $array): int
4747
$maxDepth = 1;
4848

4949
foreach ($array as $value) {
50-
if (is_array($value)) {
50+
if (\is_array($value)) {
5151
$depth = $this->getArrayDepth($value) + 1;
5252

5353
if ($depth > $maxDepth) {

‎src/Support/AliasArguments/ArrayKeyChange.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ private function changeKey(array $target, array $segments, string $replaceKey):
3838
$segment = array_shift($segments);
3939

4040
if (empty($segments)) {
41-
if (array_key_exists($segment, $target) && $replaceKey !== $segment) {
41+
if (\array_key_exists($segment, $target) && $replaceKey !== $segment) {
4242
$target[$replaceKey] = $target[$segment];
4343
unset($target[$segment]);
4444
}
@@ -56,7 +56,7 @@ private function changeKey(array $target, array $segments, string $replaceKey):
5656
return $target;
5757
}
5858

59-
if (array_key_exists($segment, $target) && is_array($target[$segment])) {
59+
if (\array_key_exists($segment, $target) && \is_array($target[$segment])) {
6060
$target[$segment] = $this->changeKey($target[$segment], $segments, $replaceKey);
6161
}
6262

‎src/Support/Field.php

+6-6
Original file line numberDiff line numberDiff line change
@@ -133,15 +133,15 @@ protected function getResolver(): ?Closure
133133
->through($middleware)
134134
->via('resolve')
135135
->then(function ($arguments) use ($middleware, $resolver, $root) {
136-
$result = $resolver($root, ...array_slice($arguments, 1));
136+
$result = $resolver($root, ...\array_slice($arguments, 1));
137137

138138
foreach ($middleware as $name) {
139139
/** @var Middleware $instance */
140140
$instance = app()->make($name);
141141

142142
if (method_exists($instance, 'terminate')) {
143143
app()->terminating(function () use ($arguments, $instance, $result): void {
144-
$instance->terminate($this, ...array_slice($arguments, 1), ...[$result]);
144+
$instance->terminate($this, ...\array_slice($arguments, 1), ...[$result]);
145145
});
146146
}
147147
}
@@ -166,7 +166,7 @@ protected function originalResolver(): ?Closure
166166
// 2 - the "GraphQL query context" (see \Rebing\GraphQL\GraphQLController::queryContext)
167167
// 3 - \GraphQL\Type\Definition\ResolveInfo as provided by the underlying GraphQL PHP library
168168
// 4 (!) - added by this library, encapsulates creating a `SelectFields` instance
169-
$arguments = func_get_args();
169+
$arguments = \func_get_args();
170170

171171
// Validate mutation arguments
172172
$args = $arguments[1];
@@ -189,13 +189,13 @@ protected function originalResolver(): ?Closure
189189
$arguments[1] = $this->getArgs($arguments);
190190

191191
// Authorize
192-
if (true != call_user_func_array($authorize, $arguments)) {
192+
if (true != \call_user_func_array($authorize, $arguments)) {
193193
throw new AuthorizationError($this->getAuthorizationMessage());
194194
}
195195

196196
$method = new ReflectionMethod($this, 'resolve');
197197

198-
$additionalParams = array_slice($method->getParameters(), 3);
198+
$additionalParams = \array_slice($method->getParameters(), 3);
199199

200200
$additionalArguments = array_map(function ($param) use ($arguments, $fieldsAndArguments) {
201201
$paramType = $param->getType();
@@ -223,7 +223,7 @@ protected function originalResolver(): ?Closure
223223
return app()->make($className);
224224
}, $additionalParams);
225225

226-
return call_user_func_array($resolver, array_merge(
226+
return \call_user_func_array($resolver, array_merge(
227227
[$arguments[0], $arguments[1], $arguments[2]],
228228
$additionalArguments
229229
));

‎src/Support/InterfaceType.php

+4-4
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,9 @@ protected function getTypeResolver(): ?Closure
1818
$resolver = [$this, 'resolveType'];
1919

2020
return function () use ($resolver) {
21-
$args = func_get_args();
21+
$args = \func_get_args();
2222

23-
return call_user_func_array($resolver, $args);
23+
return \call_user_func_array($resolver, $args);
2424
};
2525
}
2626

@@ -33,9 +33,9 @@ protected function getTypesResolver(): ?Closure
3333
$resolver = [$this, 'types'];
3434

3535
return function () use ($resolver): array {
36-
$args = func_get_args();
36+
$args = \func_get_args();
3737

38-
return call_user_func_array($resolver, $args);
38+
return \call_user_func_array($resolver, $args);
3939
};
4040
}
4141

‎src/Support/Rules.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ public function get(): array
4141
*/
4242
protected function resolveRules($rules, array $arguments)
4343
{
44-
if (is_callable($rules)) {
44+
if (\is_callable($rules)) {
4545
return $rules($arguments, $this->requestArguments);
4646
}
4747

@@ -131,7 +131,7 @@ protected function getRules(array $fields, ?string $prefix, array $resolutionArg
131131
$rules[$key] = $this->resolveRules($fieldRules, $resolutionArguments);
132132
}
133133

134-
if (property_exists($field, 'type') && array_key_exists($name, $resolutionArguments) && is_array($resolutionArguments[$name])) {
134+
if (property_exists($field, 'type') && \array_key_exists($name, $resolutionArguments) && \is_array($resolutionArguments[$name])) {
135135
$type = $field instanceof InputObjectField
136136
? $field->getType()
137137
: $field->type;

‎src/Support/RulesInFields.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ public function get(): array
4141
*/
4242
protected function resolveRules($rules, array $arguments)
4343
{
44-
if (is_callable($rules)) {
44+
if (\is_callable($rules)) {
4545
return $rules($arguments);
4646
}
4747

@@ -70,7 +70,7 @@ protected function getRules(array $fields, ?string $prefix, Type $parentType): a
7070
continue;
7171
}
7272

73-
if (is_array($field['fields'])) {
73+
if (\is_array($field['fields'])) {
7474
$rules = $rules + $this->getRules($field['fields'], $key . '.fields', $fieldObject->getType());
7575
}
7676

‎src/Support/SelectFields.php

+15-15
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ public static function getSelectableFieldsAndRelations(
8888
if (null !== $primaryKey) {
8989
$primaryKey = $parentTable ? ($parentTable . '.' . $primaryKey) : $primaryKey;
9090

91-
if (!in_array($primaryKey, $select)) {
91+
if (!\in_array($primaryKey, $select)) {
9292
$select[] = $primaryKey;
9393
}
9494
}
@@ -193,12 +193,12 @@ protected static function handleFields(
193193
}
194194
// With
195195

196-
elseif (is_array($field['fields']) && !empty($field['fields']) && $queryable) {
196+
elseif (\is_array($field['fields']) && !empty($field['fields']) && $queryable) {
197197
if (isset($parentType->config['model'])) {
198198
// Get the next parent type, so that 'with' queries could be made
199199
// Both keys for the relation are required (e.g 'id' <-> 'user_id')
200200
$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]);
202202

203203
static::handleRelation($select, $relation, $parentTable, $field);
204204

@@ -279,15 +279,15 @@ protected static function addFieldToSelect($field, array &$select, ?string $pare
279279
return;
280280
}
281281

282-
if ($forRelation && !array_key_exists($field, $select['fields'])) {
282+
if ($forRelation && !\array_key_exists($field, $select['fields'])) {
283283
$select['fields'][$field] = [
284284
'args' => [],
285285
'fields' => true,
286286
];
287-
} elseif (!$forRelation && !in_array($field, $select)) {
287+
} elseif (!$forRelation && !\in_array($field, $select)) {
288288
$field = $parentTable ? ($parentTable . '.' . $field) : $field;
289289

290-
if (!in_array($field, $select)) {
290+
if (!\in_array($field, $select)) {
291291
$select[] = $field;
292292
}
293293
}
@@ -318,14 +318,14 @@ protected static function validateField(FieldDefinition $fieldObject, array $que
318318

319319
switch ($privacyClass) {
320320
// If privacy given as a closure
321-
case is_callable($privacyClass):
321+
case \is_callable($privacyClass):
322322
if (false === $privacyClass($queryArgs, $ctx)) {
323323
$selectable = null;
324324
}
325325

326326
break;
327327
// If Privacy class given
328-
case is_string($privacyClass):
328+
case \is_string($privacyClass):
329329
/** @var Privacy $instance */
330330
$instance = app($privacyClass);
331331

@@ -381,27 +381,27 @@ protected static function handleRelation(array &$select, $relation, ?string $par
381381
$foreignKeyType = $relation->getMorphType();
382382
$foreignKeyType = $parentTable ? ($parentTable . '.' . $foreignKeyType) : $foreignKeyType;
383383

384-
if (!in_array($foreignKey, $select)) {
384+
if (!\in_array($foreignKey, $select)) {
385385
$select[] = $foreignKey;
386386
}
387387

388-
if (!in_array($foreignKeyType, $select)) {
388+
if (!\in_array($foreignKeyType, $select)) {
389389
$select[] = $foreignKeyType;
390390
}
391391
} elseif (is_a($relation, BelongsTo::class)) {
392-
if (!in_array($foreignKey, $select)) {
392+
if (!\in_array($foreignKey, $select)) {
393393
$select[] = $foreignKey;
394394
}
395395
} // If 'HasMany', then add it in the 'with'
396396
elseif ((is_a($relation, HasMany::class) || is_a($relation, MorphMany::class) || is_a(
397397
$relation,
398398
HasOne::class
399399
) || is_a($relation, MorphOne::class)) &&
400-
!array_key_exists($foreignKey, $field)) {
400+
!\array_key_exists($foreignKey, $field)) {
401401
$segments = explode('.', $foreignKey);
402402
$foreignKey = end($segments);
403403

404-
if (!array_key_exists($foreignKey, $field)) {
404+
if (!\array_key_exists($foreignKey, $field)) {
405405
$field['fields'][$foreignKey] = static::ALWAYS_RELATION_KEY;
406406
}
407407

@@ -425,7 +425,7 @@ protected static function addAlwaysFields(
425425
if (isset($fieldObject->config['always'])) {
426426
$always = $fieldObject->config['always'];
427427

428-
if (is_string($always)) {
428+
if (\is_string($always)) {
429429
$always = explode(',', $always);
430430
}
431431

@@ -491,7 +491,7 @@ function (GraphqlType $type) use ($query) {
491491
);
492492
$typesFiltered = array_values($typesFiltered ?? []);
493493

494-
if (1 === count($typesFiltered)) {
494+
if (1 === \count($typesFiltered)) {
495495
/* @var GraphqlType $type */
496496
$type = $typesFiltered[0];
497497
$relationField = $type->getField($key);

‎src/Support/Type.php

+4-4
Original file line numberDiff line numberDiff line change
@@ -46,13 +46,13 @@ protected function getFieldResolver(string $name, array $field): ?callable
4646
$resolver = [$this, $resolveMethod];
4747

4848
return function () use ($resolver) {
49-
$args = func_get_args();
49+
$args = \func_get_args();
5050

51-
return call_user_func_array($resolver, $args);
51+
return \call_user_func_array($resolver, $args);
5252
};
5353
}
5454

55-
if (isset($field['alias']) && is_string($field['alias'])) {
55+
if (isset($field['alias']) && \is_string($field['alias'])) {
5656
$alias = $field['alias'];
5757

5858
return function ($type) use ($alias) {
@@ -69,7 +69,7 @@ public function getFields(): array
6969
$allFields = [];
7070

7171
foreach ($fields as $name => $field) {
72-
if (is_string($field)) {
72+
if (\is_string($field)) {
7373
$field = app($field);
7474
$field->name = $name;
7575
$allFields[$name] = $field->toArray();

‎tests/Support/Objects/ExamplesPaginationQuery.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ public function resolve($root, $args, $context, ResolveInfo $resolveInfo, Closur
4242

4343
return new LengthAwarePaginator(
4444
collect($data)->slice($page * $take, $take),
45-
count($data),
45+
\count($data),
4646
$take,
4747
$page
4848
);

‎tests/Support/Traits/SqlAssertionTrait.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ protected function setupSqlAssertionTrait(): void
4242
*/
4343
protected function assertSqlCount(int $expectedCount, string $msg = ''): void
4444
{
45-
$numSqlQueries = count($this->sqlQueryEvents);
45+
$numSqlQueries = \count($this->sqlQueryEvents);
4646

4747
if ($expectedCount === $numSqlQueries) {
4848
$this->sqlCounterReset();

‎tests/Support/Types/MyCustomScalarString.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ public function parseValue($value)
5050
public function parseLiteral(Node $valueNode, ?array $variables = null)
5151
{
5252
if (!$valueNode instanceof StringValueNode) {
53-
throw new InvariantViolation('Expected node of type ' . StringValueNode::class . ' , got ' . get_class($valueNode));
53+
throw new InvariantViolation('Expected node of type ' . StringValueNode::class . ' , got ' . \get_class($valueNode));
5454
}
5555

5656
return $valueNode->value;

‎tests/Unit/FieldTest.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ public function testGetAttributes(): void
3535
self::assertArrayHasKey('resolve', $attributes);
3636
self::assertIsArray($attributes['args']);
3737
self::assertInstanceOf(Closure::class, $attributes['resolve']);
38-
self::assertInstanceOf(get_class($field->type()), $attributes['type']);
38+
self::assertInstanceOf(\get_class($field->type()), $attributes['type']);
3939
}
4040

4141
public function testResolve(): void

‎tests/Unit/WithTypeTests/WrapperType.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ protected function getMessagesFields(string $typeName): array
4141
'data' => [
4242
'type' => GraphQL::type($typeName),
4343
'resolve' => function ($data) {
44-
return array_key_exists('data', $data) ?
44+
return \array_key_exists('data', $data) ?
4545
$data['data'] :
4646
$data;
4747
},

0 commit comments

Comments
 (0)
Please sign in to comment.