Skip to content

Commit 3b5c8dd

Browse files
committed
inline parser call
1 parent 9cb3f59 commit 3b5c8dd

File tree

1 file changed

+14
-18
lines changed

1 file changed

+14
-18
lines changed

tests/Utils/SchemaPrinterTest.php

Lines changed: 14 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1441,16 +1441,14 @@ interface FooInterface {
14411441

14421442
public function testDefaultPrinterDoesNotPrintAppliedDirectives(): void
14431443
{
1444-
$directive = static fn (string $directive): \GraphQL\Language\AST\DirectiveNode => Parser::directive($directive);
1445-
14461444
$schema = new Schema([
14471445
'query' => new ObjectType([
14481446
'name' => 'Query',
1449-
'directives' => [$directive('@onObject')],
1447+
'directives' => [Parser::directive('@onObject')],
14501448
'fields' => [
14511449
'hello' => [
14521450
'type' => Type::string(),
1453-
'directives' => [$directive('@onField')],
1451+
'directives' => [Parser::directive('@onField')],
14541452
],
14551453
],
14561454
]),
@@ -1474,8 +1472,6 @@ public function testDefaultPrinterDoesNotPrintAppliedDirectives(): void
14741472

14751473
public function testPrintWithDirectivesPrintsAllSupportedSdlLocations(): void
14761474
{
1477-
$directive = static fn (string $directive): \GraphQL\Language\AST\DirectiveNode => Parser::directive($directive);
1478-
14791475
$nodeType = new ObjectType([
14801476
'name' => 'NodeType',
14811477
'fields' => [
@@ -1492,39 +1488,39 @@ public function testPrintWithDirectivesPrintsAllSupportedSdlLocations(): void
14921488

14931489
$interfaceType = new InterfaceType([
14941490
'name' => 'Node',
1495-
'directives' => [$directive('@onInterface')],
1491+
'directives' => [Parser::directive('@onInterface')],
14961492
'fields' => [
14971493
'id' => [
14981494
'type' => Type::id(),
1499-
'directives' => [$directive('@onField')],
1495+
'directives' => [Parser::directive('@onField')],
15001496
],
15011497
],
15021498
]);
15031499

15041500
$enumType = new EnumType([
15051501
'name' => 'Status',
1506-
'directives' => [$directive('@onEnum')],
1502+
'directives' => [Parser::directive('@onEnum')],
15071503
'values' => [
15081504
'ACTIVE' => [
1509-
'directives' => [$directive('@onEnumValue')],
1505+
'directives' => [Parser::directive('@onEnumValue')],
15101506
],
15111507
],
15121508
]);
15131509

15141510
$inputType = new InputObjectType([
15151511
'name' => 'Input',
1516-
'directives' => [$directive('@onInputObject')],
1512+
'directives' => [Parser::directive('@onInputObject')],
15171513
'fields' => [
15181514
'name' => [
15191515
'type' => Type::string(),
1520-
'directives' => [$directive('@onInputField')],
1516+
'directives' => [Parser::directive('@onInputField')],
15211517
],
15221518
],
15231519
]);
15241520

15251521
$scalarType = new CustomScalarType([
15261522
'name' => 'CustomScalar',
1527-
'directives' => [$directive('@onScalar')],
1523+
'directives' => [Parser::directive('@onScalar')],
15281524
'serialize' => static fn ($value) => $value,
15291525
'parseValue' => static fn ($value) => $value,
15301526
'parseLiteral' => static fn ($valueNode) => $valueNode->value,
@@ -1533,21 +1529,21 @@ public function testPrintWithDirectivesPrintsAllSupportedSdlLocations(): void
15331529
$unionType = new UnionType([
15341530
'name' => 'SearchResult',
15351531
'types' => [$nodeType, $otherType],
1536-
'directives' => [$directive('@onUnion')],
1532+
'directives' => [Parser::directive('@onUnion')],
15371533
]);
15381534

15391535
$queryType = new ObjectType([
15401536
'name' => 'Query',
1541-
'directives' => [$directive('@onObject')],
1537+
'directives' => [Parser::directive('@onObject')],
15421538
'interfaces' => [$interfaceType],
15431539
'fields' => [
15441540
'node' => [
15451541
'type' => $nodeType,
1546-
'directives' => [$directive('@onField')],
1542+
'directives' => [Parser::directive('@onField')],
15471543
'args' => [
15481544
'input' => [
15491545
'type' => $inputType,
1550-
'directives' => [$directive('@onArg')],
1546+
'directives' => [Parser::directive('@onArg')],
15511547
],
15521548
],
15531549
],
@@ -1557,7 +1553,7 @@ public function testPrintWithDirectivesPrintsAllSupportedSdlLocations(): void
15571553
$schema = new Schema([
15581554
'query' => $queryType,
15591555
'types' => [$nodeType, $otherType, $interfaceType, $enumType, $inputType, $scalarType, $unionType],
1560-
'schemaDirectives' => [$directive('@onSchema')],
1556+
'schemaDirectives' => [Parser::directive('@onSchema')],
15611557
'directives' => [
15621558
new Directive(['name' => 'onSchema', 'locations' => [DirectiveLocation::SCHEMA]]),
15631559
new Directive(['name' => 'onScalar', 'locations' => [DirectiveLocation::SCALAR]]),

0 commit comments

Comments
 (0)